Avatax_AddressService 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Avatax_AddressService.gemspec +2 -2
- data/samples/PingTest.rb +26 -0
- data/samples/ValidateAddressTest.rb +51 -0
- metadata +3 -4
- data/samples/Ping.rb +0 -23
- data/samples/Validate.rb +0 -37
- data/samples/credentials.yml +0 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                ODEwZjdhNmI1MDc2YWQxMzRkNTNjMThkOTRmYzcwNTY5MzM1NmE5NA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                NWM3NmUzNWRhNmVlMGMyZGI5ZjExOTYzMDYzNmU0MGQ1YTZlYjIwMA==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NTg1ZjFkZGI5NjVlZDAwM2EzMTRjMThjZGQ1YWEyMjNhOWNkYTJhMjE2NGM0
         | 
| 10 | 
            +
                OTViYzNmZWRlMTE0YjhlNjAyZGU0MDU2NTQxYWZiYjU5Nzg4YTA1MmYxZTE0
         | 
| 11 | 
            +
                ZjdjNTJhZjBjNjcxMTNlYmJkYWQ0ZWQ4Y2JiMDg4NDhmMzRmMzA=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                YTkwYTNlNTFmZmNkZTM3MDZiYzE0OWQ5MWQ5MDBhMzJmOWIwMDI3NWEwMjFl
         | 
| 14 | 
            +
                MGY4M2ZiMjAxYmM4NWMzMDlmZWYxODIyZTc1YWEwYWVmZjJjOTcwYzJiNjlm
         | 
| 15 | 
            +
                MTQ0NjAyMjliNTYwYzU1NTZkOTA5YjhjZWUwNThlN2RhODQxNWE=
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Gem::Specification.new do |s|
         | 
| 2 2 | 
             
              s.name = "Avatax_AddressService"
         | 
| 3 | 
            -
              s.version = "1.0. | 
| 3 | 
            +
              s.version = "1.0.12"
         | 
| 4 4 | 
             
              s.date = "2012-12-16"
         | 
| 5 5 | 
             
              s.author = "Graham S Wilson"
         | 
| 6 6 | 
             
              s.email = "support@Avalara.com"
         | 
| @@ -10,7 +10,7 @@ Gem::Specification.new do |s| | |
| 10 10 | 
             
              s.description = "Ruby SDK provides means of communication with Avatax Web Services."
         | 
| 11 11 | 
             
              s.files = ["lib/address_log.txt", "lib/addressservice_dev.wsdl", "lib/addressservice_prd.wsdl", "lib/avatax_addressservice.rb",
         | 
| 12 12 | 
             
                         "lib/template_validate.erb","lib/template_ping.erb","lib/template_isauthorized.erb",
         | 
| 13 | 
            -
                         "samples/ | 
| 13 | 
            +
                         "samples/PingTest.rb","samples/ValidateAddressTest.rb",
         | 
| 14 14 | 
             
                         "spec/addressservice_spec.rb","spec/isauthorized_spec.rb","spec/ping_spec.rb","spec/spec_helper.rb","spec/validate_spec.rb",
         | 
| 15 15 | 
             
                         "Avatax_AddressService.gemspec","Avatax Ruby SDK Guide.docx","LICENSE.txt"]
         | 
| 16 16 | 
             
              # s.add_dependency "nokogiri", ">= 1.4.0", "< 1.6"
         | 
    
        data/samples/PingTest.rb
    ADDED
    
    | @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            require_relative '../Avatax_AddressService/lib/avatax_addressservice.rb'
         | 
| 2 | 
            +
            #require 'Avatax_AddressService'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            accountNumber = "1234567890"
         | 
| 5 | 
            +
            licenseKey = "A1B2C3D4E5F6G7H8"
         | 
| 6 | 
            +
            useProductionURL = false
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            # Header Level Parameters
         | 
| 9 | 
            +
            adrSvc = AvaTax::AddressService.new(
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            # Required Header Parameters
         | 
| 12 | 
            +
              :username => accountNumber, 
         | 
| 13 | 
            +
              :password => licenseKey,  
         | 
| 14 | 
            +
              :use_production_url => useProductionURL,
         | 
| 15 | 
            +
              :clientname => "AvaTaxSample",
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            # Optional Header Parameters  
         | 
| 18 | 
            +
              :name => "Development") 
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            pingResult = adrSvc.ping
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            #Display the result
         | 
