usps-proxy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/Gemfile.lock +28 -1
- data/README.md +9 -1
- data/fixtures/vcr_cassettes/USPS_Proxy_AddressStandardization/GET_/adddress_standardization_.yml +91 -0
- data/fixtures/vcr_cassettes/USPS_Proxy_CityState/GET_/city_state_.yml +135 -0
- data/lib/usps-proxy/version.rb +1 -1
- data/spec/address_standardization_spec.rb +63 -0
- data/spec/city_state_spec.rb +43 -0
- data/spec/spec_helper.rb +27 -0
- data/usps-proxy.gemspec +5 -1
- metadata +69 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 400a3bb24f856c8ca53ef2869ff45b8e4ebd52d8
|
4
|
+
data.tar.gz: 8124e127f5743e6580a48bfe4b2f1f3dd0715ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0c010b848ac738a9b8553e077196e41bc2aa4f40fcaacb0879fda44a6e91a04dbb60d93172616183843d0f34fb1ba92d29cbac1ff6c52d573b8157d38115c7f
|
7
|
+
data.tar.gz: d54cdc2060eafd328726313a0f69f974f7227ab6667099dd70bc3c1e610f2d97764ab9c5337ed56f7f0eb5e19680d6f45e4a3038482fcc74d218e9eb9ba4abf1
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
usps-proxy (0.0.
|
4
|
+
usps-proxy (0.0.2)
|
5
5
|
dotenv
|
6
6
|
sinatra
|
7
7
|
thin
|
@@ -10,9 +10,13 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
+
addressable (2.3.6)
|
13
14
|
builder (3.2.2)
|
14
15
|
coderay (1.1.0)
|
16
|
+
crack (0.4.2)
|
17
|
+
safe_yaml (~> 1.0.0)
|
15
18
|
daemons (1.1.9)
|
19
|
+
diff-lcs (1.2.5)
|
16
20
|
dotenv (1.0.2)
|
17
21
|
ethon (0.7.1)
|
18
22
|
ffi (>= 1.3.0)
|
@@ -29,7 +33,22 @@ GEM
|
|
29
33
|
rack (1.5.2)
|
30
34
|
rack-protection (1.5.3)
|
31
35
|
rack
|
36
|
+
rack-test (0.6.2)
|
37
|
+
rack (>= 1.0)
|
32
38
|
rake (10.4.2)
|
39
|
+
rspec (3.1.0)
|
40
|
+
rspec-core (~> 3.1.0)
|
41
|
+
rspec-expectations (~> 3.1.0)
|
42
|
+
rspec-mocks (~> 3.1.0)
|
43
|
+
rspec-core (3.1.7)
|
44
|
+
rspec-support (~> 3.1.0)
|
45
|
+
rspec-expectations (3.1.2)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.1.0)
|
48
|
+
rspec-mocks (3.1.3)
|
49
|
+
rspec-support (~> 3.1.0)
|
50
|
+
rspec-support (3.1.2)
|
51
|
+
safe_yaml (1.0.4)
|
33
52
|
sinatra (1.4.5)
|
34
53
|
rack (~> 1.4)
|
35
54
|
rack-protection (~> 1.4)
|
@@ -46,11 +65,19 @@ GEM
|
|
46
65
|
builder (>= 2.1.2)
|
47
66
|
nokogiri (>= 1.4.1)
|
48
67
|
typhoeus (>= 0.1.18)
|
68
|
+
vcr (2.9.3)
|
69
|
+
webmock (1.20.4)
|
70
|
+
addressable (>= 2.3.6)
|
71
|
+
crack (>= 0.3.2)
|
49
72
|
|
50
73
|
PLATFORMS
|
51
74
|
ruby
|
52
75
|
|
53
76
|
DEPENDENCIES
|
54
77
|
pry
|
78
|
+
rack-test
|
55
79
|
rake (~> 10.0)
|
80
|
+
rspec
|
56
81
|
usps-proxy!
|
82
|
+
vcr
|
83
|
+
webmock
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# usps-proxy
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/18F/usps-proxy.svg)](https://travis-ci.org/18F/usps-proxy) [![Code Climate](https://codeclimate.com/github/18F/usps-proxy/badges/gpa.svg)](https://codeclimate.com/github/18F/usps-proxy) [![Gem Version](https://badge.fury.io/rb/usps-proxy.svg)](http://badge.fury.io/rb/usps-proxy)
|
4
|
+
|
3
5
|
A Sinatra server that makes the USPS API a tad easier to consume on the client-side.
|
4
6
|
|
5
7
|
This gem sits alongside the namespace created by the [`USPS` gem](https://github.com/gaffneyc/usps).
|
@@ -24,7 +26,7 @@ This is still a work-in-progress, but there is basic support for:
|
|
24
26
|
In `Gemfile`:
|
25
27
|
|
26
28
|
```ruby
|
27
|
-
gem 'usps-proxy'
|
29
|
+
gem 'usps-proxy' # see README badge for latest version
|
28
30
|
```
|
29
31
|
|
30
32
|
By default, `USPS::Proxy` will look for the `USPS_USER` environment variable. However, you can override this in `config/initializers/[production|development|test].rb`:
|
@@ -148,6 +150,12 @@ Example response:
|
|
148
150
|
}
|
149
151
|
```
|
150
152
|
|
153
|
+
### Testing
|
154
|
+
|
155
|
+
```
|
156
|
+
$ rspec
|
157
|
+
```
|
158
|
+
|
151
159
|
## Public domain
|
152
160
|
|
153
161
|
This project is in the public domain within the United States, and
|
data/fixtures/vcr_cassettes/USPS_Proxy_AddressStandardization/GET_/adddress_standardization_.yml
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=%3CAddressValidateRequest%20USERID=%22<USPS_USER_ID
|
6
|
+
(hidden)>%22%3E%3CAddress%20ID=%220%22%3E%3CFirmName/%3E%3CAddress1/%3E%3CAddress2%3E1800%20F%20street%20NW%3C/Address2%3E%3CCity%3Ewashington%3C/City%3E%3CState%3EDC%3C/State%3E%3CZip5%3E20006%3C/Zip5%3E%3CZip4/%3E%3C/Address%3E%3C/AddressValidateRequest%3E
|
7
|
+
body:
|
8
|
+
encoding: US-ASCII
|
9
|
+
string: ''
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
13
|
+
response:
|
14
|
+
status:
|
15
|
+
code: 200
|
16
|
+
message: OK
|
17
|
+
headers:
|
18
|
+
X-Backside-Transport:
|
19
|
+
- OK OK
|
20
|
+
Cache-Control:
|
21
|
+
- private
|
22
|
+
Content-Type:
|
23
|
+
- text/xml
|
24
|
+
Server:
|
25
|
+
- Microsoft-IIS/7.5
|
26
|
+
X-Aspnet-Version:
|
27
|
+
- 2.0.50727
|
28
|
+
X-Powered-By:
|
29
|
+
- ASP.NET
|
30
|
+
Date:
|
31
|
+
- Wed, 17 Dec 2014 21:22:07 GMT
|
32
|
+
X-Client-Ip:
|
33
|
+
- 56.0.70.6
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- "*"
|
36
|
+
Connection:
|
37
|
+
- Keep-Alive
|
38
|
+
Content-Length:
|
39
|
+
- '224'
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: |-
|
43
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
44
|
+
<AddressValidateResponse><Address ID="0"><Address2>1800 F ST NW</Address2><City>WASHINGTON</City><State>DC</State><Zip5>20405</Zip5><Zip4>0001</Zip4></Address></AddressValidateResponse>
|
45
|
+
http_version:
|
46
|
+
recorded_at: Wed, 17 Dec 2014 21:22:07 GMT
|
47
|
+
- request:
|
48
|
+
method: get
|
49
|
+
uri: http://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=%3CAddressValidateRequest%20USERID=%22<USPS_USER_ID
|
50
|
+
(hidden)>%22%3E%3CAddress%20ID=%220%22%3E%3CFirmName/%3E%3CAddress1/%3E%3CAddress2%3E1801%20F%20street%20NW%3C/Address2%3E%3CCity%3Ewashington%3C/City%3E%3CState%3EDC%3C/State%3E%3CZip5%3E20006%3C/Zip5%3E%3CZip4/%3E%3C/Address%3E%3C/AddressValidateRequest%3E
|
51
|
+
body:
|
52
|
+
encoding: US-ASCII
|
53
|
+
string: ''
|
54
|
+
headers:
|
55
|
+
User-Agent:
|
56
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
57
|
+
response:
|
58
|
+
status:
|
59
|
+
code: 200
|
60
|
+
message: OK
|
61
|
+
headers:
|
62
|
+
X-Backside-Transport:
|
63
|
+
- OK OK
|
64
|
+
Cache-Control:
|
65
|
+
- private
|
66
|
+
Content-Type:
|
67
|
+
- text/xml
|
68
|
+
Server:
|
69
|
+
- Microsoft-IIS/7.5
|
70
|
+
X-Aspnet-Version:
|
71
|
+
- 2.0.50727
|
72
|
+
X-Powered-By:
|
73
|
+
- ASP.NET
|
74
|
+
Date:
|
75
|
+
- Wed, 17 Dec 2014 21:22:07 GMT
|
76
|
+
X-Client-Ip:
|
77
|
+
- 56.0.70.6
|
78
|
+
Access-Control-Allow-Origin:
|
79
|
+
- "*"
|
80
|
+
Connection:
|
81
|
+
- Keep-Alive
|
82
|
+
Content-Length:
|
83
|
+
- '407'
|
84
|
+
body:
|
85
|
+
encoding: UTF-8
|
86
|
+
string: |-
|
87
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
88
|
+
<AddressValidateResponse><Address ID="0"><Address2>1801 F ST NW</Address2><City>WASHINGTON</City><State>DC</State><Zip5>20006</Zip5><Zip4>4406</Zip4><ReturnText>Default address: The address you entered was found but more information is needed (such as an apartment, suite, or box number) to match to a specific address.</ReturnText></Address></AddressValidateResponse>
|
89
|
+
http_version:
|
90
|
+
recorded_at: Wed, 17 Dec 2014 21:22:07 GMT
|
91
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,135 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://production.shippingapis.com/ShippingAPI.dll?API=CityStateLookup&XML=%3CCityStateLookupRequest%20USERID=%22<USPS_USER_ID
|
6
|
+
(hidden)>%22%3E%3CZipCode%20ID=%220%22%3E%3CZip5%3E20006%3C/Zip5%3E%3C/ZipCode%3E%3C/CityStateLookupRequest%3E
|
7
|
+
body:
|
8
|
+
encoding: US-ASCII
|
9
|
+
string: ''
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
13
|
+
response:
|
14
|
+
status:
|
15
|
+
code: 200
|
16
|
+
message: OK
|
17
|
+
headers:
|
18
|
+
X-Backside-Transport:
|
19
|
+
- OK OK
|
20
|
+
Cache-Control:
|
21
|
+
- private
|
22
|
+
Content-Type:
|
23
|
+
- text/xml
|
24
|
+
Server:
|
25
|
+
- Microsoft-IIS/7.5
|
26
|
+
X-Aspnet-Version:
|
27
|
+
- 2.0.50727
|
28
|
+
X-Powered-By:
|
29
|
+
- ASP.NET
|
30
|
+
Date:
|
31
|
+
- Wed, 17 Dec 2014 21:22:07 GMT
|
32
|
+
X-Client-Ip:
|
33
|
+
- 56.0.70.6
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- "*"
|
36
|
+
Connection:
|
37
|
+
- Keep-Alive
|
38
|
+
Content-Length:
|
39
|
+
- '174'
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: |-
|
43
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
44
|
+
<CityStateLookupResponse><ZipCode ID="0"><Zip5>20006</Zip5><City>WASHINGTON</City><State>DC</State></ZipCode></CityStateLookupResponse>
|
45
|
+
http_version:
|
46
|
+
recorded_at: Wed, 17 Dec 2014 21:22:07 GMT
|
47
|
+
- request:
|
48
|
+
method: get
|
49
|
+
uri: http://production.shippingapis.com/ShippingAPI.dll?API=CityStateLookup&XML=%3CCityStateLookupRequest%20USERID=%22<USPS_USER_ID
|
50
|
+
(hidden)>%22%3E%3CZipCode%20ID=%220%22%3E%3CZip5/%3E%3C/ZipCode%3E%3C/CityStateLookupRequest%3E
|
51
|
+
body:
|
52
|
+
encoding: US-ASCII
|
53
|
+
string: ''
|
54
|
+
headers:
|
55
|
+
User-Agent:
|
56
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
57
|
+
response:
|
58
|
+
status:
|
59
|
+
code: 200
|
60
|
+
message: OK
|
61
|
+
headers:
|
62
|
+
X-Backside-Transport:
|
63
|
+
- OK OK
|
64
|
+
Cache-Control:
|
65
|
+
- private
|
66
|
+
Content-Type:
|
67
|
+
- text/xml
|
68
|
+
Server:
|
69
|
+
- Microsoft-IIS/7.5
|
70
|
+
X-Aspnet-Version:
|
71
|
+
- 2.0.50727
|
72
|
+
X-Powered-By:
|
73
|
+
- ASP.NET
|
74
|
+
Date:
|
75
|
+
- Wed, 17 Dec 2014 21:22:07 GMT
|
76
|
+
X-Client-Ip:
|
77
|
+
- 56.0.70.6
|
78
|
+
Access-Control-Allow-Origin:
|
79
|
+
- "*"
|
80
|
+
Connection:
|
81
|
+
- Keep-Alive
|
82
|
+
Content-Length:
|
83
|
+
- '272'
|
84
|
+
body:
|
85
|
+
encoding: UTF-8
|
86
|
+
string: |-
|
87
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
88
|
+
<CityStateLookupResponse><ZipCode ID="0"><Error><Number>-2147219399</Number><Source>WebtoolsAMS;CityStateLookup</Source><Description>Invalid Zip Code.</Description><HelpFile/><HelpContext/></Error></ZipCode></CityStateLookupResponse>
|
89
|
+
http_version:
|
90
|
+
recorded_at: Wed, 17 Dec 2014 21:22:08 GMT
|
91
|
+
- request:
|
92
|
+
method: get
|
93
|
+
uri: http://production.shippingapis.com/ShippingAPI.dll?API=CityStateLookup&XML=%3CCityStateLookupRequest%20USERID=%22<USPS_USER_ID
|
94
|
+
(hidden)>%22%3E%3CZipCode%20ID=%220%22%3E%3CZip5%3EthisIsNotAZip5%3C/Zip5%3E%3C/ZipCode%3E%3C/CityStateLookupRequest%3E
|
95
|
+
body:
|
96
|
+
encoding: US-ASCII
|
97
|
+
string: ''
|
98
|
+
headers:
|
99
|
+
User-Agent:
|
100
|
+
- Typhoeus - https://github.com/typhoeus/typhoeus
|
101
|
+
response:
|
102
|
+
status:
|
103
|
+
code: 200
|
104
|
+
message: OK
|
105
|
+
headers:
|
106
|
+
X-Backside-Transport:
|
107
|
+
- OK OK
|
108
|
+
Cache-Control:
|
109
|
+
- private
|
110
|
+
Content-Type:
|
111
|
+
- text/xml
|
112
|
+
Server:
|
113
|
+
- Microsoft-IIS/7.5
|
114
|
+
X-Aspnet-Version:
|
115
|
+
- 2.0.50727
|
116
|
+
X-Powered-By:
|
117
|
+
- ASP.NET
|
118
|
+
Date:
|
119
|
+
- Wed, 17 Dec 2014 21:22:07 GMT
|
120
|
+
X-Client-Ip:
|
121
|
+
- 56.0.70.6
|
122
|
+
Access-Control-Allow-Origin:
|
123
|
+
- "*"
|
124
|
+
Connection:
|
125
|
+
- Keep-Alive
|
126
|
+
Content-Length:
|
127
|
+
- '283'
|
128
|
+
body:
|
129
|
+
encoding: UTF-8
|
130
|
+
string: |-
|
131
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
132
|
+
<CityStateLookupResponse><ZipCode ID="0"><Error><Number>-2147219024</Number><Source>WebtoolsAMS;CityStateLookup</Source><Description>ZIPCode must be 5 characters</Description><HelpFile/><HelpContext/></Error></ZipCode></CityStateLookupResponse>
|
133
|
+
http_version:
|
134
|
+
recorded_at: Wed, 17 Dec 2014 21:22:08 GMT
|
135
|
+
recorded_with: VCR 2.9.3
|
data/lib/usps-proxy/version.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe USPS::Proxy::AddressStandardization do
|
4
|
+
|
5
|
+
context "GET '/adddress_standardization'" do
|
6
|
+
use_vcr_cassette #record: :new_episodes
|
7
|
+
|
8
|
+
let(:address_query_string1) do
|
9
|
+
"address1=1800%20F%20street%20NW&city=washington&state=DC&zip5=20006"
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:address_query_string2) do
|
13
|
+
"address1=1801%20F%20street%20NW&city=washington&state=DC&zip5=20006"
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:return_text) do
|
17
|
+
"Default address: The address you entered was found but more information is needed (such as an apartment, suite, or box number) to match to a specific address."
|
18
|
+
end
|
19
|
+
|
20
|
+
it "standardizes an address" do
|
21
|
+
get "/address_standardization?#{address_query_string1}"
|
22
|
+
|
23
|
+
parsed = JSON.parse(last_response.body)
|
24
|
+
|
25
|
+
expect(parsed).to(be_a(Hash))
|
26
|
+
expect(parsed).to(have_key("results"))
|
27
|
+
|
28
|
+
expect(parsed["results"][0].keys).to(eq([
|
29
|
+
"name",
|
30
|
+
"company",
|
31
|
+
"address1",
|
32
|
+
"address2",
|
33
|
+
"city",
|
34
|
+
"state",
|
35
|
+
"zip5",
|
36
|
+
"zip4",
|
37
|
+
"return_text"
|
38
|
+
]))
|
39
|
+
|
40
|
+
expect(parsed["results"][0]["address1"]).to(eq("1800 F ST NW"))
|
41
|
+
expect(parsed["results"][0]["zip5"]).to(eq("20405"))
|
42
|
+
expect(parsed["results"][0]["zip4"]).to(eq("0001"))
|
43
|
+
end
|
44
|
+
|
45
|
+
it "asks for more information if necessary" do
|
46
|
+
get "/address_standardization?#{address_query_string2}"
|
47
|
+
|
48
|
+
parsed = JSON.parse(last_response.body)
|
49
|
+
|
50
|
+
expect(parsed["results"][0]["return_text"]).to(eq(return_text))
|
51
|
+
end
|
52
|
+
|
53
|
+
it "returns an error when given invalid data" do
|
54
|
+
pending("this needs to be implemented")
|
55
|
+
|
56
|
+
get "/address_standardization?foo=bar¬=an_address"
|
57
|
+
|
58
|
+
parsed = JSON.parse(last_response.body)
|
59
|
+
|
60
|
+
expect(parsed).to(have_key("error"))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe USPS::Proxy::CityState do
|
4
|
+
|
5
|
+
context "GET '/city_state'" do
|
6
|
+
use_vcr_cassette #record: :new_episodes
|
7
|
+
|
8
|
+
let(:zip5) { "20006" }
|
9
|
+
let(:city) { "WASHINGTON" }
|
10
|
+
let(:state) { "DC" }
|
11
|
+
|
12
|
+
it "gets a city and state from zipcode" do
|
13
|
+
get "/city_state?zip5=#{zip5}"
|
14
|
+
|
15
|
+
expect(last_response).to be_ok
|
16
|
+
|
17
|
+
parsed = JSON.parse(last_response.body)
|
18
|
+
|
19
|
+
expect(parsed).to(be_a(Hash))
|
20
|
+
expect(parsed).to(be_a(Hash))
|
21
|
+
expect(parsed["results"][zip5]["city"]).to(eq(city))
|
22
|
+
expect(parsed["results"][zip5]["state"]).to(eq(state))
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns an error when no zip5 is provided" do
|
26
|
+
get "/city_state"
|
27
|
+
|
28
|
+
parsed = JSON.parse(last_response.body)
|
29
|
+
|
30
|
+
expect(parsed).to(have_key("error"))
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns an error when an invalid zip5 is provided" do
|
34
|
+
get "/city_state?zip5=thisIsNotAZip5"
|
35
|
+
|
36
|
+
parsed = JSON.parse(last_response.body)
|
37
|
+
|
38
|
+
expect(parsed).to(have_key("error"))
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'sinatra/base'
|
3
|
+
require 'rack/test'
|
4
|
+
require 'pry'
|
5
|
+
require 'vcr'
|
6
|
+
|
7
|
+
VCR.configure do |c|
|
8
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
9
|
+
c.hook_into :webmock
|
10
|
+
c.filter_sensitive_data('<USPS_USER_ID (hidden)>') { ENV['USPS_USER'] }
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'usps-proxy'
|
14
|
+
|
15
|
+
def app
|
16
|
+
Rack::URLMap.new(
|
17
|
+
'/city_state' => USPS::Proxy::CityState,
|
18
|
+
'/address_standardization' => USPS::Proxy::AddressStandardization
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.tty = true
|
24
|
+
config.formatter = :documentation
|
25
|
+
config.include Rack::Test::Methods
|
26
|
+
config.extend VCR::RSpec::Macros
|
27
|
+
end
|
data/usps-proxy.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Alan deLevie"]
|
10
10
|
spec.email = ["alan.delevie@gsa.gov"]
|
11
11
|
spec.summary = %q{Some space between the USPS API and your users}
|
12
|
-
spec.description = %q{Makes the USPS API a bit easier to
|
12
|
+
spec.description = %q{Makes the USPS API a bit easier to consume on the client-side.}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "Public Domain. See LICENSE.md"
|
15
15
|
|
@@ -20,6 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
22
|
spec.add_development_dependency "pry"
|
23
|
+
spec.add_development_dependency "rack-test"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "webmock"
|
26
|
+
spec.add_development_dependency "vcr"
|
23
27
|
|
24
28
|
spec.add_dependency "dotenv"
|
25
29
|
spec.add_dependency "sinatra"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan deLevie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,62 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack-test
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
41
97
|
- !ruby/object:Gem::Dependency
|
42
98
|
name: dotenv
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +150,7 @@ dependencies:
|
|
94
150
|
- - ">="
|
95
151
|
- !ruby/object:Gem::Version
|
96
152
|
version: '0'
|
97
|
-
description: Makes the USPS API a bit easier to
|
153
|
+
description: Makes the USPS API a bit easier to consume on the client-side.
|
98
154
|
email:
|
99
155
|
- alan.delevie@gsa.gov
|
100
156
|
executables: []
|
@@ -104,6 +160,7 @@ files:
|
|
104
160
|
- ".env.example"
|
105
161
|
- ".gitignore"
|
106
162
|
- ".ruby-version"
|
163
|
+
- ".travis.yml"
|
107
164
|
- CONTRIBUTING.md
|
108
165
|
- Gemfile
|
109
166
|
- Gemfile.lock
|
@@ -111,11 +168,16 @@ files:
|
|
111
168
|
- README.md
|
112
169
|
- Rakefile
|
113
170
|
- config.ru
|
171
|
+
- fixtures/vcr_cassettes/USPS_Proxy_AddressStandardization/GET_/adddress_standardization_.yml
|
172
|
+
- fixtures/vcr_cassettes/USPS_Proxy_CityState/GET_/city_state_.yml
|
114
173
|
- lib/usps-proxy.rb
|
115
174
|
- lib/usps-proxy/address_standardization.rb
|
116
175
|
- lib/usps-proxy/city_state.rb
|
117
176
|
- lib/usps-proxy/protocol.rb
|
118
177
|
- lib/usps-proxy/version.rb
|
178
|
+
- spec/address_standardization_spec.rb
|
179
|
+
- spec/city_state_spec.rb
|
180
|
+
- spec/spec_helper.rb
|
119
181
|
- usps-proxy.gemspec
|
120
182
|
homepage: ''
|
121
183
|
licenses:
|
@@ -141,4 +203,7 @@ rubygems_version: 2.2.2
|
|
141
203
|
signing_key:
|
142
204
|
specification_version: 4
|
143
205
|
summary: Some space between the USPS API and your users
|
144
|
-
test_files:
|
206
|
+
test_files:
|
207
|
+
- spec/address_standardization_spec.rb
|
208
|
+
- spec/city_state_spec.rb
|
209
|
+
- spec/spec_helper.rb
|