lob 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +3 -0
- data/README.md +63 -56
- data/examples/README.md +10 -12
- data/examples/csv_letters/create_letters.rb +1 -1
- data/examples/csv_postcards/create_postcards.rb +1 -1
- data/examples/csv_verify/input.csv +7 -0
- data/examples/csv_verify/verify.rb +36 -0
- data/examples/letters.rb +1 -1
- data/examples/postcards.rb +1 -1
- data/lib/lob/client.rb +5 -0
- data/lib/lob/resources/us_zip_lookups.rb +20 -0
- data/lib/lob/version.rb +1 -1
- data/spec/lob/resources/us_zip_lookups_spec.rb +23 -0
- metadata +54 -51
- data/examples/verify/input.txt +0 -7
- data/examples/verify/verify.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8c8884204048312baba9bd6fff2f8ef66511ba0
|
4
|
+
data.tar.gz: 43cf728195ba982d634961759390d85d89245c8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30bef61ae90c6d136b990d81c5338eec3138618226dae65c8d96a83f50b1c6334ae10817491903195f9d83d13533677afe18e22b33ff3da351712901b15e9afc
|
7
|
+
data.tar.gz: 8e8effd0fac3ffa615668303462a282e479dd43d3f1d40181da5ad824eab9fea94548e77f981637d07e4b1cf95e88c5ae23ce4c27f789a3508d8952a934a56a3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## [**4.1.0**](https://github.com/lob/lob-ruby/releases/tag/v4.1.0)
|
2
|
+
- [**#158**] (https://github.com/lob/lob-ruby/pull/158) add US Zip Lookups API endpoint to wrapper
|
3
|
+
|
1
4
|
## 4.0.0
|
2
5
|
|
3
6
|
Version 4.0.0 introduces a breaking change. It requires a minimum API version of `2017-05-17`, which introduces new US and International Verification APIs.
|
data/README.md
CHANGED
@@ -31,6 +31,8 @@ Here's a general overview of the Lob services available, click through to read m
|
|
31
31
|
- [Area Mail API](https://lob.com/services/area)
|
32
32
|
- [Address Verification API](https://lob.com/services/verifications)
|
33
33
|
|
34
|
+
Please read through the official [API Documentation](#api-documentation) to get a complete sense of what to expect from each endpoint.
|
35
|
+
|
34
36
|
### Registration
|
35
37
|
|
36
38
|
First, you will need to first create an account at [Lob.com](https://dashboard.lob.com/#/register) and obtain your Test and Live API Keys.
|
@@ -105,9 +107,7 @@ end
|
|
105
107
|
|
106
108
|
We've provided various examples for you to try out [here](https://github.com/lob/lob-ruby/tree/master/examples).
|
107
109
|
|
108
|
-
There are simple scripts to demonstrate how to create all the core Lob
|
109
|
-
|
110
|
-
- [Creating Dynamic Postcards with HTML and Data](https://github.com/lob/lob-ruby/tree/master/examples/csv_postcards)
|
110
|
+
There are simple scripts to demonstrate how to create all the core Lob objects (checks, letters, postcards. etc.) as well as more complex examples that utilize other libraries and external files.
|
111
111
|
|
112
112
|
## API Documentation
|
113
113
|
|
@@ -116,69 +116,77 @@ There are simple scripts to demonstrate how to create all the core Lob products
|
|
116
116
|
- [Errors](https://lob.com/docs/ruby#errors)
|
117
117
|
- [Rate Limiting](https://lob.com/docs/ruby#rate-limits)
|
118
118
|
- [Webhooks](https://lob.com/docs/ruby#webhooks)
|
119
|
+
- [Cancellation Windows](https://lob.com/docs/ruby#cancellation)
|
120
|
+
- [Scheduled Mailings](https://lob.com/docs/ruby#scheduled)
|
119
121
|
- [Metadata](https://lob.com/docs/ruby#metadata)
|
122
|
+
- [HTML Templates](https://lob.com/docs/ruby#templates)
|
120
123
|
- [Asset URLs](https://lob.com/docs/ruby#urls)
|
121
124
|
- **Addresses**
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
- [Address Book](https://lob.com/docs/ruby#addresses)
|
126
|
+
- [The Address Object](https://lob.com/docs/ruby#addresses_object)
|
127
|
+
- [Create an Address](https://lob.com/docs/ruby#addresses_create)
|
128
|
+
- [Retrieve an Address](https://lob.com/docs/ruby#addresses_retrieve)
|
129
|
+
- [Delete an Address](https://lob.com/docs/ruby#addresses_delete)
|
130
|
+
- [List all Addresses](https://lob.com/docs/ruby#addresses_list)
|
128
131
|
- **US Verification API**
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
+
- [US Verification API](https://lob.com/docs/ruby#us_verifications)
|
133
|
+
- [The US Verification Object](https://lob.com/docs/ruby#us_verifications_object)
|
134
|
+
- [Verify a US Address](https://lob.com/docs/ruby#us_verifications_create)
|
135
|
+
- [The US Zip Lookup Object](https://lob.com/docs/ruby#us_zip_lookups_object)
|
136
|
+
- [Lookup a US Zip Code](https://lob.com/docs/ruby#us_zip_lookups_create)
|
132
137
|
- **Int'l Verification API**
|
133
|
-
|
134
|
-
|
138
|
+
- [International Verifications](https://lob.com/docs/ruby#intl_verifications)
|
139
|
+
- [Verify an International Address](https://lob.com/docs/ruby#intl_verifications_create)
|
135
140
|
- **Postcards API**
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
+
- [Postcards](https://lob.com/docs/ruby#postcards)
|
142
|
+
- [The Postcard Object](https://lob.com/docs/ruby#postcards_object)
|
143
|
+
- [Create a Postcard](https://lob.com/docs/ruby#postcards_create)
|
144
|
+
- [Retrieve a Postcard](https://lob.com/docs/ruby#postcards_retrieve)
|
145
|
+
- [Cancel a Postcard](https://lob.com/docs/ruby#postcards_delete)
|
146
|
+
- [List all Postcards](https://lob.com/docs/ruby#postcards_list)
|
141
147
|
- **Letters API**
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
148
|
+
- [Letters](https://lob.com/docs/ruby#letters)
|
149
|
+
- [The Letter Object](https://lob.com/docs/ruby#letters_object)
|
150
|
+
- [Create a Letter](https://lob.com/docs/ruby#letters_create)
|
151
|
+
- [Retrieve a Letter](https://lob.com/docs/ruby#letters_retrieve)
|
152
|
+
- [Cancel a Letter](https://lob.com/docs/ruby#letters_delete)
|
153
|
+
- [List all Letters](https://lob.com/docs/ruby#letters_list)
|
147
154
|
- **Checks API**
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
- [
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
- [Checks](https://lob.com/docs/ruby#checks)
|
156
|
+
- [The Check Object](https://lob.com/docs/ruby#checks_object)
|
157
|
+
- [Create a Check](https://lob.com/docs/ruby#checks_create)
|
158
|
+
- [Retrieve a Check](https://lob.com/docs/ruby#checks_retrieve)
|
159
|
+
- [Cancel a Check](https://lob.com/docs/ruby#checks_delete)
|
160
|
+
- [List all Checks](https://lob.com/docs/ruby#checks_list)
|
161
|
+
- [Bank Accounts](https://lob.com/docs/ruby#bank-accounts)
|
162
|
+
- [The Bank Account Object](https://lob.com/docs/ruby#bankaccounts_object)
|
163
|
+
- [Create a Bank Account](https://lob.com/docs/ruby#bankaccounts_create)
|
164
|
+
- [Retrieve a Bank Account](https://lob.com/docs/ruby#bankaccounts_retrieve)
|
165
|
+
- [Delete a Bank Account](https://lob.com/docs/ruby#bankaccounts_delete)
|
166
|
+
- [Verify a Bank Account](https://lob.com/docs/ruby#bankaccounts_verify)
|
167
|
+
- [List all Bank Accounts](https://lob.com/docs/ruby#bankaccounts_list)
|
160
168
|
- **Area Mail API**
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
169
|
+
- [Areas](https://lob.com/docs/ruby#areas)
|
170
|
+
- [The Area Object](https://lob.com/docs/ruby#areas_object)
|
171
|
+
- [Create an Area Mailing](https://lob.com/docs/ruby#areas_create)
|
172
|
+
- [Retrieve an Area Mailing](https://lob.com/docs/ruby#areas_retrieve)
|
173
|
+
- [List all Area Mailings](https://lob.com/docs/ruby#areas_list)
|
174
|
+
- [Routes](https://lob.com/docs/ruby#routes)
|
175
|
+
- [The Routes Object](https://lob.com/docs/ruby#routes_object)
|
176
|
+
- [Retrieve Routes](https://lob.com/docs/ruby#routes_retrieve)
|
177
|
+
- [List all Routes](https://lob.com/docs/ruby#routes_list)
|
170
178
|
- **Resources**
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
179
|
+
- [Countries](https://lob.com/docs/ruby#countries)
|
180
|
+
- [List all Countries](https://lob.com/docs/ruby#countries_list)
|
181
|
+
- [States](https://lob.com/docs/ruby#states)
|
182
|
+
- [List all States](https://lob.com/docs/ruby#states_list)
|
175
183
|
- **Appendix**
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
184
|
+
- [API Changelog](https://lob.com/docs/ruby#changelog)
|
185
|
+
- [The Tracking Event Object](https://lob.com/docs/ruby#tracking_event_object)
|
186
|
+
- [Events](https://lob.com/docs/ruby#events)
|
187
|
+
- [HTML Examples](https://lob.com/docs/ruby#html-examples)
|
188
|
+
- [Image Prepping](https://lob.com/docs/ruby#prepping)
|
189
|
+
- [US Verification Details](https://lob.com/docs/ruby#us_verification_details)
|
182
190
|
|
183
191
|
## Contributing
|
184
192
|
|
@@ -199,4 +207,3 @@ You can also configure, TravisCI for your fork of the repository and it'll run t
|
|
199
207
|
Copyright © 2016 Lob.com
|
200
208
|
|
201
209
|
Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
|
202
|
-
|
data/examples/README.md
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
# Ruby Examples
|
2
2
|
|
3
|
-
|
3
|
+
Here we have put together a hand full of ruby examples to help get you started. Please read through the official [API Documentation](../README.md#api-documentation) to get a complete sense of what to expect from each endpoint. As always, feel free to [contact us](https://lob.com/support) directly if you have any questions on implementation.
|
4
4
|
|
5
5
|
## /csv_checks/
|
6
6
|
|
7
|
-
An example showing how to dynamically create checks from a CSV using HTML,
|
7
|
+
An example showing how to dynamically create checks from a CSV using HTML, merge variables, and Lob's [Checks API](https://lob.com/services/checks).
|
8
8
|
|
9
9
|
## /csv_letters/
|
10
10
|
|
11
|
-
An example showing how to dynamically create letters from a CSV using HTML, a custom font,
|
11
|
+
An example showing how to dynamically create letters from a CSV using HTML, a custom font, merge variables, and Lob's [Letters API](https://lob.com/services/letters).
|
12
12
|
|
13
13
|
## /csv_postcards/
|
14
14
|
|
15
|
-
An example showing how to dynamically create postcards from a CSV using HTML, a custom font,
|
15
|
+
An example showing how to dynamically create postcards from a CSV using HTML, a custom font, merge variables, and Lob's [Postcards API](https://lob.com/services/postcards).
|
16
16
|
|
17
|
-
## /
|
17
|
+
## /csv_verify/
|
18
18
|
|
19
|
-
An example showing how to
|
19
|
+
An example showing how to validate and cleanse a CSV spreadsheet full of shipping addresses using Lob's [US Verification API](https://lob.com/services/verifications).
|
20
|
+
|
21
|
+
Please note that if you are running this with a Test API Key, the verification API will always return [a dummy address](https://lob.com/docs#us_verifications_create).
|
20
22
|
|
21
|
-
## /
|
23
|
+
## /checks.rb
|
22
24
|
|
23
|
-
An example showing how to create
|
25
|
+
An example showing how to create a check using Lob's [Checks API](https://lob.com/services/checks).
|
24
26
|
|
25
27
|
## /letters.rb
|
26
28
|
|
@@ -29,7 +31,3 @@ An example showing how to create a letter using Lob's [Letters API](https://lob.
|
|
29
31
|
## /postcards.rb
|
30
32
|
|
31
33
|
An example showing how to create a postcard using Lob's [Postcards API](https://lob.com/services/postcards).
|
32
|
-
|
33
|
-
## /verify/
|
34
|
-
|
35
|
-
An example showing how to verify an address using the [StreetAddress gem](https://github.com/derrek/street-address) and Lob's verify endpoint. This example saves verified addresses in a CSV file.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
185 Berry St,Unit 1510,,San Francisco,CA,
|
2
|
+
185 Berry St,Ste 1510,,SF,CA,
|
3
|
+
185 Berry St,,,SF,CA,
|
4
|
+
185 NW Berry St,,,SF,CA,
|
5
|
+
1600 Pennsylvania Ave,,,Washington,DC,20500
|
6
|
+
5904 Richmond Hwy Ste 340,,,Alexandria,VA,22303-1864
|
7
|
+
5905 Richmond Hwy Ste 340,,,Alexandria,VA,
|
@@ -0,0 +1,36 @@
|
|
1
|
+
$:.unshift File.expand_path("../../lib", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'lob'
|
5
|
+
|
6
|
+
# Initialize Lob object
|
7
|
+
lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
|
8
|
+
|
9
|
+
output = File.open(File.expand_path('../output.csv', __FILE__), 'w')
|
10
|
+
|
11
|
+
output.puts ['primary_line', 'secondary_line', 'urbanization', 'last_line', 'deliverability'].join(',')
|
12
|
+
|
13
|
+
# Parse the input file and verify the addresses
|
14
|
+
File.open(File.expand_path('../input.csv', __FILE__)).each_line do |line|
|
15
|
+
address_components = line.split(',')
|
16
|
+
|
17
|
+
verified_address = lob.us_verifications.verify(
|
18
|
+
primary_line: address_components[0],
|
19
|
+
secondary_line: address_components[1],
|
20
|
+
urbanization: address_components[2],
|
21
|
+
city: address_components[3],
|
22
|
+
state: address_components[4],
|
23
|
+
zip_code: address_components[5]
|
24
|
+
)
|
25
|
+
|
26
|
+
output.puts [
|
27
|
+
verified_address['primary_line'],
|
28
|
+
verified_address['secondary_line'],
|
29
|
+
verified_address['urbanization'],
|
30
|
+
verified_address['last_line'],
|
31
|
+
verified_address['deliverability']
|
32
|
+
].join(',')
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
output.close
|
data/examples/letters.rb
CHANGED
@@ -66,7 +66,7 @@ puts lob.letters.create(
|
|
66
66
|
to: to_address["id"],
|
67
67
|
from: from_address["id"],
|
68
68
|
file: html,
|
69
|
-
|
69
|
+
merge_variables: { name: 'Albert', event: 'HTML Letter Conference'},
|
70
70
|
metadata: { campaign: 'HTML 1.0' },
|
71
71
|
color: false
|
72
72
|
)
|
data/examples/postcards.rb
CHANGED
@@ -80,7 +80,7 @@ puts lob.postcards.create(
|
|
80
80
|
to: to_address["id"],
|
81
81
|
from: from_address["id"],
|
82
82
|
metadata: { campaign: "Summer 2015 Beach" },
|
83
|
-
|
83
|
+
merge_variables: { name: "Albert", event: "Summer 2015 Beach-athon" },
|
84
84
|
front: html,
|
85
85
|
message: "Please RSVP as soon as possible to reserve your lounge chair."
|
86
86
|
)
|
data/lib/lob/client.rb
CHANGED
@@ -9,6 +9,7 @@ require "lob/resources/postcard"
|
|
9
9
|
require "lob/resources/route"
|
10
10
|
require "lob/resources/state"
|
11
11
|
require "lob/resources/us_verifications"
|
12
|
+
require "lob/resources/us_zip_lookups"
|
12
13
|
|
13
14
|
module Lob
|
14
15
|
class Client
|
@@ -67,5 +68,9 @@ module Lob
|
|
67
68
|
Lob::Resources::USVerifications.new(config)
|
68
69
|
end
|
69
70
|
|
71
|
+
def us_zip_lookups
|
72
|
+
Lob::Resources::USZipLookups.new(config)
|
73
|
+
end
|
74
|
+
|
70
75
|
end
|
71
76
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "lob/resources/resource_base"
|
2
|
+
|
3
|
+
module Lob
|
4
|
+
module Resources
|
5
|
+
class USZipLookups < Lob::Resources::ResourceBase
|
6
|
+
|
7
|
+
undef_method :list, :find, :create, :destroy
|
8
|
+
|
9
|
+
def initialize(config)
|
10
|
+
super(config)
|
11
|
+
@endpoint = "us_zip_lookups"
|
12
|
+
end
|
13
|
+
|
14
|
+
def lookup(options={})
|
15
|
+
submit :post, endpoint_url, options
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/lob/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Lob::Resources::USZipLookups do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@sample_params = {
|
7
|
+
zip_code: "94107"
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
subject { Lob::Client.new(api_key: API_KEY) }
|
12
|
+
|
13
|
+
describe "lookup" do
|
14
|
+
it "should lookup a US zip code" do
|
15
|
+
result = subject.us_zip_lookups.lookup @sample_params
|
16
|
+
|
17
|
+
result["zip_code"].must_equal(@sample_params[:zip_code])
|
18
|
+
result["zip_code_type"].must_equal("standard")
|
19
|
+
result["cities"].length.must_equal(1)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
metadata
CHANGED
@@ -1,145 +1,145 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lob
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- -
|
17
|
+
- - ">="
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '1.8'
|
19
|
-
- - <
|
20
|
+
- - "<"
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: '3.0'
|
22
|
-
name: rest-client
|
23
|
-
prerelease: false
|
24
23
|
type: :runtime
|
24
|
+
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.8'
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
34
35
|
requirement: !ruby/object:Gem::Requirement
|
35
36
|
requirements:
|
36
|
-
- - ~>
|
37
|
+
- - "~>"
|
37
38
|
- !ruby/object:Gem::Version
|
38
39
|
version: '1.3'
|
39
|
-
name: bundler
|
40
|
-
prerelease: false
|
41
40
|
type: :development
|
41
|
+
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.3'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
48
49
|
requirement: !ruby/object:Gem::Requirement
|
49
50
|
requirements:
|
50
|
-
- - ~>
|
51
|
+
- - "~>"
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: 10.4.2
|
53
|
-
name: rake
|
54
|
-
prerelease: false
|
55
54
|
type: :development
|
55
|
+
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - ~>
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 10.4.2
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
+
name: minitest
|
62
63
|
requirement: !ruby/object:Gem::Requirement
|
63
64
|
requirements:
|
64
|
-
- - ~>
|
65
|
+
- - "~>"
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: 5.6.1
|
67
|
-
name: minitest
|
68
|
-
prerelease: false
|
69
68
|
type: :development
|
69
|
+
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - ~>
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 5.6.1
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
+
name: webmock
|
76
77
|
requirement: !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
|
-
- - ~>
|
79
|
+
- - "~>"
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
version: '1.2'
|
81
|
-
name: webmock
|
82
|
-
prerelease: false
|
83
82
|
type: :development
|
83
|
+
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - ~>
|
86
|
+
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '1.2'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
+
name: travis-lint
|
90
91
|
requirement: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
|
-
- - ~>
|
93
|
+
- - "~>"
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: 2.0.0
|
95
|
-
name: travis-lint
|
96
|
-
prerelease: false
|
97
96
|
type: :development
|
97
|
+
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - ~>
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 2.0.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
+
name: coveralls
|
104
105
|
requirement: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
|
-
- - ~>
|
107
|
+
- - "~>"
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: 0.8.1
|
109
|
-
name: coveralls
|
110
|
-
prerelease: false
|
111
110
|
type: :development
|
111
|
+
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - ~>
|
114
|
+
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: 0.8.1
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
+
name: simplecov
|
118
119
|
requirement: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
|
-
- - ~>
|
121
|
+
- - "~>"
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: 0.10.0
|
123
|
-
name: simplecov
|
124
|
-
prerelease: false
|
125
124
|
type: :development
|
125
|
+
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - ~>
|
128
|
+
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: 0.10.0
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
+
name: pry
|
132
133
|
requirement: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
|
-
- - ~>
|
135
|
+
- - "~>"
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: 0.10.0
|
137
|
-
name: pry
|
138
|
-
prerelease: false
|
139
138
|
type: :development
|
139
|
+
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- - ~>
|
142
|
+
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: 0.10.0
|
145
145
|
description: Lob API Ruby wrapper
|
@@ -149,8 +149,8 @@ executables: []
|
|
149
149
|
extensions: []
|
150
150
|
extra_rdoc_files: []
|
151
151
|
files:
|
152
|
-
- .gitignore
|
153
|
-
- .travis.yml
|
152
|
+
- ".gitignore"
|
153
|
+
- ".travis.yml"
|
154
154
|
- CHANGELOG.md
|
155
155
|
- CONTRIBUTING.md
|
156
156
|
- Gemfile
|
@@ -168,10 +168,10 @@ files:
|
|
168
168
|
- examples/csv_postcards/input.csv
|
169
169
|
- examples/csv_postcards/postcard_back.html
|
170
170
|
- examples/csv_postcards/postcard_front.html
|
171
|
+
- examples/csv_verify/input.csv
|
172
|
+
- examples/csv_verify/verify.rb
|
171
173
|
- examples/letters.rb
|
172
174
|
- examples/postcards.rb
|
173
|
-
- examples/verify/input.txt
|
174
|
-
- examples/verify/verify.rb
|
175
175
|
- lib/lob.rb
|
176
176
|
- lib/lob/client.rb
|
177
177
|
- lib/lob/errors/invalid_request_error.rb
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/lob/resources/route.rb
|
189
189
|
- lib/lob/resources/state.rb
|
190
190
|
- lib/lob/resources/us_verifications.rb
|
191
|
+
- lib/lob/resources/us_zip_lookups.rb
|
191
192
|
- lib/lob/version.rb
|
192
193
|
- lob.gemspec
|
193
194
|
- spec/lob/errors/lob_error_spec.rb
|
@@ -203,6 +204,7 @@ files:
|
|
203
204
|
- spec/lob/resources/route_spec.rb
|
204
205
|
- spec/lob/resources/state_spec.rb
|
205
206
|
- spec/lob/resources/us_verifications_spec.rb
|
207
|
+
- spec/lob/resources/us_zip_lookups_spec.rb
|
206
208
|
- spec/lob_spec.rb
|
207
209
|
- spec/samples/8.5x11.pdf
|
208
210
|
- spec/samples/postcardback.pdf
|
@@ -212,24 +214,24 @@ homepage: https://github.com/lob/lob-ruby
|
|
212
214
|
licenses:
|
213
215
|
- MIT
|
214
216
|
metadata: {}
|
215
|
-
post_install_message:
|
217
|
+
post_install_message:
|
216
218
|
rdoc_options: []
|
217
219
|
require_paths:
|
218
220
|
- lib
|
219
221
|
required_ruby_version: !ruby/object:Gem::Requirement
|
220
222
|
requirements:
|
221
|
-
- -
|
223
|
+
- - ">="
|
222
224
|
- !ruby/object:Gem::Version
|
223
225
|
version: '0'
|
224
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
227
|
requirements:
|
226
|
-
- -
|
228
|
+
- - ">="
|
227
229
|
- !ruby/object:Gem::Version
|
228
230
|
version: '0'
|
229
231
|
requirements: []
|
230
|
-
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
232
|
-
signing_key:
|
232
|
+
rubyforge_project:
|
233
|
+
rubygems_version: 2.6.11
|
234
|
+
signing_key:
|
233
235
|
specification_version: 4
|
234
236
|
summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax
|
235
237
|
test_files:
|
@@ -246,6 +248,7 @@ test_files:
|
|
246
248
|
- spec/lob/resources/route_spec.rb
|
247
249
|
- spec/lob/resources/state_spec.rb
|
248
250
|
- spec/lob/resources/us_verifications_spec.rb
|
251
|
+
- spec/lob/resources/us_zip_lookups_spec.rb
|
249
252
|
- spec/lob_spec.rb
|
250
253
|
- spec/samples/8.5x11.pdf
|
251
254
|
- spec/samples/postcardback.pdf
|
data/examples/verify/input.txt
DELETED
data/examples/verify/verify.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path("../../lib", File.dirname(__FILE__))
|
2
|
-
|
3
|
-
require 'csv'
|
4
|
-
require 'lob'
|
5
|
-
|
6
|
-
# Be sure to install the StreetAddress gem.
|
7
|
-
require 'street_address'
|
8
|
-
|
9
|
-
# Initialize Lob object
|
10
|
-
lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
|
11
|
-
|
12
|
-
output = File.open(File.expand_path('../output.csv', __FILE__), 'w')
|
13
|
-
|
14
|
-
output.puts ['address_line1', 'address_city', 'address_state', 'address_zip', 'address_country'].join(',')
|
15
|
-
|
16
|
-
# Parse the input file and verify the addresses
|
17
|
-
File.open(File.expand_path('../input.txt', __FILE__)).each_line do |line|
|
18
|
-
parsed_address = StreetAddress::US.parse(line)
|
19
|
-
|
20
|
-
verified_address = lob.addresses.verify(
|
21
|
-
address_line1: parsed_address.to_s(:line1),
|
22
|
-
address_city: parsed_address.city,
|
23
|
-
address_state: parsed_address.state,
|
24
|
-
address_country: 'US'
|
25
|
-
)['address']
|
26
|
-
|
27
|
-
output.puts [
|
28
|
-
verified_address['address_line1'],
|
29
|
-
verified_address['address_city'],
|
30
|
-
verified_address['address_state'],
|
31
|
-
verified_address['address_zip'],
|
32
|
-
verified_address['address_country']
|
33
|
-
].join(',')
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
output.close
|