Class: MetronomeSDK::Models::V1::Contracts::QuantityConversion

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/metronome_sdk/models/v1/contracts/quantity_conversion.rb

Defined Under Namespace

Modules: Operation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(conversion_factor: , operation: , name: nil) ⇒ Object

Optional. Only valid for USAGE products. If provided, the quantity will be converted using the provided conversion factor and operation. For example, if the operation is “multiply” and the conversion factor is 100, then the quantity will be multiplied by 100. This can be used in cases where data is sent in one unit and priced in another. For example, data could be sent in MB and priced in GB. In this case, the conversion factor would be 1024 and the operation would be “divide”.

Parameters:



# File 'lib/metronome_sdk/models/v1/contracts/quantity_conversion.rb', line 26

Instance Attribute Details

#conversion_factorFloat

The factor to multiply or divide the quantity by.

Returns:

  • (Float)


12
# File 'lib/metronome_sdk/models/v1/contracts/quantity_conversion.rb', line 12

required :conversion_factor, Float

#nameString?

Optional name for this conversion.

Returns:

  • (String, nil)


24
# File 'lib/metronome_sdk/models/v1/contracts/quantity_conversion.rb', line 24

optional :name, String

#operationSymbol, MetronomeSDK::Models::V1::Contracts::QuantityConversion::Operation

The operation to perform on the quantity



18
# File 'lib/metronome_sdk/models/v1/contracts/quantity_conversion.rb', line 18

required :operation, enum: -> { MetronomeSDK::V1::Contracts::QuantityConversion::Operation }