Class: AdvancedBilling::UpdateComponent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::UpdateComponent
- Defined in:
- lib/advanced_billing/models/update_component.rb
Overview
UpdateComponent Model.
Instance Attribute Summary collapse
-
#accounting_code ⇒ String
The description of the component.
-
#description ⇒ String
The description of the component.
-
#display_on_hosted_page ⇒ TrueClass | FalseClass
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other.
-
#handle ⇒ String
TODO: Write general description for this method.
-
#item_category ⇒ ItemCategory
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other.
-
#name ⇒ String
The name of the Component, suitable for display on statements.
-
#tax_code ⇒ String
A string representing the tax code related to the component type.
-
#taxable ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is taxable or not.
-
#upgrade_charge ⇒ CreditType
The type of charge to be applied when a component is upgraded.
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(handle = SKIP, name = SKIP, description = SKIP, accounting_code = SKIP, taxable = SKIP, tax_code = SKIP, item_category = SKIP, display_on_hosted_page = SKIP, upgrade_charge = SKIP) ⇒ UpdateComponent
constructor
A new instance of UpdateComponent.
Methods inherited from BaseModel
Constructor Details
#initialize(handle = SKIP, name = SKIP, description = SKIP, accounting_code = SKIP, taxable = SKIP, tax_code = SKIP, item_category = SKIP, display_on_hosted_page = SKIP, upgrade_charge = SKIP) ⇒ UpdateComponent
Returns a new instance of UpdateComponent.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/advanced_billing/models/update_component.rb', line 92 def initialize(handle = SKIP, name = SKIP, description = SKIP, accounting_code = SKIP, taxable = SKIP, tax_code = SKIP, item_category = SKIP, display_on_hosted_page = SKIP, upgrade_charge = SKIP) @handle = handle unless handle == SKIP @name = name unless name == SKIP @description = description unless description == SKIP @accounting_code = accounting_code unless accounting_code == SKIP @taxable = taxable unless taxable == SKIP @tax_code = tax_code unless tax_code == SKIP @item_category = item_category unless item_category == SKIP @display_on_hosted_page = display_on_hosted_page unless display_on_hosted_page == SKIP @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP end |
Instance Attribute Details
#accounting_code ⇒ String
The description of the component.
27 28 29 |
# File 'lib/advanced_billing/models/update_component.rb', line 27 def accounting_code @accounting_code end |
#description ⇒ String
The description of the component.
23 24 25 |
# File 'lib/advanced_billing/models/update_component.rb', line 23 def description @description end |
#display_on_hosted_page ⇒ TrueClass | FalseClass
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other
47 48 49 |
# File 'lib/advanced_billing/models/update_component.rb', line 47 def display_on_hosted_page @display_on_hosted_page end |
#handle ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/update_component.rb', line 14 def handle @handle end |
#item_category ⇒ ItemCategory
One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other
42 43 44 |
# File 'lib/advanced_billing/models/update_component.rb', line 42 def item_category @item_category end |
#name ⇒ String
The name of the Component, suitable for display on statements. i.e. Text Messages.
19 20 21 |
# File 'lib/advanced_billing/models/update_component.rb', line 19 def name @name end |
#tax_code ⇒ String
A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
37 38 39 |
# File 'lib/advanced_billing/models/update_component.rb', line 37 def tax_code @tax_code end |
#taxable ⇒ TrueClass | FalseClass
Boolean flag describing whether a component is taxable or not.
31 32 33 |
# File 'lib/advanced_billing/models/update_component.rb', line 31 def taxable @taxable end |
#upgrade_charge ⇒ CreditType
The type of charge to be applied when a component is upgraded. Valid values are: ‘prorated`, `full`, `none`.
52 53 54 |
# File 'lib/advanced_billing/models/update_component.rb', line 52 def upgrade_charge @upgrade_charge end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/advanced_billing/models/update_component.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. handle = hash.key?('handle') ? hash['handle'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP accounting_code = hash.key?('accounting_code') ? hash['accounting_code'] : SKIP taxable = hash.key?('taxable') ? hash['taxable'] : SKIP tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP item_category = hash.key?('item_category') ? hash['item_category'] : SKIP display_on_hosted_page = hash.key?('display_on_hosted_page') ? hash['display_on_hosted_page'] : SKIP upgrade_charge = hash.key?('upgrade_charge') ? hash['upgrade_charge'] : SKIP # Create object from extracted values. UpdateComponent.new(handle, name, description, accounting_code, taxable, tax_code, item_category, display_on_hosted_page, upgrade_charge) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/update_component.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['handle'] = 'handle' @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['accounting_code'] = 'accounting_code' @_hash['taxable'] = 'taxable' @_hash['tax_code'] = 'tax_code' @_hash['item_category'] = 'item_category' @_hash['display_on_hosted_page'] = 'display_on_hosted_page' @_hash['upgrade_charge'] = 'upgrade_charge' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/update_component.rb', line 85 def self.nullables %w[ description tax_code ] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/update_component.rb', line 70 def self.optionals %w[ handle name description accounting_code taxable tax_code item_category display_on_hosted_page upgrade_charge ] end |