Class: AdvancedBilling::CustomPriceUsedForSubscriptionCreateUpdate
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CustomPriceUsedForSubscriptionCreateUpdate
- Defined in:
- lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb
Overview
(Optional) Used in place of ‘product_price_point_id` to define a custom price point unique to the subscription
Instance Attribute Summary collapse
-
#expiration_interval ⇒ Object
(Optional).
-
#expiration_interval_unit ⇒ IntervalUnit
(Optional).
-
#handle ⇒ String
(Optional).
-
#initial_charge_after_trial ⇒ TrueClass | FalseClass
(Optional).
-
#initial_charge_in_cents ⇒ Object
(Optional).
-
#interval ⇒ Object
Required if using ‘custom_price` attribute.
-
#interval_unit ⇒ IntervalUnit
Required if using ‘custom_price` attribute.
-
#name ⇒ String
(Optional).
-
#price_in_cents ⇒ Object
Required if using ‘custom_price` attribute.
-
#tax_included ⇒ TrueClass | FalseClass
(Optional).
-
#trial_interval ⇒ Object
(Optional).
-
#trial_interval_unit ⇒ IntervalUnit
(Optional).
-
#trial_price_in_cents ⇒ Object
(Optional).
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(name = SKIP, handle = SKIP, price_in_cents = SKIP, interval = SKIP, interval_unit = SKIP, trial_price_in_cents = SKIP, trial_interval = SKIP, trial_interval_unit = SKIP, initial_charge_in_cents = SKIP, initial_charge_after_trial = SKIP, expiration_interval = SKIP, expiration_interval_unit = SKIP, tax_included = SKIP) ⇒ CustomPriceUsedForSubscriptionCreateUpdate
constructor
A new instance of CustomPriceUsedForSubscriptionCreateUpdate.
Methods inherited from BaseModel
Constructor Details
#initialize(name = SKIP, handle = SKIP, price_in_cents = SKIP, interval = SKIP, interval_unit = SKIP, trial_price_in_cents = SKIP, trial_interval = SKIP, trial_interval_unit = SKIP, initial_charge_in_cents = SKIP, initial_charge_after_trial = SKIP, expiration_interval = SKIP, expiration_interval_unit = SKIP, tax_included = SKIP) ⇒ CustomPriceUsedForSubscriptionCreateUpdate
Returns a new instance of CustomPriceUsedForSubscriptionCreateUpdate.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 108 def initialize(name = SKIP, handle = SKIP, price_in_cents = SKIP, interval = SKIP, interval_unit = SKIP, trial_price_in_cents = SKIP, trial_interval = SKIP, trial_interval_unit = SKIP, initial_charge_in_cents = SKIP, initial_charge_after_trial = SKIP, expiration_interval = SKIP, expiration_interval_unit = SKIP, tax_included = SKIP) @name = name unless name == SKIP @handle = handle unless handle == SKIP @price_in_cents = price_in_cents unless price_in_cents == SKIP @interval = interval unless interval == SKIP @interval_unit = interval_unit unless interval_unit == SKIP @trial_price_in_cents = trial_price_in_cents unless trial_price_in_cents == SKIP @trial_interval = trial_interval unless trial_interval == SKIP @trial_interval_unit = trial_interval_unit unless trial_interval_unit == SKIP @initial_charge_in_cents = initial_charge_in_cents unless initial_charge_in_cents == SKIP unless initial_charge_after_trial == SKIP @initial_charge_after_trial = initial_charge_after_trial end @expiration_interval = expiration_interval unless expiration_interval == SKIP @expiration_interval_unit = expiration_interval_unit unless expiration_interval_unit == SKIP @tax_included = tax_included unless tax_included == SKIP end |
Instance Attribute Details
#expiration_interval ⇒ Object
(Optional)
55 56 57 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 55 def expiration_interval @expiration_interval end |
#expiration_interval_unit ⇒ IntervalUnit
(Optional)
59 60 61 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 59 def expiration_interval_unit @expiration_interval_unit end |
#handle ⇒ String
(Optional)
19 20 21 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 19 def handle @handle end |
#initial_charge_after_trial ⇒ TrueClass | FalseClass
(Optional)
51 52 53 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 51 def initial_charge_after_trial @initial_charge_after_trial end |
#initial_charge_in_cents ⇒ Object
(Optional)
47 48 49 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 47 def initial_charge_in_cents @initial_charge_in_cents end |
#interval ⇒ Object
Required if using ‘custom_price` attribute.
27 28 29 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 27 def interval @interval end |
#interval_unit ⇒ IntervalUnit
Required if using ‘custom_price` attribute.
31 32 33 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 31 def interval_unit @interval_unit end |
#name ⇒ String
(Optional)
15 16 17 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 15 def name @name end |
#price_in_cents ⇒ Object
Required if using ‘custom_price` attribute.
23 24 25 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 23 def price_in_cents @price_in_cents end |
#tax_included ⇒ TrueClass | FalseClass
(Optional)
63 64 65 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 63 def tax_included @tax_included end |
#trial_interval ⇒ Object
(Optional)
39 40 41 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 39 def trial_interval @trial_interval end |
#trial_interval_unit ⇒ IntervalUnit
(Optional)
43 44 45 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 43 def trial_interval_unit @trial_interval_unit end |
#trial_price_in_cents ⇒ Object
(Optional)
35 36 37 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 35 def trial_price_in_cents @trial_price_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 134 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP handle = hash.key?('handle') ? hash['handle'] : SKIP price_in_cents = hash.key?('price_in_cents') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdatePriceInCents), hash['price_in_cents'] ) : SKIP interval = hash.key?('interval') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateInterval), hash['interval'] ) : SKIP interval_unit = hash.key?('interval_unit') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateIntervalUnit), hash['interval_unit'] ) : SKIP trial_price_in_cents = hash.key?('trial_price_in_cents') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateTrialPriceInCents), hash['trial_price_in_cents'] ) : SKIP trial_interval = hash.key?('trial_interval') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateTrialInterval), hash['trial_interval'] ) : SKIP trial_interval_unit = hash.key?('trial_interval_unit') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateTrialIntervalUnit), hash['trial_interval_unit'] ) : SKIP initial_charge_in_cents = hash.key?('initial_charge_in_cents') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateInitialChargeInCents), hash['initial_charge_in_cents'] ) : SKIP initial_charge_after_trial = hash.key?('initial_charge_after_trial') ? hash['initial_charge_after_trial'] : SKIP expiration_interval = hash.key?('expiration_interval') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateExpirationInterval), hash['expiration_interval'] ) : SKIP expiration_interval_unit = hash.key?('expiration_interval_unit') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CustomPriceUsedForSubscriptionCreateUpdateExpirationIntervalUnit), hash['expiration_interval_unit'] ) : SKIP tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP # Create object from extracted values. CustomPriceUsedForSubscriptionCreateUpdate.new(name, handle, price_in_cents, interval, interval_unit, trial_price_in_cents, trial_interval, trial_interval_unit, initial_charge_in_cents, initial_charge_after_trial, expiration_interval, expiration_interval_unit, tax_included) end |
.names ⇒ Object
A mapping from model property names to API property names.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 66 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['handle'] = 'handle' @_hash['price_in_cents'] = 'price_in_cents' @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' @_hash['trial_price_in_cents'] = 'trial_price_in_cents' @_hash['trial_interval'] = 'trial_interval' @_hash['trial_interval_unit'] = 'trial_interval_unit' @_hash['initial_charge_in_cents'] = 'initial_charge_in_cents' @_hash['initial_charge_after_trial'] = 'initial_charge_after_trial' @_hash['expiration_interval'] = 'expiration_interval' @_hash['expiration_interval_unit'] = 'expiration_interval_unit' @_hash['tax_included'] = 'tax_included' @_hash end |
.nullables ⇒ Object
An array for nullable fields
104 105 106 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 104 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 85 def self.optionals %w[ name handle price_in_cents interval interval_unit trial_price_in_cents trial_interval trial_interval_unit initial_charge_in_cents initial_charge_after_trial expiration_interval expiration_interval_unit tax_included ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
189 190 191 192 193 194 195 |
# File 'lib/advanced_billing/models/custom_price_used_for_subscription_create_update.rb', line 189 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |