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 credit to be created when upgrading/downgrading.
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, additional_properties: {}) ⇒ UpdateComponent
constructor
A new instance of UpdateComponent.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
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, additional_properties: {}) ⇒ UpdateComponent
Returns a new instance of UpdateComponent.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/advanced_billing/models/update_component.rb', line 96 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, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @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 credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Available values: ‘full`, `prorated`, `none`.
53 54 55 |
# File 'lib/advanced_billing/models/update_component.rb', line 53 def upgrade_charge @upgrade_charge end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
117 118 119 120 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 148 |
# File 'lib/advanced_billing/models/update_component.rb', line 117 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 # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. UpdateComponent.new(handle: handle, name: name, description: description, accounting_code: accounting_code, taxable: taxable, tax_code: tax_code, item_category: item_category, display_on_hosted_page: display_on_hosted_page, upgrade_charge: upgrade_charge, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/advanced_billing/models/update_component.rb', line 56 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
86 87 88 89 90 91 92 93 94 |
# File 'lib/advanced_billing/models/update_component.rb', line 86 def self.nullables %w[ description accounting_code tax_code item_category upgrade_charge ] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/advanced_billing/models/update_component.rb', line 71 def self.optionals %w[ handle name description accounting_code taxable tax_code item_category display_on_hosted_page upgrade_charge ] end |