Class: AdvancedBilling::TaxConfiguration

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

Overview

TaxConfiguration Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(kind = TaxConfigurationKind::CUSTOM, destination_address = SKIP, fully_configured = false) ⇒ TaxConfiguration

Returns a new instance of TaxConfiguration.



50
51
52
53
54
55
# File 'lib/advanced_billing/models/tax_configuration.rb', line 50

def initialize(kind = TaxConfigurationKind::CUSTOM,
               destination_address = SKIP, fully_configured = false)
  @kind = kind unless kind == SKIP
  @destination_address = destination_address unless destination_address == SKIP
  @fully_configured = fully_configured unless fully_configured == SKIP
end

Instance Attribute Details

#destination_addressTaxDestinationAddress

TODO: Write general description for this method



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

def destination_address
  @destination_address
end

#fully_configuredTrueClass | FalseClass

Returns ‘true` when Chargify has been properly configured to charge tax using the specified tax system. More details about taxes: maxio-chargify.zendesk.com/hc/en-us/articles/5405488905869-Taxes-I ntroduction

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/advanced_billing/models/tax_configuration.rb', line 25

def fully_configured
  @fully_configured
end

#kindTaxConfigurationKind

TODO: Write general description for this method



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

def kind
  @kind
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/advanced_billing/models/tax_configuration.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  kind = hash['kind'] ||= TaxConfigurationKind::CUSTOM
  destination_address =
    hash.key?('destination_address') ? hash['destination_address'] : SKIP
  fully_configured = hash['fully_configured'] ||= false

  # Create object from extracted values.

  TaxConfiguration.new(kind,
                       destination_address,
                       fully_configured)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/advanced_billing/models/tax_configuration.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['kind'] = 'kind'
  @_hash['destination_address'] = 'destination_address'
  @_hash['fully_configured'] = 'fully_configured'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/advanced_billing/models/tax_configuration.rb', line 37

def self.optionals
  %w[
    kind
    destination_address
    fully_configured
  ]
end