smarty_streets 0.0.2 → 0.0.4
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 +4 -4
- data/README.md +3 -3
- data/lib/smarty_streets.rb +1 -1
- data/lib/smarty_streets/configuration.rb +2 -2
- data/lib/smarty_streets/location.rb +10 -3
- data/lib/smarty_streets/request.rb +19 -19
- data/lib/smarty_streets/version.rb +1 -1
- data/spec/configuration_spec.rb +3 -3
- data/spec/smarty_streets_spec.rb +36 -111
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bed58a4493bc3453d5068e5d6583b7bb62fe5c56
         | 
| 4 | 
            +
              data.tar.gz: ef2a974bd5cf84dbb63cdf7fa6f126d4d97d2a9a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8af3ba8d72a9b5ef60ec6b591d45eab28b79e53fc1f01044a9d47b4af2691d1ca79d8e1ce67c72cb8125f229025aff87a09bf0fe27833504c616365e6e8ca2c2
         | 
| 7 | 
            +
              data.tar.gz: 1bd2ea27c0a246d3c322ee53ecdbb0d9b7986c502c849476ee59c8de3357c6a322ba11d5c26f7915631dc741403e4eb707f827f16a1075b22c20c19e93d052c2
         | 
    
        data/README.md
    CHANGED
    
    | @@ -24,17 +24,17 @@ You must have valid tokens from http://www.smartystreets.com | |
| 24 24 | 
             
            SmartyStreets.configure do |c|
         | 
| 25 25 | 
             
              c.auth_id = 'MY-AUTH-ID'
         | 
| 26 26 | 
             
              c.auth_token = 'MY-AUTH-TOKEN'
         | 
| 27 | 
            -
              c. | 
| 27 | 
            +
              c.candidates = 5
         | 
| 28 28 | 
             
            end
         | 
| 29 29 |  | 
| 30 30 | 
             
            locations = SmartyStreets.standardize do |location|
         | 
| 31 31 | 
             
              location.street = '1 infinite loop'
         | 
| 32 32 | 
             
              location.city = 'cupertino'
         | 
| 33 33 | 
             
              location.state = 'california'
         | 
| 34 | 
            -
              location. | 
| 34 | 
            +
              location.zipcode = '95014'
         | 
| 35 35 | 
             
            end
         | 
| 36 36 |  | 
| 37 | 
            -
            # #<SmartyStreets::Location:0x007fb4bbb507d0 @street="1 Infinite Loop", @city="Cupertino", @state="CA", @ | 
| 37 | 
            +
            # #<SmartyStreets::Location:0x007fb4bbb507d0 @street="1 Infinite Loop", @city="Cupertino", @state="CA", @zipcode="95014-2083", @delivery_point_barcode="950142083017", @components={"primary_number"=>"1", "street_name"=>"Infinite", "street_suffix"=>"Loop", "city_name"=>"Cupertino", "state_abbreviation"=>"CA", "zipcode"=>"95014", "plus4_code"=>"2083", "delivery_point"=>"01", "delivery_point_check_digit"=>"7"}, @metadata={"record_type"=>"S", "county_fips"=>"06085", "county_name"=>"Santa Clara", "carrier_route"=>"C067", "congressional_district"=>"18", "rdi"=>"Commercial", "elot_sequence"=>"0031", "elot_sort"=>"A", "latitude"=>37.33118, "longitude"=>-122.03062, "precision"=>"Zip9"}>
         | 
