lob 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +7 -6
- data/examples/README.md +4 -0
- data/examples/letters.rb +8 -8
- data/examples/verify/input.txt +7 -0
- data/examples/verify/verify.rb +38 -0
- data/lib/lob/v1/route.rb +5 -1
- data/lib/lob/version.rb +1 -1
- data/spec/lob/v1/route_spec.rb +9 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de1168d1f32c3a7c550f8d0736e77ad9e7a6f6f
|
4
|
+
data.tar.gz: 1c8d01295bf49455eb8e11f23f08d6ba6ec520ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb1e0ecca749119e00aae99d4666e2790b1d23c294e489cb9f01ccdcf4094dc32eefec9775428640f5fa58be676e5c04ff21791c876ce4bd6e7c5cf12c46b598
|
7
|
+
data.tar.gz: d9b1ff382c0169a33263995b29c150bb6c4e784668469cc00157183a2a7b2fa8539c4980cf2ba9cebe34b6bbc36c65caa3db4f0170c55b922b97f7fb2dcb57fb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## [**2.1.1**](https://github.com/lob/lob-ruby/releases/tag/v2.1.1)
|
2
|
+
- [**#124**] (https://github.com/lob/lob-ruby/pull/124) routes#find accepts single ZIP code
|
3
|
+
|
1
4
|
## [**2.1.0**](https://github.com/lob/lob-ruby/releases/tag/v2.1.0)
|
2
5
|
- [**#119**] (https://github.com/lob/lob-ruby/pull/119) better error messages
|
3
6
|
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
[![Coverage Status](https://coveralls.io/repos/lob/lob-ruby/badge.svg?branch=master)](https://coveralls.io/r/lob/lob-ruby?branch=master)
|
9
9
|
[![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/lob?color=green&type=total)](https://rubygems.org/gems/lob)
|
10
10
|
|
11
|
-
Ruby wrapper for the [Lob.com](http://lob.com) API. See the full Lob.com [API Documentation](https://lob.com/docs/ruby). This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
|
11
|
+
Ruby wrapper for the [Lob.com](http://lob.com) API. See the full Lob.com [API Documentation](https://lob.com/docs/ruby). For best results, be sure that you're using [the latest version](https://lob.com/docs/ruby#version) of the Lob API and the latest version of the ruby wrapper. This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
|
12
12
|
|
13
13
|
Supports Ruby 1.9.3 and greater.
|
14
14
|
|
@@ -93,11 +93,13 @@ We've provided various examples for you to try out [here](https://github.com/lob
|
|
93
93
|
There are simple scripts to demonstrate how to create all the core Lob products (checks, letters, postcards, jobs etc.), as well as more complex examples that utilize other libraries and external files:
|
94
94
|
|
95
95
|
- [Creating Dynamic Postcards with HTML and Data](https://github.com/lob/lob-ruby/tree/master/examples/csv_postcards)
|
96
|
+
|
96
97
|
## API Documentation
|
97
98
|
|
98
99
|
- [Introduction](https://lob.com/docs/ruby#introduction)
|
99
100
|
- [Versioning](https://lob.com/docs/ruby#version)
|
100
|
-
- [
|
101
|
+
- [Errors](https://lob.com/docs/ruby#errors)
|
102
|
+
- [Metadata](https://lob.com/docs/ruby#metadata)
|
101
103
|
- **Addresses**
|
102
104
|
- [Address Book](https://lob.com/docs/ruby#addresses)
|
103
105
|
- [Create an Address](https://lob.com/docs/ruby#addresses_create)
|
@@ -130,6 +132,7 @@ There are simple scripts to demonstrate how to create all the core Lob products
|
|
130
132
|
- **Simple Print Service**
|
131
133
|
- [Jobs](https://lob.com/docs/ruby#jobs)
|
132
134
|
- [Create a Job](https://lob.com/docs/ruby#jobs_create)
|
135
|
+
- [Create a MultiObject Job](https://lob.com/docs/ruby#jobs_multi)
|
133
136
|
- [Retrieve a Job](https://lob.com/docs/ruby#jobs_retrieve)
|
134
137
|
- [List all Jobs](https://lob.com/docs/ruby#jobs_list)
|
135
138
|
- [Objects](https://lob.com/docs/ruby#objects)
|
@@ -154,11 +157,9 @@ There are simple scripts to demonstrate how to create all the core Lob products
|
|
154
157
|
- [States](https://lob.com/docs/ruby#states)
|
155
158
|
- [List all States](https://lob.com/docs/ruby#states_list)
|
156
159
|
- **Appendix**
|
160
|
+
- [HTML Examples](https://lob.com/docs/ruby#html-examples)
|
161
|
+
- [Image Prepping](https://lob.com/docs/ruby#prepping)
|
157
162
|
- [SPS Templates](https://lob.com/docs/ruby#sps-templates)
|
158
|
-
- [Custom Fonts with HTML](https://lob.com/docs/ruby#html-fonts)
|
159
|
-
- [Postcard HTML Examples](https://lob.com/docs/ruby#postcard-examples)
|
160
|
-
- [Area HTML Examples](https://lob.com/docs/ruby#area-examples)
|
161
|
-
- [Letter HTML Examples](https://lob.com/docs/ruby#letter-examples)
|
162
163
|
|
163
164
|
## Contributing
|
164
165
|
|
data/examples/README.md
CHANGED
@@ -21,3 +21,7 @@ And example showing how to create letters using Lob's [Simple Letter Service](ht
|
|
21
21
|
## /postcards.rb
|
22
22
|
|
23
23
|
An example showing how to create postcards using Lob's [Simple Postcard Service](https://lob.com/services/postcards).
|
24
|
+
|
25
|
+
## /verify.rb
|
26
|
+
|
27
|
+
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.
|
data/examples/letters.rb
CHANGED
@@ -45,20 +45,20 @@ html = %{
|
|
45
45
|
to_address = @lob.addresses.create(
|
46
46
|
name: "ToAddress",
|
47
47
|
address_line1: "120 6th Ave",
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
address_city: "Boston",
|
49
|
+
address_state: "MA",
|
50
|
+
address_country: "US",
|
51
|
+
address_zip: 12345
|
52
52
|
)
|
53
53
|
|
54
54
|
# create a from address
|
55
55
|
from_address = @lob.addresses.create(
|
56
56
|
name: "FromAddress",
|
57
57
|
address_line1: "120 6th Ave",
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
address_city: "Boston",
|
59
|
+
address_state: "MA",
|
60
|
+
address_country: "US",
|
61
|
+
address_zip: 12345
|
62
62
|
)
|
63
63
|
|
64
64
|
# send the letter
|
@@ -0,0 +1,38 @@
|
|
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.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
|
11
|
+
@lob = Lob.load
|
12
|
+
|
13
|
+
output = File.open(File.expand_path('../output.csv', __FILE__), 'w')
|
14
|
+
|
15
|
+
output.puts ['address_line1', 'address_city', 'address_state', 'address_zip', 'address_country'].join(',')
|
16
|
+
|
17
|
+
# Parse the CSV and create the postcards.
|
18
|
+
File.open(File.expand_path('../input.txt', __FILE__)).each_line do |line|
|
19
|
+
parsed_address = StreetAddress::US.parse(line)
|
20
|
+
|
21
|
+
verified_address = @lob.addresses.verify(
|
22
|
+
address_line1: parsed_address.to_s(:line1),
|
23
|
+
address_city: parsed_address.city,
|
24
|
+
address_state: parsed_address.state,
|
25
|
+
address_country: 'US'
|
26
|
+
)['address']
|
27
|
+
|
28
|
+
output.puts [
|
29
|
+
verified_address['address_line1'],
|
30
|
+
verified_address['address_city'],
|
31
|
+
verified_address['address_state'],
|
32
|
+
verified_address['address_zip'],
|
33
|
+
verified_address['address_country']
|
34
|
+
].join(',')
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
output.close
|
data/lib/lob/v1/route.rb
CHANGED
data/lib/lob/version.rb
CHANGED
data/spec/lob/v1/route_spec.rb
CHANGED
@@ -5,10 +5,19 @@ describe Lob::V1::Route do
|
|
5
5
|
subject { Lob(api_key: ENV["LOB_API_KEY"]) }
|
6
6
|
|
7
7
|
describe "list" do
|
8
|
+
|
8
9
|
it "should list routes" do
|
9
10
|
zip_code = "94158"
|
10
11
|
routes = subject.routes.list(zip_codes: zip_code)
|
11
12
|
routes["data"][0]["zip_code"].must_equal(zip_code)
|
12
13
|
end
|
14
|
+
|
15
|
+
it "should accept a single ZIP code as input" do
|
16
|
+
zip_code = "94158"
|
17
|
+
routes = subject.routes.list(zip_code)
|
18
|
+
routes["zip_code"].must_equal(zip_code)
|
19
|
+
end
|
20
|
+
|
13
21
|
end
|
22
|
+
|
14
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -159,6 +159,8 @@ files:
|
|
159
159
|
- examples/jobs.rb
|
160
160
|
- examples/letters.rb
|
161
161
|
- examples/postcards.rb
|
162
|
+
- examples/verify/input.txt
|
163
|
+
- examples/verify/verify.rb
|
162
164
|
- lib/lob.rb
|
163
165
|
- lib/lob/errors/invalid_request_error.rb
|
164
166
|
- lib/lob/errors/lob_error.rb
|