Class: TaxCloud::Address
- Inherits:
-
Object
- Object
- TaxCloud::Address
- Defined in:
- lib/tax_cloud/address.rb
Overview
An address
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#address2 ⇒ Object
Returns the value of attribute address2.
-
#city ⇒ Object
Returns the value of attribute city.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip4 ⇒ Object
Returns the value of attribute zip4.
-
#zip5 ⇒ Object
Returns the value of attribute zip5.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Address
constructor
Initialize the object with the given variables.
-
#to_hash ⇒ Object
Convert the object to a usable hash for SOAP requests.
-
#verify ⇒ Object
Verify the address via TaxCloud.
Constructor Details
#initialize(attrs = {}) ⇒ Address
Initialize the object with the given variables
7 8 9 10 11 12 |
# File 'lib/tax_cloud/address.rb', line 7 def initialize(attrs = {}) attrs.each do |sym, val| self.send "#{sym}=", val end super end |
Instance Attribute Details
#address1 ⇒ Object
Returns the value of attribute address1.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def address1 @address1 end |
#address2 ⇒ Object
Returns the value of attribute address2.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def address2 @address2 end |
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def city @city end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def state @state end |
#zip4 ⇒ Object
Returns the value of attribute zip4.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def zip4 @zip4 end |
#zip5 ⇒ Object
Returns the value of attribute zip5.
4 5 6 |
# File 'lib/tax_cloud/address.rb', line 4 def zip5 @zip5 end |
Instance Method Details
#to_hash ⇒ Object
Convert the object to a usable hash for SOAP requests
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tax_cloud/address.rb', line 25 def to_hash { 'Address1' => address1, 'Address2' => address2, 'City' => city, 'State' => state, 'Zip5' => zip5, 'Zip4' => zip4 } end |
#verify ⇒ Object
Verify the address via TaxCloud
15 16 17 18 19 20 21 22 |
# File 'lib/tax_cloud/address.rb', line 15 def verify request_params = { 'apiLoginId' => TaxCloud.configuration.api_login_id, 'apiKey' => TaxCloud.configuration.api_key, 'uspsUserID' => TaxCloud.configuration.usps_username }.merge(to_hash.downcase_keys!) response = TaxCloud.client.request :verify_address, :body => request_params end |