Class: AdvancedBilling::SubscriptionGroupSignupComponent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionGroupSignupComponent
- Defined in:
- lib/advanced_billing/models/subscription_group_signup_component.rb
Overview
SubscriptionGroupSignupComponent Model.
Instance Attribute Summary collapse
-
#allocated_quantity ⇒ Object
Required if passing any component to ‘components` attribute.
-
#component_id ⇒ Object
Required if passing any component to ‘components` attribute.
-
#custom_price ⇒ SubscriptionGroupComponentCustomPrice
Used in place of ‘price_point_id` to define a custom price point unique to the subscription.
-
#price_point_id ⇒ Object
Required if passing any component to ‘components` attribute.
-
#unit_balance ⇒ Object
Required if passing any component to ‘components` attribute.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(component_id: SKIP, allocated_quantity: SKIP, unit_balance: SKIP, price_point_id: SKIP, custom_price: SKIP, additional_properties: {}) ⇒ SubscriptionGroupSignupComponent
constructor
A new instance of SubscriptionGroupSignupComponent.
Methods inherited from BaseModel
Constructor Details
#initialize(component_id: SKIP, allocated_quantity: SKIP, unit_balance: SKIP, price_point_id: SKIP, custom_price: SKIP, additional_properties: {}) ⇒ SubscriptionGroupSignupComponent
Returns a new instance of SubscriptionGroupSignupComponent.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 60 def initialize(component_id: SKIP, allocated_quantity: SKIP, unit_balance: SKIP, price_point_id: SKIP, custom_price: SKIP, additional_properties: {}) @component_id = component_id unless component_id == SKIP @allocated_quantity = allocated_quantity unless allocated_quantity == SKIP @unit_balance = unit_balance unless unit_balance == SKIP @price_point_id = price_point_id unless price_point_id == SKIP @custom_price = custom_price unless custom_price == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#allocated_quantity ⇒ Object
Required if passing any component to ‘components` attribute.
18 19 20 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 18 def allocated_quantity @allocated_quantity end |
#component_id ⇒ Object
Required if passing any component to ‘components` attribute.
14 15 16 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 14 def component_id @component_id end |
#custom_price ⇒ SubscriptionGroupComponentCustomPrice
Used in place of ‘price_point_id` to define a custom price point unique to the subscription. You still need to provide `component_id`.
31 32 33 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 31 def custom_price @custom_price end |
#price_point_id ⇒ Object
Required if passing any component to ‘components` attribute.
26 27 28 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 26 def price_point_id @price_point_id end |
#unit_balance ⇒ Object
Required if passing any component to ‘components` attribute.
22 23 24 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 22 def unit_balance @unit_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 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 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. component_id = hash.key?('component_id') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionGroupSignupComponentComponentId), hash['component_id'] ) : SKIP allocated_quantity = hash.key?('allocated_quantity') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionGroupSignupComponentAllocatedQuantity), hash['allocated_quantity'] ) : SKIP unit_balance = hash.key?('unit_balance') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionGroupSignupComponentUnitBalance), hash['unit_balance'] ) : SKIP price_point_id = hash.key?('price_point_id') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionGroupSignupComponentPricePointId), hash['price_point_id'] ) : SKIP custom_price = SubscriptionGroupComponentCustomPrice.from_hash(hash['custom_price']) if hash['custom_price'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. SubscriptionGroupSignupComponent.new(component_id: component_id, allocated_quantity: allocated_quantity, unit_balance: unit_balance, price_point_id: price_point_id, custom_price: custom_price, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['component_id'] = 'component_id' @_hash['allocated_quantity'] = 'allocated_quantity' @_hash['unit_balance'] = 'unit_balance' @_hash['price_point_id'] = 'price_point_id' @_hash['custom_price'] = 'custom_price' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 45 def self.optionals %w[ component_id allocated_quantity unit_balance price_point_id custom_price ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
109 110 111 112 113 114 115 |
# File 'lib/advanced_billing/models/subscription_group_signup_component.rb', line 109 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |