Class: OCI::MarketplacePublisher::Models::SaaSPricingPlan

Inherits:
PricingPlan
  • Object
show all
Defined in:
lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb

Overview

SaaS pricing plan.

Constant Summary collapse

BILLING_FREQUENCY_ENUM =
[
  BILLING_FREQUENCY_MONTHLY = 'MONTHLY'.freeze,
  BILLING_FREQUENCY_QUARTERLY = 'QUARTERLY'.freeze,
  BILLING_FREQUENCY_YEARLY = 'YEARLY'.freeze,
  BILLING_FREQUENCY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from PricingPlan

PricingPlan::PLAN_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from PricingPlan

#plan_type, #rates

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PricingPlan

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ SaaSPricingPlan

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 77

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['planType'] = 'FIXED'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

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

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

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

Instance Attribute Details

#billing_frequencyString

[Required] The plan billing frequency.

Returns:

  • (String)


31
32
33
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 31

def billing_frequency
  @billing_frequency
end

#extended_metadataHash<String, String>

Additional metadata key/value pairs for the saas pricing.

Returns:

  • (Hash<String, String>)


36
37
38
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 36

def 
  @extended_metadata
end

#nameString

[Required] The plan name.

Returns:

  • (String)


23
24
25
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 23

def name
  @name
end

#plan_descriptionString

[Required] The plan description.

Returns:

  • (String)


27
28
29
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 27

def plan_description
  @plan_description
end

Class Method Details

.attribute_mapObject

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



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 39

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'plan_type': :'planType',
    'rates': :'rates',
    'name': :'name',
    'plan_description': :'planDescription',
    'billing_frequency': :'billingFrequency',
    'extended_metadata': :'extendedMetadata'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 53

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



128
129
130
131
132
133
134
135
136
137
138
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 128

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

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



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 163

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


143
144
145
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 143

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



152
153
154
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 152

def hash
  [plan_type, rates, name, plan_description, billing_frequency, ].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 196

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



190
191
192
# File 'lib/oci/marketplace_publisher/models/saa_s_pricing_plan.rb', line 190

def to_s
  to_hash.to_s
end