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_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):



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/oci/marketplace/models/pricing_model.rb', line 98

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)


52
53
54
# File 'lib/oci/marketplace/models/pricing_model.rb', line 52

def currency
  @currency
end

#international_market_priceOCI::Marketplace::Models::InternationalMarketPrice



59
60
61
# File 'lib/oci/marketplace/models/pricing_model.rb', line 59

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)


48
49
50
# File 'lib/oci/marketplace/models/pricing_model.rb', line 48

def pay_go_strategy
  @pay_go_strategy
end

#rateFloat

The pricing rate.

Returns:

  • (Float)


56
57
58
# File 'lib/oci/marketplace/models/pricing_model.rb', line 56

def rate
  @rate
end

#typeString

[Required] The type of the pricing model.

Returns:

  • (String)


44
45
46
# File 'lib/oci/marketplace/models/pricing_model.rb', line 44

def type
  @type
end

Class Method Details

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/marketplace/models/pricing_model.rb', line 62

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.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/oci/marketplace/models/pricing_model.rb', line 75

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



169
170
171
172
173
174
175
176
177
178
# File 'lib/oci/marketplace/models/pricing_model.rb', line 169

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



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/oci/marketplace/models/pricing_model.rb', line 203

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


183
184
185
# File 'lib/oci/marketplace/models/pricing_model.rb', line 183

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



192
193
194
# File 'lib/oci/marketplace/models/pricing_model.rb', line 192

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



236
237
238
239
240
241
242
243
244
245
# File 'lib/oci/marketplace/models/pricing_model.rb', line 236

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



230
231
232
# File 'lib/oci/marketplace/models/pricing_model.rb', line 230

def to_s
  to_hash.to_s
end