Class: OCI::Onesubscription::Models::InvoicelineComputedUsageSummary

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

Overview

Computed Usage Summary object

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_PROMOTION = 'PROMOTION'.freeze,
  TYPE_DO_NOT_BILL = 'DO_NOT_BILL'.freeze,
  TYPE_USAGE = 'USAGE'.freeze,
  TYPE_COMMIT = 'COMMIT'.freeze,
  TYPE_OVERAGE = 'OVERAGE'.freeze,
  TYPE_PAY_AS_YOU_GO = 'PAY_AS_YOU_GO'.freeze,
  TYPE_MONTHLY_MINIMUM = 'MONTHLY_MINIMUM'.freeze,
  TYPE_DELAYED_USAGE_INVOICE_TIMING = 'DELAYED_USAGE_INVOICE_TIMING'.freeze,
  TYPE_DELAYED_USAGE_COMMITMENT_EXP = 'DELAYED_USAGE_COMMITMENT_EXP'.freeze,
  TYPE_ON_ACCOUNT_CREDIT = 'ON_ACCOUNT_CREDIT'.freeze,
  TYPE_SERVICE_CREDIT = 'SERVICE_CREDIT'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InvoicelineComputedUsageSummary

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
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_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.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.product = attributes[:'product'] if attributes[:'product']

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

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

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

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

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

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

  self.cost_rounded = attributes[:'costRounded'] if attributes[:'costRounded']

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

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

Instance Attribute Details

#costFloat

Sum of Usage/Service Billing Line net Amount

Returns:

  • (Float)


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

def cost
  @cost
end

#cost_roundedFloat

[Required] Computed Line Amount rounded.

Returns:

  • (Float)


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

def cost_rounded
  @cost_rounded
end

#net_unit_priceFloat

[Required] Net Unit Price for the product in consideration, price actual.

Returns:

  • (Float)


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

def net_unit_price
  @net_unit_price
end

#parent_productOCI::Onesubscription::Models::InvoicingProduct

This attribute is required.



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

def parent_product
  @parent_product
end

#productOCI::Onesubscription::Models::InvoicingProduct



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

def product
  @product
end

#quantityFloat

[Required] Total Quantity that was used for computation

Returns:

  • (Float)


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

def quantity
  @quantity
end

#time_metered_onDateTime

[Required] Metered Service date.

Returns:

  • (DateTime)


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

def time_metered_on
  @time_metered_on
end

#typeString

[Required] Usage compute type in SPM.

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 66

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'parent_product': :'parentProduct',
    'product': :'product',
    'quantity': :'quantity',
    'net_unit_price': :'netUnitPrice',
    'time_metered_on': :'timeMeteredOn',
    'type': :'type',
    'cost': :'cost',
    'cost_rounded': :'costRounded'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 82

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'parent_product': :'OCI::Onesubscription::Models::InvoicingProduct',
    'product': :'OCI::Onesubscription::Models::InvoicingProduct',
    'quantity': :'Float',
    'net_unit_price': :'Float',
    'time_metered_on': :'DateTime',
    'type': :'String',
    'cost': :'Float',
    'cost_rounded': :'Float'
    # 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



170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 170

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

  self.class == other.class &&
    parent_product == other.parent_product &&
    product == other.product &&
    quantity == other.quantity &&
    net_unit_price == other.net_unit_price &&
    time_metered_on == other.time_metered_on &&
    type == other.type &&
    cost == other.cost &&
    cost_rounded == other.cost_rounded
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



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 207

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


187
188
189
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 187

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

def hash
  [parent_product, product, quantity, net_unit_price, time_metered_on, type, cost, cost_rounded].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



240
241
242
243
244
245
246
247
248
249
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 240

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



234
235
236
# File 'lib/oci/onesubscription/models/invoiceline_computed_usage_summary.rb', line 234

def to_s
  to_hash.to_s
end