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

#to_hash, #to_json

Constructor Details

#initialize(tax_rule_id = SKIP, percentage = SKIP, country_code = SKIP, subdivision_code = SKIP) ⇒ InvoiceTaxComponentBreakout

Returns a new instance of InvoiceTaxComponentBreakout.



53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 53

def initialize(tax_rule_id = SKIP, percentage = SKIP, country_code = SKIP,
               subdivision_code = SKIP)
  @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
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

#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

#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_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

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 62

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

  # Create object from extracted values.

  InvoiceTaxComponentBreakout.new(tax_rule_id,
                                  percentage,
                                  country_code,
                                  subdivision_code)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 29

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
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 39

def self.optionals
  %w[
    tax_rule_id
    percentage
    country_code
    subdivision_code
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



81
82
83
84
85
86
87
# File 'lib/advanced_billing/models/invoice_tax_component_breakout.rb', line 81

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

  return false unless value.instance_of? Hash

  true
end