Class: OCI::OsubUsage::Models::ComputedUsageAggregatedSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/osub_usage/models/computed_usage_aggregated_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 = {}) ⇒ ComputedUsageAggregatedSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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

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::OsubUsage::Models::ComputedUsageAggregation>

Aggregation of computed usages for the subscribed service.



67
68
69
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 67

def aggregated_computed_usages
  @aggregated_computed_usages
end

#currency_codeString

Currency code

Returns:

  • (String)


52
53
54
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 52

def currency_code
  @currency_code
end

#parent_productOCI::OsubUsage::Models::Product



32
33
34
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 32

def parent_product
  @parent_product
end

#parent_subscribed_service_idString

Subscribed service line parent id

Returns:

  • (String)


29
30
31
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 29

def parent_subscribed_service_id
  @parent_subscribed_service_id
end

#plan_numberString

Subscribed service asociated subscription plan number.

Returns:

  • (String)


47
48
49
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 47

def plan_number
  @plan_number
end

#pricing_modelString

Subscribed services pricing model

Returns:

  • (String)


62
63
64
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 62

def pricing_model
  @pricing_model
end

#rate_card_idString

Inernal SPM Ratecard Id at line level

Returns:

  • (String)


57
58
59
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 57

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)


24
25
26
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 24

def subscription_id
  @subscription_id
end

#time_endDateTime

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

Returns:

  • (DateTime)


42
43
44
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 42

def time_end
  @time_end
end

#time_startDateTime

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

Returns:

  • (DateTime)


37
38
39
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 37

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


227
228
229
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 227

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



236
237
238
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 236

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



280
281
282
283
284
285
286
287
288
289
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 280

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



274
275
276
# File 'lib/oci/osub_usage/models/computed_usage_aggregated_summary.rb', line 274

def to_s
  to_hash.to_s
end