Class: AdvancedBilling::InvoiceTaxComponentBreakout

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

Overview

InvoiceTaxComponentBreakout Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

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

Constructor Details

#initialize(tax_rule_id: SKIP, percentage: SKIP, country_code: SKIP, subdivision_code: SKIP, tax_amount: SKIP, taxable_amount: SKIP, tax_exempt_amount: SKIP, non_taxable_amount: SKIP, tax_name: SKIP, tax_type: SKIP, rate_type: SKIP, tax_authority_type: SKIP, state_assigned_no: SKIP, tax_sub_type: SKIP, additional_properties: {}) ⇒ InvoiceTaxComponentBreakout

Returns a new instance of InvoiceTaxComponentBreakout.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 113

def initialize(tax_rule_id: SKIP, percentage: SKIP, country_code: SKIP,
               subdivision_code: SKIP, tax_amount: SKIP,
               taxable_amount: SKIP, tax_exempt_amount: SKIP,
               non_taxable_amount: SKIP, tax_name: SKIP, tax_type: SKIP,
               rate_type: SKIP, tax_authority_type: SKIP,
               state_assigned_no: SKIP, tax_sub_type: SKIP,
               additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @tax_rule_id = tax_rule_id unless tax_rule_id == SKIP
  @percentage = percentage unless percentage == SKIP
  @country_code = country_code unless country_code == SKIP
  @subdivision_code = subdivision_code unless subdivision_code == SKIP
  @tax_amount = tax_amount unless tax_amount == SKIP
  @taxable_amount = taxable_amount unless taxable_amount == SKIP
  @tax_exempt_amount = tax_exempt_amount unless tax_exempt_amount == SKIP
  @non_taxable_amount = non_taxable_amount unless non_taxable_amount == SKIP
  @tax_name = tax_name unless tax_name == SKIP
  @tax_type = tax_type unless tax_type == SKIP
  @rate_type = rate_type unless rate_type == SKIP
  @tax_authority_type = tax_authority_type unless tax_authority_type == SKIP
  @state_assigned_no = state_assigned_no unless state_assigned_no == SKIP
  @tax_sub_type = tax_sub_type unless tax_sub_type == SKIP
end

Instance Attribute Details

#country_codeString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 22

def country_code
  @country_code
end

#non_taxable_amountString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 42

def non_taxable_amount
  @non_taxable_amount
end

#percentageString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 18

def percentage
  @percentage
end

#rate_typeString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 54

def rate_type
  @rate_type
end

#state_assigned_noString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 62

def state_assigned_no
  @state_assigned_no
end

#subdivision_codeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 26

def subdivision_code
  @subdivision_code
end

#tax_amountString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 30

def tax_amount
  @tax_amount
end

#tax_authority_typeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


58
59
60
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 58

def tax_authority_type
  @tax_authority_type
end

#tax_exempt_amountString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 38

def tax_exempt_amount
  @tax_exempt_amount
end

#tax_nameString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 46

def tax_name
  @tax_name
end

#tax_rule_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 14

def tax_rule_id
  @tax_rule_id
end

#tax_sub_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def tax_sub_type
  @tax_sub_type
end

#tax_typeString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 50

def tax_type
  @tax_type
end

#taxable_amountString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 34

def taxable_amount
  @taxable_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 142

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tax_rule_id = hash.key?('tax_rule_id') ? hash['tax_rule_id'] : SKIP
  percentage = hash.key?('percentage') ? hash['percentage'] : SKIP
  country_code = hash.key?('country_code') ? hash['country_code'] : SKIP
  subdivision_code =
    hash.key?('subdivision_code') ? hash['subdivision_code'] : SKIP
  tax_amount = hash.key?('tax_amount') ? hash['tax_amount'] : SKIP
  taxable_amount =
    hash.key?('taxable_amount') ? hash['taxable_amount'] : SKIP
  tax_exempt_amount =
    hash.key?('tax_exempt_amount') ? hash['tax_exempt_amount'] : SKIP
  non_taxable_amount =
    hash.key?('non_taxable_amount') ? hash['non_taxable_amount'] : SKIP
  tax_name = hash.key?('tax_name') ? hash['tax_name'] : SKIP
  tax_type = hash.key?('tax_type') ? hash['tax_type'] : SKIP
  rate_type = hash.key?('rate_type') ? hash['rate_type'] : SKIP
  tax_authority_type =
    hash.key?('tax_authority_type') ? hash['tax_authority_type'] : SKIP
  state_assigned_no =
    hash.key?('state_assigned_no') ? hash['state_assigned_no'] : SKIP
  tax_sub_type = hash.key?('tax_sub_type') ? hash['tax_sub_type'] : SKIP

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

  # Create object from extracted values.
  InvoiceTaxComponentBreakout.new(tax_rule_id: tax_rule_id,
                                  percentage: percentage,
                                  country_code: country_code,
                                  subdivision_code: subdivision_code,
                                  tax_amount: tax_amount,
                                  taxable_amount: taxable_amount,
                                  tax_exempt_amount: tax_exempt_amount,
                                  non_taxable_amount: non_taxable_amount,
                                  tax_name: tax_name,
                                  tax_type: tax_type,
                                  rate_type: rate_type,
                                  tax_authority_type: tax_authority_type,
                                  state_assigned_no: state_assigned_no,
                                  tax_sub_type: tax_sub_type,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 69

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tax_rule_id'] = 'tax_rule_id'
  @_hash['percentage'] = 'percentage'
  @_hash['country_code'] = 'country_code'
  @_hash['subdivision_code'] = 'subdivision_code'
  @_hash['tax_amount'] = 'tax_amount'
  @_hash['taxable_amount'] = 'taxable_amount'
  @_hash['tax_exempt_amount'] = 'tax_exempt_amount'
  @_hash['non_taxable_amount'] = 'non_taxable_amount'
  @_hash['tax_name'] = 'tax_name'
  @_hash['tax_type'] = 'tax_type'
  @_hash['rate_type'] = 'rate_type'
  @_hash['tax_authority_type'] = 'tax_authority_type'
  @_hash['state_assigned_no'] = 'state_assigned_no'
  @_hash['tax_sub_type'] = 'tax_sub_type'
  @_hash
end

.nullablesObject

An array for nullable fields



109
110
111
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 109

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 89

def self.optionals
  %w[
    tax_rule_id
    percentage
    country_code
    subdivision_code
    tax_amount
    taxable_amount
    tax_exempt_amount
    non_taxable_amount
    tax_name
    tax_type
    rate_type
    tax_authority_type
    state_assigned_no
    tax_sub_type
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



190
191
192
193
194
195
196
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 190

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end