Class: OCI::Onesubscription::Models::RateCardSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/onesubscription/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):



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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 111

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.subscribed_service_id = attributes[:'subscribedServiceId'] if attributes[:'subscribedServiceId']

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

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

  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::Onesubscription::Models::SubscriptionCurrency



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

def currency
  @currency
end

#discretionary_discount_percentageString

Rate card discretionary discount percentage

Returns:

  • (String)


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

def discretionary_discount_percentage
  @discretionary_discount_percentage
end

#is_tierBOOLEAN

Rate card price tier flag

Returns:

  • (BOOLEAN)


49
50
51
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 49

def is_tier
  @is_tier
end

#net_unit_priceString

[Required] Rate card net unit price

Returns:

  • (String)


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

def net_unit_price
  @net_unit_price
end

#overage_priceString

[Required] Rate card overage price

Returns:

  • (String)


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

def overage_price
  @overage_price
end

#productOCI::Onesubscription::Models::RateCardProduct

This attribute is required.



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

def product
  @product
end

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

List of tiered rate card prices



57
58
59
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 57

def rate_card_tiers
  @rate_card_tiers
end

#subscribed_service_idString

SPM internal Subscribed Service ID

Returns:

  • (String)


15
16
17
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 15

def subscribed_service_id
  @subscribed_service_id
end

#time_endDateTime

Rate card end date

Returns:

  • (DateTime)


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

def time_end
  @time_end
end

#time_startDateTime

Rate card start date

Returns:

  • (DateTime)


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

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 60

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'subscribed_service_id': :'subscribedServiceId',
    '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.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 78

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'subscribed_service_id': :'String',
    'product': :'OCI::Onesubscription::Models::RateCardProduct',
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'net_unit_price': :'String',
    'discretionary_discount_percentage': :'String',
    'overage_price': :'String',
    'is_tier': :'BOOLEAN',
    'currency': :'OCI::Onesubscription::Models::SubscriptionCurrency',
    'rate_card_tiers': :'Array<OCI::Onesubscription::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



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 177

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

  self.class == other.class &&
    subscribed_service_id == other.subscribed_service_id &&
    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



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 216

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


196
197
198
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 196

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



205
206
207
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 205

def hash
  [subscribed_service_id, 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



249
250
251
252
253
254
255
256
257
258
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 249

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



243
244
245
# File 'lib/oci/onesubscription/models/rate_card_summary.rb', line 243

def to_s
  to_hash.to_s
end