Class: OCI::Onesubscription::Models::AggregatedComputedUsageSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb

Overview

Subscribed Service Contract details

Constant Summary collapse

PRICING_MODEL_ENUM =
[
  PRICING_MODEL_PAY_AS_YOU_GO = 'PAY_AS_YOU_GO'.freeze,
  PRICING_MODEL_MONTHLY = 'MONTHLY'.freeze,
  PRICING_MODEL_ANNUAL = 'ANNUAL'.freeze,
  PRICING_MODEL_PREPAID = 'PREPAID'.freeze,
  PRICING_MODEL_FUNDED_ALLOCATION = 'FUNDED_ALLOCATION'.freeze,
  PRICING_MODEL_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AggregatedComputedUsageSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 122

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

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

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

  self.parent_subscribed_service_id = attributes[:'parentSubscribedServiceId'] if attributes[:'parentSubscribedServiceId']

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

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

  self.parent_product = attributes[:'parentProduct'] if attributes[:'parentProduct']

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

  self.parent_product = attributes[:'parent_product'] if attributes[:'parent_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.plan_number = attributes[:'planNumber'] if attributes[:'planNumber']

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

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

  self.currency_code = attributes[:'currencyCode'] if attributes[:'currencyCode']

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

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

  self.rate_card_id = attributes[:'rateCardId'] if attributes[:'rateCardId']

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

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

  self.pricing_model = attributes[:'pricingModel'] if attributes[:'pricingModel']

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

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

  self.aggregated_computed_usages = attributes[:'aggregatedComputedUsages'] if attributes[:'aggregatedComputedUsages']

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

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

Instance Attribute Details

#aggregated_computed_usagesArray<OCI::Onesubscription::Models::ComputedUsageAggregation>

Aggregation of computed usages for the subscribed service.



68
69
70
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 68

def aggregated_computed_usages
  @aggregated_computed_usages
end

#currency_codeString

Currency code

Returns:

  • (String)


53
54
55
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 53

def currency_code
  @currency_code
end

#parent_productOCI::Onesubscription::Models::ComputedUsageProduct



33
34
35
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 33

def parent_product
  @parent_product
end

#parent_subscribed_service_idString

Subscribed service line parent id

Returns:

  • (String)


30
31
32
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 30

def parent_subscribed_service_id
  @parent_subscribed_service_id
end

#plan_numberString

Subscribed service asociated subscription plan number.

Returns:

  • (String)


48
49
50
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 48

def plan_number
  @plan_number
end

#pricing_modelString

Subscribed services pricing model

Returns:

  • (String)


63
64
65
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 63

def pricing_model
  @pricing_model
end

#rate_card_idString

Inernal SPM Ratecard Id at line level

Returns:

  • (String)


58
59
60
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 58

def rate_card_id
  @rate_card_id
end

#subscription_idString

[Required] Subscription Id is an identifier associated to the service used for filter the Computed Usage in SPM

Returns:

  • (String)


25
26
27
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 25

def subscription_id
  @subscription_id
end

#time_endDateTime

Subscribed services contract line end date, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


43
44
45
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 43

def time_end
  @time_end
end

#time_startDateTime

Subscribed services contract line start date, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


38
39
40
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 38

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'subscription_id': :'subscriptionId',
    'parent_subscribed_service_id': :'parentSubscribedServiceId',
    'parent_product': :'parentProduct',
    'time_start': :'timeStart',
    'time_end': :'timeEnd',
    'plan_number': :'planNumber',
    'currency_code': :'currencyCode',
    'rate_card_id': :'rateCardId',
    'pricing_model': :'pricingModel',
    'aggregated_computed_usages': :'aggregatedComputedUsages'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 89

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'subscription_id': :'String',
    'parent_subscribed_service_id': :'String',
    'parent_product': :'OCI::Onesubscription::Models::ComputedUsageProduct',
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'plan_number': :'String',
    'currency_code': :'String',
    'rate_card_id': :'String',
    'pricing_model': :'String',
    'aggregated_computed_usages': :'Array<OCI::Onesubscription::Models::ComputedUsageAggregation>'
    # 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



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 209

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

  self.class == other.class &&
    subscription_id == other.subscription_id &&
    parent_subscribed_service_id == other.parent_subscribed_service_id &&
    parent_product == other.parent_product &&
    time_start == other.time_start &&
    time_end == other.time_end &&
    plan_number == other.plan_number &&
    currency_code == other.currency_code &&
    rate_card_id == other.rate_card_id &&
    pricing_model == other.pricing_model &&
    aggregated_computed_usages == other.aggregated_computed_usages
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



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 248

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


228
229
230
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 228

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



237
238
239
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 237

def hash
  [subscription_id, parent_subscribed_service_id, parent_product, time_start, time_end, plan_number, currency_code, rate_card_id, pricing_model, aggregated_computed_usages].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 281

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



275
276
277
# File 'lib/oci/onesubscription/models/aggregated_computed_usage_summary.rb', line 275

def to_s
  to_hash.to_s
end