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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 865e83ff8c1948e5999f3c85f9397260306e5142
4
- data.tar.gz: ef741f0b597b48e6aa074f8f2471d2be9809eef7
3
+ metadata.gz: 9de1168d1f32c3a7c550f8d0736e77ad9e7a6f6f
4
+ data.tar.gz: 1c8d01295bf49455eb8e11f23f08d6ba6ec520ac
5
5
  SHA512:
6
- metadata.gz: caf0310352db0c2055546b47eeedd67008e54e9f009afafde599c4dfe4892d87e44370eedc30e42cc9a78d46b05190c11e2aba891be7c5db5d243f29b3a67a5c
7
- data.tar.gz: 416e556d6f7fd7267668825bfdc9ea410cc907161ec74ced9616bd0de4ce50fc621264fc7de5aac218d777bc2684fe295216ea8aa81c745d0357f3ee451d9c9b
6
+ metadata.gz: cb1e0ecca749119e00aae99d4666e2790b1d23c294e489cb9f01ccdcf4094dc32eefec9775428640f5fa58be676e5c04ff21791c876ce4bd6e7c5cf12c46b598
7
+ data.tar.gz: d9b1ff382c0169a33263995b29c150bb6c4e784668469cc00157183a2a7b2fa8539c4980cf2ba9cebe34b6bbc36c65caa3db4f0170c55b922b97f7fb2dcb57fb
@@ -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
- - [Image Prepping](https://lob.com/docs/ruby#prepping)
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
 
@@ -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.
@@ -45,20 +45,20 @@ html = %{
45
45
  to_address = @lob.addresses.create(
46
46
  name: "ToAddress",
47
47
  address_line1: "120 6th Ave",
48
- city: "Boston",
49
- state: "MA",
50
- country: "US",
51
- zip: 12345
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
- city: "Boston",
59
- state: "MA",
60
- country: "US",
61
- zip: 12345
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,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,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
@@ -6,7 +6,11 @@ module Lob
6
6
  end
7
7
 
8
8
  def list(options = {})
9
- Lob.submit(:get, route_url, options)
9
+ if options.is_a?(String)
10
+ Lob.submit(:get, route_url(options))
11
+ else
12
+ Lob.submit(:get, route_url, options)
13
+ end
10
14
  end
11
15
 
12
16
  private
@@ -1,3 +1,3 @@
1
1
  module Lob
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -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.0
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-06-26 00:00:00.000000000 Z
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