| 23 | 
            +
            puts "PingTest ResultCode: " + pingResult[:result_code]
         | 
| 24 | 
            +
            if pingResult[:result_code] != "Success"
         | 
| 25 | 
            +
              pingResult[:messages].each { |message| puts message[:details] }
         | 
| 26 | 
            +
            end
         | 
| @@ -0,0 +1,51 @@ | |
| 1 | 
            +
            require_relative '../Avatax_AddressService/lib/avatax_addressservice.rb'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            #require 'Avatax_AddressService'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            accountNumber = "wilsongs"
         | 
| 6 | 
            +
            licenseKey = "Gsw98110"
         | 
| 7 | 
            +
            useProductionURL = false
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # Header Level Parameters
         | 
| 10 | 
            +
            addressSvc = AvaTax::AddressService.new(
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            # Required Header Parameters
         | 
| 13 | 
            +
              :username => accountNumber, 
         | 
| 14 | 
            +
              :password => licenseKey,  
         | 
| 15 | 
            +
              :use_production_url => useProductionURL,
         | 
| 16 | 
            +
              :clientname => "AvaTaxSample",
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            # Optional Header Parameters  
         | 
| 19 | 
            +
              :name => "Development") 
         | 
| 20 | 
            +
              
         | 
| 21 | 
            +
            validateRequest = {
         | 
| 22 | 
            +
              # Required Request Parameters
         | 
| 23 | 
            +
               :line1 => "118 N Clark St",
         | 
| 24 | 
            +
               :city => "Chicago",
         | 
| 25 | 
            +
               :region => "IL",
         | 
| 26 | 
            +
              # Optional Request Parameters
         | 
| 27 | 
            +
               :line2 => "Suite 100",
         | 
| 28 | 
            +
               :line3 => "ATTN Accounts Payable",
         | 
| 29 | 
            +
               :country => "US",
         | 
| 30 | 
            +
               :postalcode => "60602",
         | 
| 31 | 
            +
               :coordinates => true,
         | 
| 32 | 
            +
               :taxability => true,
         | 
| 33 | 
            +
               :textcase => "Upper"
         | 
| 34 | 
            +
            }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            # Call the service
         | 
| 37 | 
            +
            validateResult = addressSvc.validate(validateRequest)
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            # Print Results
         | 
| 40 | 
            +
            puts "ValidateAddressTest Result: "+validateResult[:result_code]
         | 
| 41 | 
            +
            if validateResult[:result_code] != "Success"
         | 
| 42 | 
            +
              validateResult[:messages].each { |message| puts message[:details] }
         | 
| 43 | 
            +
            else
         | 
| 44 | 
            +
              puts validateResult[:valid_addresses][:valid_address][:line1] + 
         | 
| 45 | 
            +
              " " + 
         | 
| 46 | 
            +
              validateResult[:valid_addresses][:valid_address][:city] + 
         | 
| 47 | 
            +
              ", " + 
         | 
| 48 | 
            +
              validateResult[:valid_addresses][:valid_address][:region] + 
         | 
| 49 | 
            +
              " " + 
         | 
| 50 | 
            +
              validateResult[:valid_addresses][:valid_address][:postal_code]
         | 
| 51 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: Avatax_AddressService
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.12
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Graham S Wilson
         | 
| @@ -37,9 +37,8 @@ files: | |
| 37 37 | 
             
            - lib/template_validate.erb
         | 
| 38 38 | 
             
            - lib/template_ping.erb
         | 
| 39 39 | 
             
            - lib/template_isauthorized.erb
         | 
| 40 | 
            -
            - samples/ | 
| 41 | 
            -
            - samples/ | 
| 42 | 
            -
            - samples/Validate.rb
         | 
| 40 | 
            +
            - samples/PingTest.rb
         | 
| 41 | 
            +
            - samples/ValidateAddressTest.rb
         | 
