Class: OCI::Self::Models::PricingPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/self/models/pricing_plan.rb

Overview

A pricing plan details provided by the Publisher.

Constant Summary collapse

PLAN_TYPE_ENUM =
[
  PLAN_TYPE_FIXED = 'FIXED'.freeze,
  PLAN_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
BILLING_FREQUENCY_ENUM =
[
  BILLING_FREQUENCY_YEARLY = 'YEARLY'.freeze,
  BILLING_FREQUENCY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PLAN_DURATION_ENUM =
[
  PLAN_DURATION_ANNUAL = 'ANNUAL'.freeze,
  PLAN_DURATION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PricingPlan

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/oci/self/models/pricing_plan.rb', line 91

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

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

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

  self.plan_name = attributes[:'planName'] if attributes[:'planName']

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

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

  self.plan_description = attributes[:'planDescription'] if attributes[:'planDescription']

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

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

  self.billing_frequency = attributes[:'billingFrequency'] if attributes[:'billingFrequency']

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

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

  self.plan_duration = attributes[:'planDuration'] if attributes[:'planDuration']

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

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

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

Instance Attribute Details

#billing_frequencyString

[Required] Specifies the interval at which billing occurs for the subscription plan.

Returns:

  • (String)


41
42
43
# File 'lib/oci/self/models/pricing_plan.rb', line 41

def billing_frequency
  @billing_frequency
end

#plan_descriptionString

A detailed explanation of the subscription plan.

Returns:

  • (String)


37
38
39
# File 'lib/oci/self/models/pricing_plan.rb', line 37

def plan_description
  @plan_description
end

#plan_durationString

Specifies the interval at which billing occurs for the subscription plan.

Returns:

  • (String)


45
46
47
# File 'lib/oci/self/models/pricing_plan.rb', line 45

def plan_duration
  @plan_duration
end

#plan_nameString

[Required] The name of the subscription plan used to identify the plan.

Returns:

  • (String)


33
34
35
# File 'lib/oci/self/models/pricing_plan.rb', line 33

def plan_name
  @plan_name
end

#plan_typeString

[Required] The type of the subscription plan.

Returns:

  • (String)


29
30
31
# File 'lib/oci/self/models/pricing_plan.rb', line 29

def plan_type
  @plan_type
end

#ratesArray<OCI::Self::Models::PricingRate>

[Required] The pricing details of the subscription plan in various supported currencies.

Returns:



49
50
51
# File 'lib/oci/self/models/pricing_plan.rb', line 49

def rates
  @rates
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/self/models/pricing_plan.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'plan_type': :'planType',
    'plan_name': :'planName',
    'plan_description': :'planDescription',
    'billing_frequency': :'billingFrequency',
    'plan_duration': :'planDuration',
    'rates': :'rates'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/self/models/pricing_plan.rb', line 66

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'plan_type': :'String',
    'plan_name': :'String',
    'plan_description': :'String',
    'billing_frequency': :'String',
    'plan_duration': :'String',
    'rates': :'Array<OCI::Self::Models::PricingRate>'
    # 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



176
177
178
179
180
181
182
183
184
185
186
# File 'lib/oci/self/models/pricing_plan.rb', line 176

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

  self.class == other.class &&
    plan_type == other.plan_type &&
    plan_name == other.plan_name &&
    plan_description == other.plan_description &&
    billing_frequency == other.billing_frequency &&
    plan_duration == other.plan_duration &&
    rates == other.rates
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



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/oci/self/models/pricing_plan.rb', line 211

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


191
192
193
# File 'lib/oci/self/models/pricing_plan.rb', line 191

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



200
201
202
# File 'lib/oci/self/models/pricing_plan.rb', line 200

def hash
  [plan_type, plan_name, plan_description, billing_frequency, plan_duration, rates].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



244
245
246
247
248
249
250
251
252
253
# File 'lib/oci/self/models/pricing_plan.rb', line 244

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



238
239
240
# File 'lib/oci/self/models/pricing_plan.rb', line 238

def to_s
  to_hash.to_s
end