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.
-
#unspsc_code ⇒ String
(Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data.
-
#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, unspsc_code: SKIP, additional_properties: {}) ⇒ UpdateComponent
constructor
A new instance of UpdateComponent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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(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, unspsc_code: SKIP, additional_properties: {}) ⇒ UpdateComponent
Returns a new instance of UpdateComponent.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/advanced_billing/models/update_component.rb', line 104 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, unspsc_code: 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 @unspsc_code = unspsc_code unless unspsc_code == 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. e.g., 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 AvaTax to tax based on locale. This attribute has a max length of 25 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 |
#unspsc_code ⇒ String
(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 component instead of the default derived from item_category.
58 59 60 |
# File 'lib/advanced_billing/models/update_component.rb', line 58 def unspsc_code @unspsc_code 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.
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.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/advanced_billing/models/update_component.rb', line 127 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 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. 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, unspsc_code: unspsc_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/update_component.rb', line 61 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['unspsc_code'] = 'unspsc_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/advanced_billing/models/update_component.rb', line 93 def self.nullables %w[ description accounting_code tax_code item_category upgrade_charge unspsc_code ] end |
.optionals ⇒ Object
An array for optional fields
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/update_component.rb', line 77 def self.optionals %w[ handle name description accounting_code taxable tax_code item_category display_on_hosted_page upgrade_charge unspsc_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
173 174 175 176 177 178 179 180 181 |
# File 'lib/advanced_billing/models/update_component.rb', line 173 def inspect class_name = self.class.name.split('::').last "<#{class_name} handle: #{@handle.inspect}, name: #{@name.inspect}, description:"\ " #{@description.inspect}, accounting_code: #{@accounting_code.inspect}, taxable:"\ " #{@taxable.inspect}, tax_code: #{@tax_code.inspect}, item_category:"\ " #{@item_category.inspect}, display_on_hosted_page: #{@display_on_hosted_page.inspect},"\ " upgrade_charge: #{@upgrade_charge.inspect}, unspsc_code: #{@unspsc_code.inspect},"\ " additional_properties: #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
163 164 165 166 167 168 169 170 |
# File 'lib/advanced_billing/models/update_component.rb', line 163 def to_s class_name = self.class.name.split('::').last "<#{class_name} 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}, unspsc_code: #{@unspsc_code}, additional_properties:"\ " #{get_additional_properties}>" end |