Class: OCI::Marketplace::Models::PricingModel

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/marketplace/models/pricing_model.rb

Overview

The model for pricing.

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_FREE = 'FREE'.freeze,
  TYPE_BYOL = 'BYOL'.freeze,
  TYPE_PAYGO = 'PAYGO'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PAY_GO_STRATEGY_ENUM =
[
  PAY_GO_STRATEGY_PER_OCPU_LINEAR = 'PER_OCPU_LINEAR'.freeze,
  PAY_GO_STRATEGY_PER_OCPU_MIN_BILLING = 'PER_OCPU_MIN_BILLING'.freeze,
  PAY_GO_STRATEGY_PER_INSTANCE = 'PER_INSTANCE'.freeze,
  PAY_GO_STRATEGY_PER_INSTANCE_MONTHLY_INCLUSIVE = 'PER_INSTANCE_MONTHLY_INCLUSIVE'.freeze,
  PAY_GO_STRATEGY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
CURRENCY_ENUM =
[
  CURRENCY_USD = 'USD'.freeze,
  CURRENCY_CAD = 'CAD'.freeze,
  CURRENCY_INR = 'INR'.freeze,
  CURRENCY_GBP = 'GBP'.freeze,
  CURRENCY_BRL = 'BRL'.freeze,
  CURRENCY_JPY = 'JPY'.freeze,
  CURRENCY_OMR = 'OMR'.freeze,
  CURRENCY_EUR = 'EUR'.freeze,
  CURRENCY_CHF = 'CHF'.freeze,
  CURRENCY_MXN = 'MXN'.freeze,
  CURRENCY_CLP = 'CLP'.freeze,
  CURRENCY_ALL = 'ALL'.freeze,
  CURRENCY_ARS = 'ARS'.freeze,
  CURRENCY_AUD = 'AUD'.freeze,
  CURRENCY_BDT = 'BDT'.freeze,
  CURRENCY_BAM = 'BAM'.freeze,
  CURRENCY_BGN = 'BGN'.freeze,
  CURRENCY_CNY = 'CNY'.freeze,
  CURRENCY_COP = 'COP'.freeze,
  CURRENCY_CRC = 'CRC'.freeze,
  CURRENCY_HRK = 'HRK'.freeze,
  CURRENCY_CZK = 'CZK'.freeze,
  CURRENCY_DKK = 'DKK'.freeze,
  CURRENCY_EGP = 'EGP'.freeze,
  CURRENCY_HKD = 'HKD'.freeze,
  CURRENCY_HUF = 'HUF'.freeze,
  CURRENCY_ISK = 'ISK'.freeze,
  CURRENCY_IDR = 'IDR'.freeze,
  CURRENCY_ILS = 'ILS'.freeze,
  CURRENCY_JMD = 'JMD'.freeze,
  CURRENCY_KZT = 'KZT'.freeze,
  CURRENCY_KES = 'KES'.freeze,
  CURRENCY_KRW = 'KRW'.freeze,
  CURRENCY_KWD = 'KWD'.freeze,
  CURRENCY_LBP = 'LBP'.freeze,
  CURRENCY_MOP = 'MOP'.freeze,
  CURRENCY_MYR = 'MYR'.freeze,
  CURRENCY_MVR = 'MVR'.freeze,
  CURRENCY_AED = 'AED'.freeze,
  CURRENCY_NZD = 'NZD'.freeze,
  CURRENCY_NOK = 'NOK'.freeze,
  CURRENCY_PKR = 'PKR'.freeze,
  CURRENCY_PEN = 'PEN'.freeze,
  CURRENCY_PHP = 'PHP'.freeze,
  CURRENCY_PLN = 'PLN'.freeze,
  CURRENCY_QAR = 'QAR'.freeze,
  CURRENCY_RON = 'RON'.freeze,
  CURRENCY_SAR = 'SAR'.freeze,
  CURRENCY_RSD = 'RSD'.freeze,
  CURRENCY_SGD = 'SGD'.freeze,
  CURRENCY_ZAR = 'ZAR'.freeze,
  CURRENCY_SEK = 'SEK'.freeze,
  CURRENCY_TWD = 'TWD'.freeze,
  CURRENCY_THB = 'THB'.freeze,
  CURRENCY_TRY = 'TRY'.freeze,
  CURRENCY_VND = 'VND'.freeze,
  CURRENCY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PricingModel

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/oci/marketplace/models/pricing_model.rb', line 143

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

  self.pay_go_strategy = attributes[:'payGoStrategy'] if attributes[:'payGoStrategy']

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

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

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

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

  self.international_market_price = attributes[:'internationalMarketPrice'] if attributes[:'internationalMarketPrice']

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

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

Instance Attribute Details

#currencyString

The currency of the pricing model.

Returns:

  • (String)


97
98
99
# File 'lib/oci/marketplace/models/pricing_model.rb', line 97

def currency
  @currency
end

#international_market_priceOCI::Marketplace::Models::InternationalMarketPrice



104
105
106
# File 'lib/oci/marketplace/models/pricing_model.rb', line 104

def international_market_price
  @international_market_price
end

#pay_go_strategyString

The type of pricing for a PAYGO model, eg PER_OCPU_LINEAR, PER_OCPU_MIN_BILLING, PER_INSTANCE. Null if type is not PAYGO.

Returns:

  • (String)


93
94
95
# File 'lib/oci/marketplace/models/pricing_model.rb', line 93

def pay_go_strategy
  @pay_go_strategy
end

#rateFloat

The pricing rate.

Returns:

  • (Float)


101
102
103
# File 'lib/oci/marketplace/models/pricing_model.rb', line 101

def rate
  @rate
end

#typeString

[Required] The type of the pricing model.

Returns:

  • (String)


89
90
91
# File 'lib/oci/marketplace/models/pricing_model.rb', line 89

def type
  @type
end

Class Method Details

.attribute_mapObject

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



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/oci/marketplace/models/pricing_model.rb', line 107

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'pay_go_strategy': :'payGoStrategy',
    'currency': :'currency',
    'rate': :'rate',
    'international_market_price': :'internationalMarketPrice'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/oci/marketplace/models/pricing_model.rb', line 120

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'pay_go_strategy': :'String',
    'currency': :'String',
    'rate': :'Float',
    'international_market_price': :'OCI::Marketplace::Models::InternationalMarketPrice'
    # 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



214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/marketplace/models/pricing_model.rb', line 214

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

  self.class == other.class &&
    type == other.type &&
    pay_go_strategy == other.pay_go_strategy &&
    currency == other.currency &&
    rate == other.rate &&
    international_market_price == other.international_market_price
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/marketplace/models/pricing_model.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/marketplace/models/pricing_model.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/marketplace/models/pricing_model.rb', line 237

def hash
  [type, pay_go_strategy, currency, rate, international_market_price].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/marketplace/models/pricing_model.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/marketplace/models/pricing_model.rb', line 275

def to_s
  to_hash.to_s
end