| 43 42 | 
             
            - spec/addressservice_spec.rb
         | 
| 44 43 | 
             
            - spec/isauthorized_spec.rb
         | 
| 45 44 | 
             
            - spec/ping_spec.rb
         | 
    
        data/samples/Ping.rb
    DELETED
    
    | @@ -1,23 +0,0 @@ | |
| 1 | 
            -
            require 'Avatax_AddressService'
         | 
| 2 | 
            -
            require 'yaml'
         | 
| 3 | 
            -
            #Note that the ping function exists in both the AddressSvc and TaxSvc classes - it works the same way in both.
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            #Create an instance of the service class
         | 
| 6 | 
            -
            credentials = YAML::load(File.open('credentials.yml'))
         | 
| 7 | 
            -
            svc = AvaTax::AddressService.new(:username => credentials['username'], 
         | 
| 8 | 
            -
                  :password => credentials['password'],  
         | 
| 9 | 
            -
                  :clientname => credentials['clientname'],
         | 
| 10 | 
            -
                  :use_production_url => credentials['production']) 
         | 
| 11 | 
            -
             | 
| 12 | 
            -
              #Call the service
         | 
| 13 | 
            -
            result = svc.ping
         | 
| 14 | 
            -
            #print result
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            #Display the result
         | 
| 17 | 
            -
            puts "Ping ResultCode: "+result[:result_code]
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            #If we encountered an error
         | 
| 20 | 
            -
            if result[:result_code] != "Success"
         | 
| 21 | 
            -
              #Print the first error message returned
         | 
| 22 | 
            -
              puts result[:details]
         | 
| 23 | 
            -
            end
         | 
    
        data/samples/Validate.rb
    DELETED
    
    | @@ -1,37 +0,0 @@ | |
| 1 | 
            -
            require 'Avatax_AddressService'
         | 
| 2 | 
            -
            require 'yaml'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            #Create an instance of the service class
         | 
| 5 | 
            -
            credentials = YAML::load(File.open('credentials.yml'))
         | 
| 6 | 
            -
            svc = AvaTax::AddressService.new(:username => credentials['username'], 
         | 
| 7 | 
            -
                  :password => credentials['password'],  
         | 
| 8 | 
            -
                  :clientname => credentials['clientname'],
         | 
| 9 | 
            -
                  :use_production_url => credentials['production']) 
         | 
| 10 | 
            -
              
         | 
| 11 | 
            -
              # Create the request
         | 
| 12 | 
            -
            input = {
         | 
| 13 | 
            -
              :line1 => "General Delivery", #Required
         | 
| 14 | 
            -
              :line2 => "Suite 100",        #Optional
         | 
| 15 | 
            -
              :line3 => "Attn: Accounts Payable", #Optional
         | 
| 16 | 
            -
              :city =>"Seattle",            #Required, if PostalCode is not specified
         | 
| 17 | 
            -
              :region=>"WA",                #Required, if PostalCode is not specified
         | 
| 18 | 
            -
              :postalcode =>"98101",        #Required, if City and Region are not specified
         | 
| 19 | 
            -
              :country => "US"              #Optional
         | 
| 20 | 
            -
            }
         | 
| 21 | 
            -
            #Call the service
         | 
| 22 | 
            -
            result = svc.validate(input)
         | 
| 23 | 
            -
            #Display the result
         | 
| 24 | 
            -
            #print result
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            #If we encountered an error
         | 
| 27 | 
            -
            if result[:result_code] != "Success"
         | 
| 28 | 
            -
              #puts the first error message returned
         | 
| 29 | 
            -
              puts "Address Validation ResultCode: "+result[:result_code]
         | 
| 30 | 
            -
              puts result[:details]
         | 
| 31 | 
            -
            else
         | 
| 32 | 
            -
              puts "Validated Address: "
         | 
| 33 | 
            -
              result[:valid_addresses][:valid_address].each do |key, value|
         | 
| 34 | 
            -
                puts key.to_s + ": " + value.to_s if not value.nil?
         | 
| 35 | 
            -
              end
         | 
| 36 | 
            -
              
         | 
| 37 | 
            -
            end
         |