Class: Strikeiron::Jurisdiction
- Inherits:
-
Object
- Object
- Strikeiron::Jurisdiction
- Defined in:
- lib/strikeiron/jurisdiction.rb
Overview
Jurisdiction represents a breakdown of the tax calculations for the taxable region(s).
Attributes
-
fips
- The code assigned by the Federal Government or state agencies to uniquely identify a location. -
name
- Name associated to the corresponding FIPS code. -
tax_amount
- Sales tax rate for the corresponding FIPS code.
Instance Attribute Summary collapse
-
#fips ⇒ Object
Returns the value of attribute fips.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
Class Method Summary collapse
-
.from_soap(hash = {}) ⇒ Object
Convert the SOAP response object to a Jurisdiction.
Instance Method Summary collapse
-
#initialize(default_values = {}) ⇒ Jurisdiction
constructor
Creates a Jurisdiction with the supplied attributes.
Constructor Details
#initialize(default_values = {}) ⇒ Jurisdiction
Creates a Jurisdiction with the supplied attributes.
12 13 14 15 16 17 18 |
# File 'lib/strikeiron/jurisdiction.rb', line 12 def initialize(default_values = {}) safe_keys = %w(fips name tax_amount) # Only permit the keys defined in safe_keys default_values.reject! { |key, value| !safe_keys.include?(key.to_s) } default_values.each { |key, value| self.send "#{key}=", value } end |
Instance Attribute Details
#fips ⇒ Object
Returns the value of attribute fips.
9 10 11 |
# File 'lib/strikeiron/jurisdiction.rb', line 9 def fips @fips end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/strikeiron/jurisdiction.rb', line 9 def name @name end |
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
9 10 11 |
# File 'lib/strikeiron/jurisdiction.rb', line 9 def tax_amount @tax_amount end |
Class Method Details
.from_soap(hash = {}) ⇒ Object
Convert the SOAP response object to a Jurisdiction
22 23 24 25 26 27 28 29 30 |
# File 'lib/strikeiron/jurisdiction.rb', line 22 def from_soap(hash = {}) default_values = { :fips => hash['FIPS'], :name => hash['Name'], :tax_amount => hash['SalesTaxAmount'] } new(default_values) end |