Class: AdvancedBilling::Product

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/product.rb

Overview

Product Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id: SKIP, name: SKIP, handle: SKIP, description: SKIP, accounting_code: SKIP, request_credit_card: SKIP, expiration_interval: SKIP, expiration_interval_unit: SKIP, created_at: SKIP, updated_at: SKIP, price_in_cents: SKIP, interval: SKIP, interval_unit: SKIP, initial_charge_in_cents: SKIP, trial_price_in_cents: SKIP, trial_interval: SKIP, trial_interval_unit: SKIP, archived_at: SKIP, require_credit_card: SKIP, return_params: SKIP, taxable: SKIP, update_return_url: SKIP, initial_charge_after_trial: SKIP, version_number: SKIP, update_return_params: SKIP, product_family: SKIP, public_signup_pages: SKIP, product_price_point_name: SKIP, request_billing_address: SKIP, require_billing_address: SKIP, require_shipping_address: SKIP, tax_code: SKIP, default_product_price_point_id: SKIP, use_site_exchange_rate: SKIP, item_category: SKIP, product_price_point_id: SKIP, product_price_point_handle: SKIP, unspsc_code: SKIP, additional_properties: {}) ⇒ Product

Returns a new instance of Product.



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/advanced_billing/models/product.rb', line 323

def initialize(id: SKIP, name: SKIP, handle: SKIP, description: SKIP,
               accounting_code: SKIP, request_credit_card: SKIP,
               expiration_interval: SKIP, expiration_interval_unit: SKIP,
               created_at: SKIP, updated_at: SKIP, price_in_cents: SKIP,
               interval: SKIP, interval_unit: SKIP,
               initial_charge_in_cents: SKIP, trial_price_in_cents: SKIP,
               trial_interval: SKIP, trial_interval_unit: SKIP,
               archived_at: SKIP, require_credit_card: SKIP,
               return_params: SKIP, taxable: SKIP, update_return_url: SKIP,
               initial_charge_after_trial: SKIP, version_number: SKIP,
               update_return_params: SKIP, product_family: SKIP,
               public_signup_pages: SKIP, product_price_point_name: SKIP,
               request_billing_address: SKIP, require_billing_address: SKIP,
               require_shipping_address: SKIP, tax_code: SKIP,
               default_product_price_point_id: SKIP,
               use_site_exchange_rate: SKIP, item_category: SKIP,
               product_price_point_id: SKIP,
               product_price_point_handle: SKIP, unspsc_code: SKIP,
               additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @handle = handle unless handle == SKIP
  @description = description unless description == SKIP
  @accounting_code = accounting_code unless accounting_code == SKIP
  @request_credit_card = request_credit_card unless request_credit_card == SKIP
  @expiration_interval = expiration_interval unless expiration_interval == SKIP
  @expiration_interval_unit = expiration_interval_unit unless expiration_interval_unit == SKIP
  @created_at = created_at unless created_at == SKIP
  @updated_at = updated_at unless updated_at == 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
  @initial_charge_in_cents = initial_charge_in_cents unless initial_charge_in_cents == 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
  @archived_at = archived_at unless archived_at == SKIP
  @require_credit_card = require_credit_card unless require_credit_card == SKIP
  @return_params = return_params unless return_params == SKIP
  @taxable = taxable unless taxable == SKIP
  @update_return_url = update_return_url unless update_return_url == SKIP
  unless initial_charge_after_trial == SKIP
    @initial_charge_after_trial =
      initial_charge_after_trial
  end
  @version_number = version_number unless version_number == SKIP
  @update_return_params = update_return_params unless update_return_params == SKIP
  @product_family = product_family unless product_family == SKIP
  @public_signup_pages =  unless  == SKIP
  @product_price_point_name = product_price_point_name unless product_price_point_name == SKIP
  @request_billing_address = request_billing_address unless request_billing_address == SKIP
  @require_billing_address = require_billing_address unless require_billing_address == SKIP
  @require_shipping_address = require_shipping_address unless require_shipping_address == SKIP
  @tax_code = tax_code unless tax_code == SKIP
  unless default_product_price_point_id == SKIP
    @default_product_price_point_id =
      default_product_price_point_id
  end
  @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP
  @item_category = item_category unless item_category == SKIP
  @product_price_point_id = product_price_point_id unless product_price_point_id == SKIP
  unless product_price_point_handle == SKIP
    @product_price_point_handle =
      product_price_point_handle
  end
  @unspsc_code = unspsc_code unless unspsc_code == SKIP
end

Instance Attribute Details

#accounting_codeString

E.g., Internal ID or SKU Number

Returns:

  • (String)


31
32
33
# File 'lib/advanced_billing/models/product.rb', line 31

def accounting_code
  @accounting_code
end

#archived_atDateTime

Timestamp indicating when this product was archived

Returns:

  • (DateTime)


96
97
98
# File 'lib/advanced_billing/models/product.rb', line 96

def archived_at
  @archived_at
end

#created_atDateTime

Timestamp indicating when this product was created

Returns:

  • (DateTime)


53
54
55
# File 'lib/advanced_billing/models/product.rb', line 53

def created_at
  @created_at
end

#default_product_price_point_idInteger

A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters.

Returns:

  • (Integer)


180
181
182
# File 'lib/advanced_billing/models/product.rb', line 180

def default_product_price_point_id
  @default_product_price_point_id
end

#descriptionString

The product description

Returns:

  • (String)


27
28
29
# File 'lib/advanced_billing/models/product.rb', line 27

def description
  @description
end

#expiration_intervalInteger

A numerical interval for the length a subscription to this product will run before it expires. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval.

Returns:

  • (Integer)


44
45
46
# File 'lib/advanced_billing/models/product.rb', line 44

def expiration_interval
  @expiration_interval
end

#expiration_interval_unitExpirationIntervalUnit

A string representing the expiration interval unit for this product, either month, day or never



49
50
51
# File 'lib/advanced_billing/models/product.rb', line 49

def expiration_interval_unit
  @expiration_interval_unit
end

#handleString

The product API handle

Returns:

  • (String)


23
24
25
# File 'lib/advanced_billing/models/product.rb', line 23

def handle
  @handle
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


15
16
17
# File 'lib/advanced_billing/models/product.rb', line 15

def id
  @id
end

#initial_charge_after_trialTrueClass | FalseClass

The url to which a customer will be returned after a successful account update

Returns:

  • (TrueClass | FalseClass)


121
122
123
# File 'lib/advanced_billing/models/product.rb', line 121

def initial_charge_after_trial
  @initial_charge_after_trial
end

#initial_charge_in_centsInteger

The up front charge you have specified.

Returns:

  • (Integer)


75
76
77
# File 'lib/advanced_billing/models/product.rb', line 75

def initial_charge_in_cents
  @initial_charge_in_cents
end

#intervalInteger

The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days.

Returns:

  • (Integer)


66
67
68
# File 'lib/advanced_billing/models/product.rb', line 66

def interval
  @interval
end

#interval_unitIntervalUnit

A string representing the interval unit for this product, either month or day

Returns:



71
72
73
# File 'lib/advanced_billing/models/product.rb', line 71

def interval_unit
  @interval_unit
end

#item_categoryString

One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other

Returns:

  • (String)


191
192
193
# File 'lib/advanced_billing/models/product.rb', line 191

def item_category
  @item_category
end

#nameString

The product name

Returns:

  • (String)


19
20
21
# File 'lib/advanced_billing/models/product.rb', line 19

def name
  @name
end

#price_in_centsInteger

The product price, in integer cents

Returns:

  • (Integer)


61
62
63
# File 'lib/advanced_billing/models/product.rb', line 61

def price_in_cents
  @price_in_cents
end

#product_familyProductFamily

The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#ret urn-parameters-after-account-update).

Returns:



139
140
141
# File 'lib/advanced_billing/models/product.rb', line 139

def product_family
  @product_family
end

#product_price_point_handleString

One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other

Returns:

  • (String)


201
202
203
# File 'lib/advanced_billing/models/product.rb', line 201

def product_price_point_handle
  @product_price_point_handle
end

#product_price_point_idInteger

One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other

Returns:

  • (Integer)


196
197
198
# File 'lib/advanced_billing/models/product.rb', line 196

def product_price_point_id
  @product_price_point_id
end

#product_price_point_nameString

The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#ret urn-parameters-after-account-update).

Returns:

  • (String)


153
154
155
# File 'lib/advanced_billing/models/product.rb', line 153

def product_price_point_name
  @product_price_point_name
end

#public_signup_pagesArray[PublicSignupPage]

The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#ret urn-parameters-after-account-update).

Returns:



146
147
148
# File 'lib/advanced_billing/models/product.rb', line 146

def 
  @public_signup_pages
end

#request_billing_addressTrueClass | FalseClass

A boolean indicating whether to request a billing address on any Self-Service Pages that are used by subscribers of this product.

Returns:

  • (TrueClass | FalseClass)


158
159
160
# File 'lib/advanced_billing/models/product.rb', line 158

def request_billing_address
  @request_billing_address
end

#request_credit_cardTrueClass | FalseClass

Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page.

Returns:

  • (TrueClass | FalseClass)


37
38
39
# File 'lib/advanced_billing/models/product.rb', line 37

def request_credit_card
  @request_credit_card
end

#require_billing_addressTrueClass | FalseClass

A boolean indicating whether a billing address is required to add a payment profile, especially at signup.

Returns:

  • (TrueClass | FalseClass)


163
164
165
# File 'lib/advanced_billing/models/product.rb', line 163

def require_billing_address
  @require_billing_address
end

#require_credit_cardTrueClass | FalseClass

Boolean that controls whether a payment profile is required to be entered for customers wishing to sign up on this product.

Returns:

  • (TrueClass | FalseClass)


101
102
103
# File 'lib/advanced_billing/models/product.rb', line 101

def require_credit_card
  @require_credit_card
end

#require_shipping_addressTrueClass | FalseClass

A boolean indicating whether a shipping address is required for the customer, especially at signup.

Returns:

  • (TrueClass | FalseClass)


168
169
170
# File 'lib/advanced_billing/models/product.rb', line 168

def require_shipping_address
  @require_shipping_address
end

#return_paramsString

Boolean that controls whether a payment profile is required to be entered for customers wishing to sign up on this product.

Returns:

  • (String)


106
107
108
# File 'lib/advanced_billing/models/product.rb', line 106

def return_params
  @return_params
end

#tax_codeString

A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters.

Returns:

  • (String)


174
175
176
# File 'lib/advanced_billing/models/product.rb', line 174

def tax_code
  @tax_code
end

#taxableTrueClass | FalseClass

Boolean that controls whether a payment profile is required to be entered for customers wishing to sign up on this product.

Returns:

  • (TrueClass | FalseClass)


111
112
113
# File 'lib/advanced_billing/models/product.rb', line 111

def taxable
  @taxable
end

#trial_intervalInteger

A numerical interval for the length of the trial period of a subscription to this product. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval.

Returns:

  • (Integer)


87
88
89
# File 'lib/advanced_billing/models/product.rb', line 87

def trial_interval
  @trial_interval
end

#trial_interval_unitIntervalUnit

A string representing the trial interval unit for this product, either month or day

Returns:



92
93
94
# File 'lib/advanced_billing/models/product.rb', line 92

def trial_interval_unit
  @trial_interval_unit
end

#trial_price_in_centsInteger

The price of the trial period for a subscription to this product, in integer cents.

Returns:

  • (Integer)


80
81
82
# File 'lib/advanced_billing/models/product.rb', line 80

def trial_price_in_cents
  @trial_price_in_cents
end

#unspsc_codeString

(Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this product instead of the default derived from item_category.

Returns:

  • (String)


207
208
209
# File 'lib/advanced_billing/models/product.rb', line 207

def unspsc_code
  @unspsc_code
end

#update_return_paramsString

The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#ret urn-parameters-after-account-update).

Returns:

  • (String)


132
133
134
# File 'lib/advanced_billing/models/product.rb', line 132

def update_return_params
  @update_return_params
end

#update_return_urlString

The url to which a customer will be returned after a successful account update

Returns:

  • (String)


116
117
118
# File 'lib/advanced_billing/models/product.rb', line 116

def update_return_url
  @update_return_url
end

#updated_atDateTime

Timestamp indicating when this product was last updated

Returns:

  • (DateTime)


57
58
59
# File 'lib/advanced_billing/models/product.rb', line 57

def updated_at
  @updated_at
end

#use_site_exchange_rateTrueClass | FalseClass

A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters.

Returns:

  • (TrueClass | FalseClass)


186
187
188
# File 'lib/advanced_billing/models/product.rb', line 186

def use_site_exchange_rate
  @use_site_exchange_rate
end

#version_numberInteger

The version of the product

Returns:

  • (Integer)


125
126
127
# File 'lib/advanced_billing/models/product.rb', line 125

def version_number
  @version_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/advanced_billing/models/product.rb', line 397

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
  description = hash.key?('description') ? hash['description'] : SKIP
  accounting_code =
    hash.key?('accounting_code') ? hash['accounting_code'] : SKIP
  request_credit_card =
    hash.key?('request_credit_card') ? hash['request_credit_card'] : SKIP
  expiration_interval =
    hash.key?('expiration_interval') ? hash['expiration_interval'] : SKIP
  expiration_interval_unit =
    hash.key?('expiration_interval_unit') ? hash['expiration_interval_unit'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               else
                 SKIP
               end
  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
  initial_charge_in_cents =
    hash.key?('initial_charge_in_cents') ? hash['initial_charge_in_cents'] : 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
  archived_at = if hash.key?('archived_at')
                  (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at'])
                else
                  SKIP
                end
  require_credit_card =
    hash.key?('require_credit_card') ? hash['require_credit_card'] : SKIP
  return_params = hash.key?('return_params') ? hash['return_params'] : SKIP
  taxable = hash.key?('taxable') ? hash['taxable'] : SKIP
  update_return_url =
    hash.key?('update_return_url') ? hash['update_return_url'] : SKIP
  initial_charge_after_trial =
    hash.key?('initial_charge_after_trial') ? hash['initial_charge_after_trial'] : SKIP
  version_number =
    hash.key?('version_number') ? hash['version_number'] : SKIP
  update_return_params =
    hash.key?('update_return_params') ? hash['update_return_params'] : SKIP
  product_family = ProductFamily.from_hash(hash['product_family']) if hash['product_family']
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['public_signup_pages'].nil?
     = []
    hash['public_signup_pages'].each do |structure|
       << (PublicSignupPage.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('public_signup_pages')
  product_price_point_name =
    hash.key?('product_price_point_name') ? hash['product_price_point_name'] : SKIP
  request_billing_address =
    hash.key?('request_billing_address') ? hash['request_billing_address'] : SKIP
  require_billing_address =
    hash.key?('require_billing_address') ? hash['require_billing_address'] : SKIP
  require_shipping_address =
    hash.key?('require_shipping_address') ? hash['require_shipping_address'] : SKIP
  tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP
  default_product_price_point_id =
    hash.key?('default_product_price_point_id') ? hash['default_product_price_point_id'] : SKIP
  use_site_exchange_rate =
    hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP
  item_category = hash.key?('item_category') ? hash['item_category'] : SKIP
  product_price_point_id =
    hash.key?('product_price_point_id') ? hash['product_price_point_id'] : SKIP
  product_price_point_handle =
    hash.key?('product_price_point_handle') ? hash['product_price_point_handle'] : SKIP
  unspsc_code = hash.key?('unspsc_code') ? hash['unspsc_code'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  Product.new(id: id,
              name: name,
              handle: handle,
              description: description,
              accounting_code: accounting_code,
              request_credit_card: request_credit_card,
              expiration_interval: expiration_interval,
              expiration_interval_unit: expiration_interval_unit,
              created_at: created_at,
              updated_at: updated_at,
              price_in_cents: price_in_cents,
              interval: interval,
              interval_unit: interval_unit,
              initial_charge_in_cents: initial_charge_in_cents,
              trial_price_in_cents: trial_price_in_cents,
              trial_interval: trial_interval,
              trial_interval_unit: trial_interval_unit,
              archived_at: archived_at,
              require_credit_card: require_credit_card,
              return_params: return_params,
              taxable: taxable,
              update_return_url: update_return_url,
              initial_charge_after_trial: initial_charge_after_trial,
              version_number: version_number,
              update_return_params: update_return_params,
              product_family: product_family,
              public_signup_pages: ,
              product_price_point_name: product_price_point_name,
              request_billing_address: request_billing_address,
              require_billing_address: require_billing_address,
              require_shipping_address: require_shipping_address,
              tax_code: tax_code,
              default_product_price_point_id: default_product_price_point_id,
              use_site_exchange_rate: use_site_exchange_rate,
              item_category: item_category,
              product_price_point_id: product_price_point_id,
              product_price_point_handle: product_price_point_handle,
              unspsc_code: unspsc_code,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
# File 'lib/advanced_billing/models/product.rb', line 210

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['handle'] = 'handle'
  @_hash['description'] = 'description'
  @_hash['accounting_code'] = 'accounting_code'
  @_hash['request_credit_card'] = 'request_credit_card'
  @_hash['expiration_interval'] = 'expiration_interval'
  @_hash['expiration_interval_unit'] = 'expiration_interval_unit'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['price_in_cents'] = 'price_in_cents'
  @_hash['interval'] = 'interval'
  @_hash['interval_unit'] = 'interval_unit'
  @_hash['initial_charge_in_cents'] = 'initial_charge_in_cents'
  @_hash['trial_price_in_cents'] = 'trial_price_in_cents'
  @_hash['trial_interval'] = 'trial_interval'
  @_hash['trial_interval_unit'] = 'trial_interval_unit'
  @_hash['archived_at'] = 'archived_at'
  @_hash['require_credit_card'] = 'require_credit_card'
  @_hash['return_params'] = 'return_params'
  @_hash['taxable'] = 'taxable'
  @_hash['update_return_url'] = 'update_return_url'
  @_hash['initial_charge_after_trial'] = 'initial_charge_after_trial'
  @_hash['version_number'] = 'version_number'
  @_hash['update_return_params'] = 'update_return_params'
  @_hash['product_family'] = 'product_family'
  @_hash['public_signup_pages'] = 'public_signup_pages'
  @_hash['product_price_point_name'] = 'product_price_point_name'
  @_hash['request_billing_address'] = 'request_billing_address'
  @_hash['require_billing_address'] = 'require_billing_address'
  @_hash['require_shipping_address'] = 'require_shipping_address'
  @_hash['tax_code'] = 'tax_code'
  @_hash['default_product_price_point_id'] =
    'default_product_price_point_id'
  @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate'
  @_hash['item_category'] = 'item_category'
  @_hash['product_price_point_id'] = 'product_price_point_id'
  @_hash['product_price_point_handle'] = 'product_price_point_handle'
  @_hash['unspsc_code'] = 'unspsc_code'
  @_hash
end

.nullablesObject

An array for nullable fields



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/advanced_billing/models/product.rb', line 299

def self.nullables
  %w[
    handle
    description
    accounting_code
    expiration_interval
    expiration_interval_unit
    initial_charge_in_cents
    trial_price_in_cents
    trial_interval
    trial_interval_unit
    archived_at
    return_params
    update_return_url
    initial_charge_after_trial
    update_return_params
    tax_code
    use_site_exchange_rate
    item_category
    product_price_point_handle
    unspsc_code
  ]
end

.optionalsObject

An array for optional fields



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
288
289
290
291
292
293
294
295
296
# File 'lib/advanced_billing/models/product.rb', line 255

def self.optionals
  %w[
    id
    name
    handle
    description
    accounting_code
    request_credit_card
    expiration_interval
    expiration_interval_unit
    created_at
    updated_at
    price_in_cents
    interval
    interval_unit
    initial_charge_in_cents
    trial_price_in_cents
    trial_interval
    trial_interval_unit
    archived_at
    require_credit_card
    return_params
    taxable
    update_return_url
    initial_charge_after_trial
    version_number
    update_return_params
    product_family
    public_signup_pages
    product_price_point_name
    request_billing_address
    require_billing_address
    require_shipping_address
    tax_code
    default_product_price_point_id
    use_site_exchange_rate
    item_category
    product_price_point_id
    product_price_point_handle
    unspsc_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/advanced_billing/models/product.rb', line 566

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, handle: #{@handle.inspect},"\
  " description: #{@description.inspect}, accounting_code: #{@accounting_code.inspect},"\
  " request_credit_card: #{@request_credit_card.inspect}, expiration_interval:"\
  " #{@expiration_interval.inspect}, expiration_interval_unit:"\
  " #{@expiration_interval_unit.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, price_in_cents: #{@price_in_cents.inspect}, interval:"\
  " #{@interval.inspect}, interval_unit: #{@interval_unit.inspect}, initial_charge_in_cents:"\
  " #{@initial_charge_in_cents.inspect}, trial_price_in_cents:"\
  " #{@trial_price_in_cents.inspect}, trial_interval: #{@trial_interval.inspect},"\
  " trial_interval_unit: #{@trial_interval_unit.inspect}, archived_at:"\
  " #{@archived_at.inspect}, require_credit_card: #{@require_credit_card.inspect},"\
  " return_params: #{@return_params.inspect}, taxable: #{@taxable.inspect}, update_return_url:"\
  " #{@update_return_url.inspect}, initial_charge_after_trial:"\
  " #{@initial_charge_after_trial.inspect}, version_number: #{@version_number.inspect},"\
  " update_return_params: #{@update_return_params.inspect}, product_family:"\
  " #{@product_family.inspect}, public_signup_pages: #{@public_signup_pages.inspect},"\
  " product_price_point_name: #{@product_price_point_name.inspect}, request_billing_address:"\
  " #{@request_billing_address.inspect}, require_billing_address:"\
  " #{@require_billing_address.inspect}, require_shipping_address:"\
  " #{@require_shipping_address.inspect}, tax_code: #{@tax_code.inspect},"\
  " default_product_price_point_id: #{@default_product_price_point_id.inspect},"\
  " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, item_category:"\
  " #{@item_category.inspect}, product_price_point_id: #{@product_price_point_id.inspect},"\
  " product_price_point_handle: #{@product_price_point_handle.inspect}, unspsc_code:"\
  " #{@unspsc_code.inspect}, additional_properties: #{get_additional_properties}>"
end

#to_custom_archived_atObject



536
537
538
# File 'lib/advanced_billing/models/product.rb', line 536

def to_custom_archived_at
  DateTimeHelper.to_rfc3339(archived_at)
end

#to_custom_created_atObject



528
529
530
# File 'lib/advanced_billing/models/product.rb', line 528

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



532
533
534
# File 'lib/advanced_billing/models/product.rb', line 532

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/advanced_billing/models/product.rb', line 541

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, handle: #{@handle}, description:"\
  " #{@description}, accounting_code: #{@accounting_code}, request_credit_card:"\
  " #{@request_credit_card}, expiration_interval: #{@expiration_interval},"\
  " expiration_interval_unit: #{@expiration_interval_unit}, created_at: #{@created_at},"\
  " updated_at: #{@updated_at}, price_in_cents: #{@price_in_cents}, interval: #{@interval},"\
  " interval_unit: #{@interval_unit}, initial_charge_in_cents: #{@initial_charge_in_cents},"\
  " trial_price_in_cents: #{@trial_price_in_cents}, trial_interval: #{@trial_interval},"\
  " trial_interval_unit: #{@trial_interval_unit}, archived_at: #{@archived_at},"\
  " require_credit_card: #{@require_credit_card}, return_params: #{@return_params}, taxable:"\
  " #{@taxable}, update_return_url: #{@update_return_url}, initial_charge_after_trial:"\
  " #{@initial_charge_after_trial}, version_number: #{@version_number}, update_return_params:"\
  " #{@update_return_params}, product_family: #{@product_family}, public_signup_pages:"\
  " #{@public_signup_pages}, product_price_point_name: #{@product_price_point_name},"\
  " request_billing_address: #{@request_billing_address}, require_billing_address:"\
  " #{@require_billing_address}, require_shipping_address: #{@require_shipping_address},"\
  " tax_code: #{@tax_code}, default_product_price_point_id:"\
  " #{@default_product_price_point_id}, use_site_exchange_rate: #{@use_site_exchange_rate},"\
  " item_category: #{@item_category}, product_price_point_id: #{@product_price_point_id},"\
  " product_price_point_handle: #{@product_price_point_handle}, unspsc_code: #{@unspsc_code},"\
  " additional_properties: #{get_additional_properties}>"
end