Class: OCI::OsubSubscription::Models::RateCardSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/osub_subscription/models/rate_card_summary.rb

Overview

Rate Card Summary

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RateCardSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 103

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.product = attributes[:'product'] if attributes[:'product']

  self.time_start = attributes[:'timeStart'] if attributes[:'timeStart']

  raise 'You cannot provide both :timeStart and :time_start' if attributes.key?(:'timeStart') && attributes.key?(:'time_start')

  self.time_start = attributes[:'time_start'] if attributes[:'time_start']

  self.time_end = attributes[:'timeEnd'] if attributes[:'timeEnd']

  raise 'You cannot provide both :timeEnd and :time_end' if attributes.key?(:'timeEnd') && attributes.key?(:'time_end')

  self.time_end = attributes[:'time_end'] if attributes[:'time_end']

  self.net_unit_price = attributes[:'netUnitPrice'] if attributes[:'netUnitPrice']

  raise 'You cannot provide both :netUnitPrice and :net_unit_price' if attributes.key?(:'netUnitPrice') && attributes.key?(:'net_unit_price')

  self.net_unit_price = attributes[:'net_unit_price'] if attributes[:'net_unit_price']

  self.discretionary_discount_percentage = attributes[:'discretionaryDiscountPercentage'] if attributes[:'discretionaryDiscountPercentage']

  raise 'You cannot provide both :discretionaryDiscountPercentage and :discretionary_discount_percentage' if attributes.key?(:'discretionaryDiscountPercentage') && attributes.key?(:'discretionary_discount_percentage')

  self.discretionary_discount_percentage = attributes[:'discretionary_discount_percentage'] if attributes[:'discretionary_discount_percentage']

  self.overage_price = attributes[:'overagePrice'] if attributes[:'overagePrice']

  raise 'You cannot provide both :overagePrice and :overage_price' if attributes.key?(:'overagePrice') && attributes.key?(:'overage_price')

  self.overage_price = attributes[:'overage_price'] if attributes[:'overage_price']

  self.is_tier = attributes[:'isTier'] unless attributes[:'isTier'].nil?

  raise 'You cannot provide both :isTier and :is_tier' if attributes.key?(:'isTier') && attributes.key?(:'is_tier')

  self.is_tier = attributes[:'is_tier'] unless attributes[:'is_tier'].nil?

  self.currency = attributes[:'currency'] if attributes[:'currency']

  self.rate_card_tiers = attributes[:'rateCardTiers'] if attributes[:'rateCardTiers']

  raise 'You cannot provide both :rateCardTiers and :rate_card_tiers' if attributes.key?(:'rateCardTiers') && attributes.key?(:'rate_card_tiers')

  self.rate_card_tiers = attributes[:'rate_card_tiers'] if attributes[:'rate_card_tiers']
end

Instance Attribute Details

#currencyOCI::OsubSubscription::Models::Currency



47
48
49
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 47

def currency
  @currency
end

#discretionary_discount_percentageString

Rate card discretionary discount percentage

Returns:

  • (String)


34
35
36
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 34

def discretionary_discount_percentage
  @discretionary_discount_percentage
end

#is_tierBOOLEAN

Rate card price tier flag

Returns:

  • (BOOLEAN)


44
45
46
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 44

def is_tier
  @is_tier
end

#net_unit_priceString

[Required] Rate card net unit price

Returns:

  • (String)


29
30
31
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 29

def net_unit_price
  @net_unit_price
end

#overage_priceString

[Required] Rate card overage price

Returns:

  • (String)


39
40
41
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 39

def overage_price
  @overage_price
end

#productOCI::OsubSubscription::Models::Product

This attribute is required.



14
15
16
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 14

def product
  @product
end

#rate_card_tiersArray<OCI::OsubSubscription::Models::RateCardTier>

List of tiered rate card prices



52
53
54
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 52

def rate_card_tiers
  @rate_card_tiers
end

#time_endDateTime

Rate card end date

Returns:

  • (DateTime)


24
25
26
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 24

def time_end
  @time_end
end

#time_startDateTime

Rate card start date

Returns:

  • (DateTime)


19
20
21
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 19

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 55

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'product': :'product',
    'time_start': :'timeStart',
    'time_end': :'timeEnd',
    'net_unit_price': :'netUnitPrice',
    'discretionary_discount_percentage': :'discretionaryDiscountPercentage',
    'overage_price': :'overagePrice',
    'is_tier': :'isTier',
    'currency': :'currency',
    'rate_card_tiers': :'rateCardTiers'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 72

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'product': :'OCI::OsubSubscription::Models::Product',
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'net_unit_price': :'String',
    'discretionary_discount_percentage': :'String',
    'overage_price': :'String',
    'is_tier': :'BOOLEAN',
    'currency': :'OCI::OsubSubscription::Models::Currency',
    'rate_card_tiers': :'Array<OCI::OsubSubscription::Models::RateCardTier>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 163

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    product == other.product &&
    time_start == other.time_start &&
    time_end == other.time_end &&
    net_unit_price == other.net_unit_price &&
    discretionary_discount_percentage == other.discretionary_discount_percentage &&
    overage_price == other.overage_price &&
    is_tier == other.is_tier &&
    currency == other.currency &&
    rate_card_tiers == other.rate_card_tiers
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 201

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


181
182
183
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 181

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



190
191
192
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 190

def hash
  [product, time_start, time_end, net_unit_price, discretionary_discount_percentage, overage_price, is_tier, currency, rate_card_tiers].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 234

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



228
229
230
# File 'lib/oci/osub_subscription/models/rate_card_summary.rb', line 228

def to_s
  to_hash.to_s
end