| 38 38 | 
             
            ```
         | 
| 39 39 |  | 
| 40 40 | 
             
            ## Contributing
         | 
    
        data/lib/smarty_streets.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ module SmartyStreets | |
| 15 15 | 
             
                #   SmartyStreets.configure do |config|
         | 
| 16 16 | 
             
                #     config.auth_id = 'AUTHID'
         | 
| 17 17 | 
             
                #     config.auth_token = 'AUTHTOKEN'
         | 
| 18 | 
            -
                #     config. | 
| 18 | 
            +
                #     config.candidates = 1
         | 
| 19 19 | 
             
                #   end
         | 
| 20 20 | 
             
                def configure
         | 
| 21 21 | 
             
                  self.configuration = Configuration.new
         | 
| @@ -10,11 +10,11 @@ module SmartyStreets | |
| 10 10 | 
             
                attr_accessor :auth_token
         | 
| 11 11 |  | 
| 12 12 | 
             
                # Number of candidates to provide when making a request.
         | 
| 13 | 
            -
                attr_accessor : | 
| 13 | 
            +
                attr_accessor :candidates
         | 
| 14 14 |  | 
| 15 15 | 
             
                def initialize
         | 
| 16 16 | 
             
                  @api_url = 'api.smartystreets.com'
         | 
| 17 | 
            -
                  @ | 
| 17 | 
            +
                  @candidates = 1
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                # Returns a hash of all configurable options
         | 
| @@ -1,8 +1,15 @@ | |
| 1 1 | 
             
            module SmartyStreets
         | 
| 2 2 | 
             
              class Location
         | 
| 3 | 
            +
                # Request & Response fields
         | 
| 4 | 
            +
                attr_accessor :input_id
         | 
| 3 5 | 
             
                attr_accessor :street, :street2, :secondary
         | 
| 4 | 
            -
                attr_accessor :city, :state, : | 
| 5 | 
            -
                attr_accessor : | 
| 6 | 
            -
                attr_accessor : | 
| 6 | 
            +
                attr_accessor :city, :state, :zipcode
         | 
| 7 | 
            +
                attr_accessor :lastline, :addressee, :urbanization
         | 
| 8 | 
            +
                attr_accessor :candidates
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                # Response only fields
         | 
| 11 | 
            +
                attr_accessor :input_index, :candidate_index
         | 
| 12 | 
            +
                attr_accessor :delivery_line_1, :delivery_line_2, :delivery_point_barcode
         | 
| 13 | 
            +
                attr_accessor :components, :metadata, :analysis
         | 
| 7 14 | 
             
              end
         | 
| 8 15 | 
             
            end
         | 
| @@ -21,21 +21,21 @@ module SmartyStreets | |
| 21 21 |  | 
| 22 22 | 
             
                def handle_response(response)
         | 
| 23 23 | 
             
                  raise InvalidCredentials if response.code == 401
         | 
| 24 | 
            -
                  raise MalformedData | 
| 25 | 
            -
                  raise PaymentRequired | 
| 26 | 
            -
                  raise RemoteServerError | 
| 27 | 
            -
                  raise NoValidCandidates | 
| 24 | 
            +
                  raise MalformedData      if response.code == 400
         | 
| 25 | 
            +
                  raise PaymentRequired    if response.code == 402
         | 
| 26 | 
            +
                  raise RemoteServerError  if response.code == 500
         | 
| 27 | 
            +
                  raise NoValidCandidates  if response.body.nil?
         | 
| 28 28 |  | 
| 29 29 | 
             
                  JSON.parse(response.body).collect do |l|
         | 
| 30 30 | 
             
                    location = Location.new
         | 
| 31 | 
            -
                    location.street | 
| 32 | 
            -
                    location.city | 
| 33 | 
            -
                    location.state | 
| 34 | 
            -
                    location. | 
| 31 | 
            +
                    location.street                 = l['delivery_line_1']
         | 
| 32 | 
            +
                    location.city                   = l['components']['city_name']
         | 
| 33 | 
            +
                    location.state                  = l['components']['state_abbreviation']
         | 
| 34 | 
            +
                    location.zipcode                = l['components']['zipcode'] + '-' + l['components']['plus4_code']
         | 
| 35 35 | 
             
                    location.delivery_point_barcode = l['delivery_point_barcode']
         | 
| 36 | 
            -
                    location.components | 
| 37 | 
            -
                    location. | 
| 38 | 
            -
                    location.analysis | 
| 36 | 
            +
                    location.components             = l['components']
         | 
| 37 | 
            +
                    location.metadata               = l['metadata']
         | 
| 38 | 
            +
                    location.analysis               = l['analysis']
         | 
| 39 39 | 
             
                    location
         | 
| 40 40 | 
             
                  end
         | 
| 41 41 | 
             
                end
         | 
| @@ -46,26 +46,26 @@ module SmartyStreets | |
| 46 46 |  | 
| 47 47 | 
             
                def build_request_url(location)
         | 
| 48 48 | 
             
                  parameters = {
         | 
| 49 | 
            +
                    input_id: location.input_id,
         | 
| 49 50 | 
             
                    street: location.street,
         | 
| 50 51 | 
             
                    street2: location.street2,
         | 
| 51 52 | 
             
                    secondary: location.secondary,
         | 
| 52 53 | 
             
                    city: location.city,
         | 
| 53 54 | 
             
                    state: location.state,
         | 
| 54 | 
            -
                     | 
| 55 | 
            -
                     | 
| 55 | 
            +
                    zipcode: location.zipcode,
         | 
| 56 | 
            +
                    lastline: location.lastline,
         | 
| 56 57 | 
             
                    addressee: location.addressee,
         | 
| 57 58 | 
             
                    urbanization: location.urbanization,
         | 
| 58 | 
            -
                    candidates: SmartyStreets.configuration. | 
| 59 | 
            -
                     | 
| 60 | 
            -
                     | 
| 59 | 
            +
                    candidates: location.candidates || SmartyStreets.configuration.candidates,
         | 
| 60 | 
            +
                    "auth-id" => SmartyStreets.configuration.auth_id,
         | 
| 61 | 
            +
                    "auth-token" => SmartyStreets.configuration.auth_token
         | 
| 61 62 | 
             
                  }
         | 
| 62 63 |  | 
| 63 64 | 
             
                  parameter_string = parameters.collect { |k,v|
         | 
| 64 | 
            -
                    "#{k.to_s | 
| 65 | 
            +
                    "#{k.to_s}=#{CGI.escape(v.to_s)}"
         | 
| 65 66 | 
             
                  }.join('&')
         | 
| 66 67 |  | 
| 67 | 
            -
                  ' | 
| 68 | 
            -
                  '/street-address/?' + parameter_string
         | 
| 68 | 
            +
                  'https://' + SmartyStreets.configuration.api_url + '/street-address/?' + parameter_string
         | 
| 69 69 | 
             
                end
         | 
| 70 70 | 
             
              end
         | 
| 71 71 | 
             
            end
         | 
    
        data/spec/configuration_spec.rb
    CHANGED
    
    | @@ -6,7 +6,7 @@ describe SmartyStreets::Configuration do | |
| 6 6 | 
             
                  c.api_url = 'apiurl'
         | 
| 7 7 | 
             
                  c.auth_id = 'MYAUTHID'
         | 
| 8 8 | 
             
                  c.auth_token = 'MYAUTHTOKEN'
         | 
| 9 | 
            -
                  c. | 
| 9 | 
            +
                  c.candidates = 1
         | 
| 10 10 | 
             
                end
         | 
| 11 11 | 
             
              end
         | 
| 12 12 |  | 
| @@ -22,7 +22,7 @@ describe SmartyStreets::Configuration do | |
| 22 22 | 
             
                expect(SmartyStreets.configuration.auth_token).to eq 'MYAUTHTOKEN'
         | 
| 23 23 | 
             
              end
         | 
| 24 24 |  | 
| 25 | 
            -
              it 'sets the  | 
| 26 | 
            -
                expect(SmartyStreets.configuration. | 
| 25 | 
            +
              it 'sets the candidates' do
         | 
| 26 | 
            +
                expect(SmartyStreets.configuration.candidates).to eq 1
         | 
| 27 27 | 
             
              end
         | 
| 28 28 | 
             
            end
         | 
    
        data/spec/smarty_streets_spec.rb
    CHANGED
    
    | @@ -1,171 +1,96 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe SmartyStreets do
         | 
| 4 | 
            +
              let(:auth_id) { 'MYAUTHID' }
         | 
| 5 | 
            +
              let(:auth_token) { 'MYAUTHTOKEN' }
         | 
| 6 | 
            +
              let(:candidates) { 1 }
         | 
| 7 | 
            +
              let(:response) { double(:response, code: response_code, body: response_body) }
         | 
| 8 | 
            +
              let(:response_code) { }
         | 
| 9 | 
            +
              let(:response_body) { }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 4 12 | 
             
              before do
         | 
| 13 | 
            +
                SmartyStreets.configure do |c|
         | 
| 14 | 
            +
                  c.auth_id    = auth_id
         | 
| 15 | 
            +
                  c.auth_token = auth_token
         | 
| 16 | 
            +
                  c.candidates = candidates
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                allow(HTTParty).to receive(:get).and_return(response)
         | 
| 5 20 | 
             
              end
         | 
| 6 21 |  | 
| 7 22 | 
             
              context SmartyStreets::Request do
         | 
| 8 23 | 
             
                context 'unauthorized request' do
         | 
| 9 | 
            -
                  let(: | 
| 10 | 
            -
                    double(:response, code: 401)
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  before do
         | 
| 14 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 15 | 
            -
                      c.auth_id = 'ERROR'
         | 
| 16 | 
            -
                      c.auth_token = 'ERROR'
         | 
| 17 | 
            -
                    end
         | 
| 18 | 
            -
                    HTTParty.stub(:get).and_return(unauthorized_request)
         | 
| 19 | 
            -
                  end
         | 
| 24 | 
            +
                  let(:response_code) { 401 }
         | 
| 20 25 |  | 
| 21 26 | 
             
                  specify 'raises an InvalidCredentials error' do
         | 
| 22 27 | 
             
                    expect {
         | 
| 23 | 
            -
                      locations = SmartyStreets.standardize  | 
| 24 | 
            -
                        location.street = '1 infinite loop'
         | 
| 25 | 
            -
                        location.city = 'cupertino'
         | 
| 26 | 
            -
                        location.state = 'california'
         | 
| 27 | 
            -
                        location.zip_code = '95014'
         | 
| 28 | 
            -
                      end
         | 
| 28 | 
            +
                      locations = SmartyStreets.standardize {}
         | 
| 29 29 | 
             
                    }.to raise_error SmartyStreets::Request::InvalidCredentials
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 | 
             
                end
         | 
| 32 32 |  | 
| 33 33 | 
             
                context 'malformed data' do
         | 
| 34 | 
            -
                  let(: | 
| 35 | 
            -
                    double(:response, code: 400)
         | 
| 36 | 
            -
                  end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                  before do
         | 
| 39 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 40 | 
            -
                      c.auth_id = 'ERROR'
         | 
| 41 | 
            -
                      c.auth_token = 'ERROR'
         | 
| 42 | 
            -
                    end
         | 
| 43 | 
            -
                    HTTParty.stub(:get).and_return(malformed_data_request)
         | 
| 44 | 
            -
                  end
         | 
| 34 | 
            +
                  let(:response_code) { 400 }
         | 
| 45 35 |  | 
| 46 36 | 
             
                  specify 'raises an InvalidCredentials error' do
         | 
| 47 37 | 
             
                    expect {
         | 
| 48 | 
            -
                       | 
| 49 | 
            -
                        location.street = '1 infinite loop'
         | 
| 50 | 
            -
                        location.city = 'cupertino'
         | 
| 51 | 
            -
                        location.state = 'california'
         | 
| 52 | 
            -
                        location.zip_code = '95014'
         | 
| 53 | 
            -
                      end
         | 
| 38 | 
            +
                      SmartyStreets.standardize {}
         | 
| 54 39 | 
             
                    }.to raise_error SmartyStreets::Request::MalformedData
         | 
| 55 40 | 
             
                  end
         | 
| 56 41 | 
             
                end
         | 
| 57 42 |  | 
| 58 43 | 
             
                context 'payment required' do
         | 
| 59 | 
            -
                  let(: | 
| 60 | 
            -
                    double(:response, code: 402)
         | 
| 61 | 
            -
                  end
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                  before do
         | 
| 64 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 65 | 
            -
                      c.auth_id = 'ERROR'
         | 
| 66 | 
            -
                      c.auth_token = 'ERROR'
         | 
| 67 | 
            -
                    end
         | 
| 68 | 
            -
                    HTTParty.stub(:get).and_return(payment_required_request)
         | 
| 69 | 
            -
                  end
         | 
| 44 | 
            +
                  let(:response_code) { 402 }
         | 
| 70 45 |  | 
| 71 46 | 
             
                  specify 'raises an InvalidCredentials error' do
         | 
| 72 47 | 
             
                    expect {
         | 
| 73 | 
            -
                       | 
| 74 | 
            -
                        location.street = '1 infinite loop'
         | 
| 75 | 
            -
                        location.city = 'cupertino'
         | 
| 76 | 
            -
                        location.state = 'california'
         | 
| 77 | 
            -
                        location.zip_code = '95014'
         | 
| 78 | 
            -
                      end
         | 
| 48 | 
            +
                      SmartyStreets.standardize {}
         | 
| 79 49 | 
             
                    }.to raise_error SmartyStreets::Request::PaymentRequired
         | 
| 80 50 | 
             
                  end
         | 
| 81 51 | 
             
                end
         | 
| 82 52 |  | 
| 83 53 | 
             
                context 'remote server error' do
         | 
| 84 | 
            -
                  let(: | 
| 85 | 
            -
                    double(:response, code: 500)
         | 
| 86 | 
            -
                  end
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                  before do
         | 
| 89 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 90 | 
            -
                      c.auth_id = 'ERROR'
         | 
| 91 | 
            -
                      c.auth_token = 'ERROR'
         | 
| 92 | 
            -
                    end
         | 
| 93 | 
            -
                    HTTParty.stub(:get).and_return(remote_server_error_request)
         | 
| 94 | 
            -
                  end
         | 
| 54 | 
            +
                  let(:response_code) { 500 }
         | 
| 95 55 |  | 
| 96 56 | 
             
                  specify 'raises an InvalidCredentials error' do
         | 
| 97 57 | 
             
                    expect {
         | 
| 98 | 
            -
                       | 
| 99 | 
            -
                        location.street = '1 infinite loop'
         | 
| 100 | 
            -
                        location.city = 'cupertino'
         | 
| 101 | 
            -
                        location.state = 'california'
         | 
| 102 | 
            -
                        location.zip_code = '95014'
         | 
| 103 | 
            -
                      end
         | 
| 58 | 
            +
                      SmartyStreets.standardize {}
         | 
| 104 59 | 
             
                    }.to raise_error SmartyStreets::Request::RemoteServerError
         | 
| 105 60 | 
             
                  end
         | 
| 106 61 | 
             
                end
         | 
| 107 62 |  | 
| 108 63 | 
             
                context 'successful request' do
         | 
| 109 | 
            -
                  let(: | 
| 110 | 
            -
             | 
| 111 | 
            -
                   | 
| 112 | 
            -
             | 
| 113 | 
            -
                  before do
         | 
| 114 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 115 | 
            -
                      c.auth_id = 'MYAUTHID'
         | 
| 116 | 
            -
                      c.auth_token = 'MYAUTHTOKEN'
         | 
| 117 | 
            -
                      c.number_of_candidates = 5
         | 
| 118 | 
            -
                    end
         | 
| 119 | 
            -
                    HTTParty.stub(:get).and_return(successful_response)
         | 
| 120 | 
            -
                  end
         | 
| 64 | 
            +
                  let(:response_code) { 200 }
         | 
| 65 | 
            +
                  let(:response_body) { successful_response_data }
         | 
| 66 | 
            +
                  let(:candidates) { 5 }
         | 
| 67 | 
            +
                  let(:successful_response_data) { '[{"input_index":0,"candidate_index":0,"delivery_line_1":"1 Infinite Loop","lastline":"Cupertino CA 95014-2083","delivery_point_barcode":"950142083017","components":{"primary_number":"1","street_name":"Infinite","street_suffix":"Loop","city_name":"Cupertino","state_abbreviation":"CA","zipcode":"95014","plus4_code":"2083","delivery_point":"01","delivery_point_check_digit":"7"},"metadata":{"record_type":"S","county_fips":"06085","county_name":"Santa Clara","carrier_route":"C067","congressional_district":"18","rdi":"Commercial","elot_sequence":"0031","elot_sort":"A","latitude":37.33118,"longitude":-122.03062,"precision":"Zip9"},"analysis":{"dpv_match_code":"Y","dpv_footnotes":"AABB","dpv_cmra":"N","dpv_vacant":"N","active":"Y"}},{"input_index":0,"candidate_index":1,"addressee":"Apple Computer","delivery_line_1":"1 Infinite Loop","lastline":"Cupertino CA 95014-2084","delivery_point_barcode":"950142084016","components":{"primary_number":"1","street_name":"Infinite","street_suffix":"Loop","city_name":"Cupertino","state_abbreviation":"CA","zipcode":"95014","plus4_code":"2084","delivery_point":"01","delivery_point_check_digit":"6"},"metadata":{"record_type":"F","county_fips":"06085","county_name":"Santa Clara","carrier_route":"C067","congressional_district":"18","rdi":"Commercial","elot_sequence":"0032","elot_sort":"A","latitude":37.33118,"longitude":-122.03062,"precision":"Zip9"},"analysis":{"dpv_match_code":"Y","dpv_footnotes":"AABB","dpv_cmra":"N","dpv_vacant":"N","active":"Y"}}]' }
         | 
| 121 68 |  | 
| 122 69 | 
             
                  specify 'makes a request for a standardized address' do
         | 
| 123 70 | 
             
                    locations = SmartyStreets.standardize do |location|
         | 
| 124 71 | 
             
                      location.street = '1 infinite loop'
         | 
| 125 72 | 
             
                      location.city = 'cupertino'
         | 
| 126 73 | 
             
                      location.state = 'calforna'
         | 
| 127 | 
            -
                      location. | 
| 74 | 
            +
                      location.zipcode = '95014'
         | 
| 128 75 | 
             
                    end
         | 
| 129 76 |  | 
| 130 | 
            -
                    expect(locations.first.street).to | 
| 131 | 
            -
                    expect(locations.first.city).to | 
| 132 | 
            -
                    expect(locations.first.state).to | 
| 133 | 
            -
                    expect(locations.first. | 
| 77 | 
            +
                    expect(locations.first.street).to  eq '1 Infinite Loop'
         | 
| 78 | 
            +
                    expect(locations.first.city).to    eq 'Cupertino'
         | 
| 79 | 
            +
                    expect(locations.first.state).to   eq 'CA'
         | 
| 80 | 
            +
                    expect(locations.first.zipcode).to eq '95014-2083'
         | 
| 134 81 | 
             
                  end
         | 
| 135 82 | 
             
                end
         | 
| 136 83 |  | 
| 137 84 | 
             
                context 'address with no candidates' do
         | 
| 138 | 
            -
                  let(: | 
| 139 | 
            -
             | 
| 140 | 
            -
                  end
         | 
| 141 | 
            -
             | 
| 142 | 
            -
                  before do
         | 
| 143 | 
            -
                    SmartyStreets.configure do |c|
         | 
| 144 | 
            -
                      c.auth_id = 'MYAUTHID'
         | 
| 145 | 
            -
                      c.auth_token = 'MYAUTHTOKEN'
         | 
| 146 | 
            -
                      c.number_of_candidates = 5
         | 
| 147 | 
            -
                    end
         | 
| 148 | 
            -
                    HTTParty.stub(:get).and_return(unsuccessful_response)
         | 
| 149 | 
            -
                  end
         | 
| 85 | 
            +
                  let(:response_code) { 200 }
         | 
| 86 | 
            +
                  let(:candidates) { 5 }
         | 
| 150 87 |  | 
| 151 88 | 
             
                  specify 'makes a request for a standardized address' do
         | 
| 152 89 | 
             
                    expect {
         | 
| 153 | 
            -
                      locations = SmartyStreets.standardize  | 
| 154 | 
            -
                        location.street = '1234 Unicorn Lane'
         | 
| 155 | 
            -
                        location.city = 'earth'
         | 
| 156 | 
            -
                        location.state = 'galaxy'
         | 
| 157 | 
            -
                        location.zip_code = '1234923'
         | 
| 158 | 
            -
                      end
         | 
| 90 | 
            +
                      locations = SmartyStreets.standardize {}
         | 
| 159 91 | 
             
                    }.to raise_error SmartyStreets::Request::NoValidCandidates
         | 
| 160 92 | 
             
                  end
         | 
| 161 93 | 
             
                end
         | 
| 162 94 | 
             
              end
         | 
| 163 95 |  | 
| 164 | 
            -
             | 
| 165 | 
            -
                '[{"input_index":0,"candidate_index":0,"delivery_line_1":"1 Infinite Loop","last_line":"Cupertino CA 95014-2083","delivery_point_barcode":"950142083017","components":{"primary_number":"1","street_name":"Infinite","street_suffix":"Loop","city_name":"Cupertino","state_abbreviation":"CA","zipcode":"95014","plus4_code":"2083","delivery_point":"01","delivery_point_check_digit":"7"},"metadata":{"record_type":"S","county_fips":"06085","county_name":"Santa Clara","carrier_route":"C067","congressional_district":"18","rdi":"Commercial","elot_sequence":"0031","elot_sort":"A","latitude":37.33118,"longitude":-122.03062,"precision":"Zip9"},"analysis":{"dpv_match_code":"Y","dpv_footnotes":"AABB","dpv_cmra":"N","dpv_vacant":"N","active":"Y"}},{"input_index":0,"candidate_index":1,"addressee":"Apple Computer","delivery_line_1":"1 Infinite Loop","last_line":"Cupertino CA 95014-2084","delivery_point_barcode":"950142084016","components":{"primary_number":"1","street_name":"Infinite","street_suffix":"Loop","city_name":"Cupertino","state_abbreviation":"CA","zipcode":"95014","plus4_code":"2084","delivery_point":"01","delivery_point_check_digit":"6"},"metadata":{"record_type":"F","county_fips":"06085","county_name":"Santa Clara","carrier_route":"C067","congressional_district":"18","rdi":"Commercial","elot_sequence":"0032","elot_sort":"A","latitude":37.33118,"longitude":-122.03062,"precision":"Zip9"},"analysis":{"dpv_match_code":"Y","dpv_footnotes":"AABB","dpv_cmra":"N","dpv_vacant":"N","active":"Y"}}]'
         | 
| 166 | 
            -
              end
         | 
| 167 | 
            -
             | 
| 168 | 
            -
              def unsuccessful_response_data
         | 
| 169 | 
            -
                nil
         | 
| 170 | 
            -
              end
         | 
| 171 | 
            -
            end
         | 
| 96 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: smarty_streets
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Russ Smith
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-01-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httparty
         | 
| @@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 108 108 | 
             
                  version: '0'
         | 
| 109 109 | 
             
            requirements: []
         | 
| 110 110 | 
             
            rubyforge_project: 
         | 
| 111 | 
            -
            rubygems_version: 2.0. | 
| 111 | 
            +
            rubygems_version: 2.0.14
         | 
| 112 112 | 
             
            signing_key: 
         | 
| 113 113 | 
             
            specification_version: 4
         | 
| 114 114 | 
             
            summary: A ruby gem to integrate with http://www.smartystreets.com
         |