Class: AdvancedBilling::CreateOrUpdateProduct
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateOrUpdateProduct
- Defined in:
- lib/advanced_billing/models/create_or_update_product.rb
Overview
CreateOrUpdateProduct Model.
Instance Attribute Summary collapse
-
#accounting_code ⇒ String
TODO: Write general description for this method.
-
#auto_create_signup_page ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#description ⇒ String
TODO: Write general description for this method.
-
#handle ⇒ String
TODO: Write general description for this method.
-
#interval ⇒ Integer
TODO: Write general description for this method.
-
#interval_unit ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#price_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#require_credit_card ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#tax_code ⇒ String
TODO: Write general description for this method.
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
-
#initialize(name = nil, description = nil, price_in_cents = nil, interval = nil, interval_unit = nil, handle = SKIP, accounting_code = SKIP, require_credit_card = SKIP, auto_create_signup_page = SKIP, tax_code = SKIP) ⇒ CreateOrUpdateProduct
constructor
A new instance of CreateOrUpdateProduct.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, description = nil, price_in_cents = nil, interval = nil, interval_unit = nil, handle = SKIP, accounting_code = SKIP, require_credit_card = SKIP, auto_create_signup_page = SKIP, tax_code = SKIP) ⇒ CreateOrUpdateProduct
Returns a new instance of CreateOrUpdateProduct.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 84 def initialize(name = nil, description = nil, price_in_cents = nil, interval = nil, interval_unit = nil, handle = SKIP, accounting_code = SKIP, require_credit_card = SKIP, auto_create_signup_page = SKIP, tax_code = SKIP) @name = name @handle = handle unless handle == SKIP @description = description @accounting_code = accounting_code unless accounting_code == SKIP @require_credit_card = require_credit_card unless require_credit_card == SKIP @price_in_cents = price_in_cents @interval = interval @interval_unit = interval_unit @auto_create_signup_page = auto_create_signup_page unless auto_create_signup_page == SKIP @tax_code = tax_code unless tax_code == SKIP end |
Instance Attribute Details
#accounting_code ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 26 def accounting_code @accounting_code end |
#auto_create_signup_page ⇒ TrueClass | FalseClass
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 46 def auto_create_signup_page @auto_create_signup_page end |
#description ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 22 def description @description end |
#handle ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 18 def handle @handle end |
#interval ⇒ Integer
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 38 def interval @interval end |
#interval_unit ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 42 def interval_unit @interval_unit end |
#name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 14 def name @name end |
#price_in_cents ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 34 def price_in_cents @price_in_cents end |
#require_credit_card ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 30 def require_credit_card @require_credit_card end |
#tax_code ⇒ String
TODO: Write general description for this method
50 51 52 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 50 def tax_code @tax_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 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/create_or_update_product.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil description = hash.key?('description') ? hash['description'] : nil price_in_cents = hash.key?('price_in_cents') ? hash['price_in_cents'] : nil interval = hash.key?('interval') ? hash['interval'] : nil interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : nil handle = hash.key?('handle') ? hash['handle'] : SKIP accounting_code = hash.key?('accounting_code') ? hash['accounting_code'] : SKIP require_credit_card = hash.key?('require_credit_card') ? hash['require_credit_card'] : SKIP auto_create_signup_page = hash.key?('auto_create_signup_page') ? hash['auto_create_signup_page'] : SKIP tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP # Create object from extracted values. CreateOrUpdateProduct.new(name, description, price_in_cents, interval, interval_unit, handle, accounting_code, require_credit_card, auto_create_signup_page, tax_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['handle'] = 'handle' @_hash['description'] = 'description' @_hash['accounting_code'] = 'accounting_code' @_hash['require_credit_card'] = 'require_credit_card' @_hash['price_in_cents'] = 'price_in_cents' @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' @_hash['auto_create_signup_page'] = 'auto_create_signup_page' @_hash['tax_code'] = 'tax_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
80 81 82 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 80 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 77 |
# File 'lib/advanced_billing/models/create_or_update_product.rb', line 69 def self.optionals %w[ handle accounting_code require_credit_card auto_create_signup_page tax_code ] end |