class Strikeiron::TaxValue

Total sales tax rate based on the dollar amount and category from TaxValueRequest. TaxValueRecord should only be rendered from a SOAP response.

Attributes

Notes

See Strikeiron.tax_categories for information on obtaining category information.

Attributes

amount[RW]
category[RW]
category_id[RW]
jurisdictions[RW]
tax_amount[RW]

Public Class Methods

from_soap(hash = {}) click to toggle source

Convert the SOAP response object to a TaxValueRecord

# File lib/strikeiron2/tax_value.rb, line 35
def self.from_soap(hash = {})
  default_values = {
    :category    => hash['Category'],
    :category_id => hash['CategoryID'],
    :tax_amount  => hash['SalesTaxAmount']
  }

  new(default_values)
end
new(default_values = {}) click to toggle source

Creates a TaxValueRecord with the supplied attributes.

# File lib/strikeiron2/tax_value.rb, line 17
def initialize(default_values = {})
  safe_keys = %w(category category_id amount tax_amount jurisdictions)
  
  default_values.each do |key, value|
    next unless safe_keys.include? key.to_s # Only permit the keys defined in safe_keys
    self.send "#{key}=", value
  end
end

Public Instance Methods

to_soap() click to toggle source

Convert the object to be valid for the SOAP request

# File lib/strikeiron2/tax_value.rb, line 27
def to_soap
  {
    'SalesTaxCategoryOrCategoryID' => category || category_id,
    'Amount'                       => amount
  }
end