Class: AdvancedBilling::ProductPricePoint
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ProductPricePoint
- Defined in:
- lib/advanced_billing/models/product_price_point.rb
Overview
ProductPricePoint Model.
Instance Attribute Summary collapse
-
#archived_at ⇒ String
reserved for future use.
-
#created_at ⇒ String
reserved for future use.
-
#expiration_interval ⇒ Integer
reserved for future use.
-
#expiration_interval_unit ⇒ String
reserved for future use.
-
#handle ⇒ String
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#initial_charge_after_trial ⇒ TrueClass | FalseClass
reserved for future use.
-
#initial_charge_in_cents ⇒ Integer
reserved for future use.
-
#interval ⇒ Integer
TODO: Write general description for this method.
-
#interval_unit ⇒ String
TODO: Write general description for this method.
-
#introductory_offer ⇒ TrueClass | FalseClass
reserved for future use.
-
#name ⇒ String
TODO: Write general description for this method.
-
#price_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#product_id ⇒ Integer
reserved for future use.
-
#subscription_id ⇒ Integer
Price point type.
-
#tax_included ⇒ TrueClass | FalseClass
Price point type.
-
#trial_interval ⇒ Integer
TODO: Write general description for this method.
-
#trial_interval_unit ⇒ String
TODO: Write general description for this method.
-
#trial_price_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#trial_type ⇒ String
TODO: Write general description for this method.
-
#type ⇒ PricePointType
Price point type.
-
#updated_at ⇒ String
reserved for future use.
-
#use_site_exchange_rate ⇒ TrueClass | FalseClass
Whether or not to use the site’s exchange rate or define your own pricing when your site has multiple currencies defined.
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.
Instance Method Summary collapse
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, 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, trial_type = SKIP, introductory_offer = SKIP, initial_charge_in_cents = SKIP, initial_charge_after_trial = SKIP, expiration_interval = SKIP, expiration_interval_unit = SKIP, product_id = SKIP, archived_at = SKIP, created_at = SKIP, updated_at = SKIP, use_site_exchange_rate = SKIP, type = SKIP, tax_included = SKIP, subscription_id = SKIP) ⇒ ProductPricePoint
Returns a new instance of ProductPricePoint.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 185 def initialize(id = SKIP, 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, trial_type = SKIP, introductory_offer = SKIP, initial_charge_in_cents = SKIP, initial_charge_after_trial = SKIP, expiration_interval = SKIP, expiration_interval_unit = SKIP, product_id = SKIP, archived_at = SKIP, created_at = SKIP, updated_at = SKIP, use_site_exchange_rate = SKIP, type = SKIP, tax_included = SKIP, subscription_id = SKIP) @id = id unless id == 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 @trial_type = trial_type unless trial_type == SKIP @introductory_offer = introductory_offer unless introductory_offer == 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 @product_id = product_id unless product_id == SKIP @archived_at = archived_at unless archived_at == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP @type = type unless type == SKIP @tax_included = tax_included unless tax_included == SKIP @subscription_id = subscription_id unless subscription_id == SKIP end |
Instance Attribute Details
#archived_at ⇒ String
reserved for future use
78 79 80 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 78 def archived_at @archived_at end |
#created_at ⇒ String
reserved for future use
82 83 84 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 82 def created_at @created_at end |
#expiration_interval ⇒ Integer
reserved for future use
66 67 68 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 66 def expiration_interval @expiration_interval end |
#expiration_interval_unit ⇒ String
reserved for future use
70 71 72 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 70 def expiration_interval_unit @expiration_interval_unit end |
#handle ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 22 def handle @handle end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 14 def id @id end |
#initial_charge_after_trial ⇒ TrueClass | FalseClass
reserved for future use
62 63 64 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 62 def initial_charge_after_trial @initial_charge_after_trial end |
#initial_charge_in_cents ⇒ Integer
reserved for future use
58 59 60 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 58 def initial_charge_in_cents @initial_charge_in_cents end |
#interval ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 30 def interval @interval end |
#interval_unit ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 34 def interval_unit @interval_unit end |
#introductory_offer ⇒ TrueClass | FalseClass
reserved for future use
54 55 56 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 54 def introductory_offer @introductory_offer end |
#name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 18 def name @name end |
#price_in_cents ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 26 def price_in_cents @price_in_cents end |
#product_id ⇒ Integer
reserved for future use
74 75 76 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 74 def product_id @product_id end |
#subscription_id ⇒ Integer
Price point type. We expose the following types:
-
default: a price point that is marked as a default price for a
certain product.
-
custom: a custom price point.
-
catalog: a price point that is not marked as a default price
for a certain product and is not a custom one.
118 119 120 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 118 def subscription_id @subscription_id end |
#tax_included ⇒ TrueClass | FalseClass
Price point type. We expose the following types:
-
default: a price point that is marked as a default price for a
certain product.
-
custom: a custom price point.
-
catalog: a price point that is not marked as a default price
for a certain product and is not a custom one.
109 110 111 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 109 def tax_included @tax_included end |
#trial_interval ⇒ Integer
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 42 def trial_interval @trial_interval end |
#trial_interval_unit ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 46 def trial_interval_unit @trial_interval_unit end |
#trial_price_in_cents ⇒ Integer
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 38 def trial_price_in_cents @trial_price_in_cents end |
#trial_type ⇒ String
TODO: Write general description for this method
50 51 52 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 50 def trial_type @trial_type end |
#type ⇒ PricePointType
Price point type. We expose the following types:
-
default: a price point that is marked as a default price for a
certain product.
-
custom: a custom price point.
-
catalog: a price point that is not marked as a default price
for a certain product and is not a custom one.
100 101 102 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 100 def type @type end |
#updated_at ⇒ String
reserved for future use
86 87 88 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 86 def updated_at @updated_at end |
#use_site_exchange_rate ⇒ TrueClass | FalseClass
Whether or not to use the site’s exchange rate or define your own pricing when your site has multiple currencies defined.
91 92 93 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 91 def use_site_exchange_rate @use_site_exchange_rate end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 224 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP handle = hash.key?('handle') ? hash['handle'] : SKIP price_in_cents = hash.key?('price_in_cents') ? hash['price_in_cents'] : SKIP interval = hash.key?('interval') ? hash['interval'] : SKIP interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP trial_price_in_cents = hash.key?('trial_price_in_cents') ? hash['trial_price_in_cents'] : SKIP trial_interval = hash.key?('trial_interval') ? hash['trial_interval'] : SKIP trial_interval_unit = hash.key?('trial_interval_unit') ? hash['trial_interval_unit'] : SKIP trial_type = hash.key?('trial_type') ? hash['trial_type'] : SKIP introductory_offer = hash.key?('introductory_offer') ? hash['introductory_offer'] : SKIP initial_charge_in_cents = hash.key?('initial_charge_in_cents') ? 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') ? hash['expiration_interval'] : SKIP expiration_interval_unit = hash.key?('expiration_interval_unit') ? hash['expiration_interval_unit'] : SKIP product_id = hash.key?('product_id') ? hash['product_id'] : SKIP archived_at = hash.key?('archived_at') ? hash['archived_at'] : SKIP created_at = hash.key?('created_at') ? hash['created_at'] : SKIP updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP use_site_exchange_rate = hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP # Create object from extracted values. ProductPricePoint.new(id, name, handle, price_in_cents, interval, interval_unit, trial_price_in_cents, trial_interval, trial_interval_unit, trial_type, introductory_offer, initial_charge_in_cents, initial_charge_after_trial, expiration_interval, expiration_interval_unit, product_id, archived_at, created_at, updated_at, use_site_exchange_rate, type, tax_included, subscription_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 121 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_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['trial_type'] = 'trial_type' @_hash['introductory_offer'] = 'introductory_offer' @_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['product_id'] = 'product_id' @_hash['archived_at'] = 'archived_at' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' @_hash['type'] = 'type' @_hash['tax_included'] = 'tax_included' @_hash['subscription_id'] = 'subscription_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
179 180 181 182 183 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 179 def self.nullables %w[ subscription_id ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/advanced_billing/models/product_price_point.rb', line 150 def self.optionals %w[ id name handle price_in_cents interval interval_unit trial_price_in_cents trial_interval trial_interval_unit trial_type introductory_offer initial_charge_in_cents initial_charge_after_trial expiration_interval expiration_interval_unit product_id archived_at created_at updated_at use_site_exchange_rate type tax_included subscription_id ] end |