lob 4.2.0 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe Lob::Resources::USAutocompletions do
4
+
5
+ before :each do
6
+ @sample_params = {
7
+ address_prefix: "185 BER",
8
+ city: "SAN FRANCISCO",
9
+ state: "CA"
10
+ }
11
+ end
12
+
13
+ subject { Lob::Client.new(api_key: API_KEY) }
14
+
15
+ describe "autocomplete" do
16
+ it "should return a list of address suggestions" do
17
+ result = subject.us_autocompletions.autocomplete @sample_params
18
+
19
+ result["suggestions"][0]["primary_line"].must_equal("TEST KEYS DO NOT AUTOCOMPLETE US ADDRESSES")
20
+ result["suggestions"][0]["city"].must_equal("SET `address_prefix` to '1 suggestion' TO SIMULATE AN AUTOCOMPLETION")
21
+ end
22
+ end
23
+
24
+ end
@@ -21,7 +21,7 @@ describe Lob::Resources::USVerifications do
21
21
  result["recipient"].must_equal("TEST KEYS DO NOT VERIFY ADDRESSES")
22
22
  end
23
23
 
24
- it "should verify a US address" do
24
+ it "should allow 'case' in query params" do
25
25
  result = subject.us_verifications.verify @sample_params, {case: "proper"}
26
26
 
27
27
  result["recipient"].must_equal("Test Keys Do Not Verify Addresses")
data/spec/spec_helper.rb CHANGED
@@ -3,10 +3,10 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
3
3
  require "simplecov"
4
4
  require "coveralls"
5
5
 
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
7
7
  SimpleCov::Formatter::HTMLFormatter,
8
8
  Coveralls::SimpleCov::Formatter
9
- ]
9
+ ])
10
10
  SimpleCov.start
11
11
 
12
12
  require "lob"
@@ -14,4 +14,4 @@ require "minitest/spec"
14
14
  require "minitest/pride"
15
15
  require "minitest/autorun"
16
16
 
17
- API_KEY = 'test_799ff27291c166d10ba191902ad02fb059c'
17
+ API_KEY = ENV['API_KEY']
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: 4.2.0
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-13 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: 2.0.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '3.0'
@@ -26,38 +26,24 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1.8'
29
+ version: 2.0.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.0'
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.3'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.3'
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: rake
49
35
  requirement: !ruby/object:Gem::Requirement
50
36
  requirements:
51
37
  - - "~>"
52
38
  - !ruby/object:Gem::Version
53
- version: 10.4.2
39
+ version: 12.3.3
54
40
  type: :development
55
41
  prerelease: false
56
42
  version_requirements: !ruby/object:Gem::Requirement
57
43
  requirements:
58
44
  - - "~>"
59
45
  - !ruby/object:Gem::Version
60
- version: 10.4.2
46
+ version: 12.3.3
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: minitest
63
49
  requirement: !ruby/object:Gem::Requirement
@@ -86,62 +72,34 @@ dependencies:
86
72
  - - "~>"
87
73
  - !ruby/object:Gem::Version
88
74
  version: '1.2'
89
- - !ruby/object:Gem::Dependency
90
- name: travis-lint
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: 2.0.0
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 2.0.0
103
75
  - !ruby/object:Gem::Dependency
104
76
  name: coveralls
105
77
  requirement: !ruby/object:Gem::Requirement
106
78
  requirements:
107
79
  - - "~>"
108
80
  - !ruby/object:Gem::Version
109
- version: 0.8.1
81
+ version: 0.8.13
110
82
  type: :development
111
83
  prerelease: false
112
84
  version_requirements: !ruby/object:Gem::Requirement
113
85
  requirements:
114
86
  - - "~>"
115
87
  - !ruby/object:Gem::Version
116
- version: 0.8.1
88
+ version: 0.8.13
117
89
  - !ruby/object:Gem::Dependency
118
90
  name: simplecov
119
91
  requirement: !ruby/object:Gem::Requirement
120
92
  requirements:
121
93
  - - "~>"
122
94
  - !ruby/object:Gem::Version
123
- version: 0.10.0
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: 0.10.0
131
- - !ruby/object:Gem::Dependency
132
- name: pry
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: 0.10.0
95
+ version: 0.11.0
138
96
  type: :development
139
97
  prerelease: false
140
98
  version_requirements: !ruby/object:Gem::Requirement
141
99
  requirements:
142
100
  - - "~>"
143
101
  - !ruby/object:Gem::Version
144
- version: 0.10.0
102
+ version: 0.11.0
145
103
  description: Lob API Ruby wrapper
146
104
  email:
147
105
  - support@lob.com
@@ -177,28 +135,30 @@ files:
177
135
  - lib/lob/errors/invalid_request_error.rb
178
136
  - lib/lob/errors/lob_error.rb
179
137
  - lib/lob/resources/address.rb
180
- - lib/lob/resources/area.rb
181
138
  - lib/lob/resources/bank_account.rb
182
139
  - lib/lob/resources/check.rb
140
+ - lib/lob/resources/group.rb
141
+ - lib/lob/resources/groups_member.rb
183
142
  - lib/lob/resources/intl_verifications.rb
184
143
  - lib/lob/resources/letter.rb
185
144
  - lib/lob/resources/postcard.rb
186
145
  - lib/lob/resources/resource_base.rb
187
- - lib/lob/resources/route.rb
146
+ - lib/lob/resources/us_autocompletions.rb
188
147
  - lib/lob/resources/us_verifications.rb
189
148
  - lib/lob/resources/us_zip_lookups.rb
190
149
  - lib/lob/version.rb
191
150
  - lob.gemspec
192
151
  - spec/lob/errors/lob_error_spec.rb
193
152
  - spec/lob/resources/address_spec.rb
194
- - spec/lob/resources/area_spec.rb
195
153
  - spec/lob/resources/bank_account_spec.rb
196
154
  - spec/lob/resources/check_spec.rb
155
+ - spec/lob/resources/group_spec.rb
197
156
  - spec/lob/resources/intl_verifications_spec.rb
198
157
  - spec/lob/resources/letter_spec.rb
158
+ - spec/lob/resources/member_spec.rb
199
159
  - spec/lob/resources/postcard_spec.rb
200
160
  - spec/lob/resources/resource_base_spec.rb
201
- - spec/lob/resources/route_spec.rb
161
+ - spec/lob/resources/us_autocompletions_spec.rb
202
162
  - spec/lob/resources/us_verifications_spec.rb
203
163
  - spec/lob/resources/us_zip_lookups_spec.rb
204
164
  - spec/lob_spec.rb
@@ -225,22 +185,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
185
  - !ruby/object:Gem::Version
226
186
  version: '0'
227
187
  requirements: []
228
- rubyforge_project:
229
- rubygems_version: 2.6.6
188
+ rubygems_version: 3.0.3
230
189
  signing_key:
231
190
  specification_version: 4
232
191
  summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax
233
192
  test_files:
234
193
  - spec/lob/errors/lob_error_spec.rb
235
194
  - spec/lob/resources/address_spec.rb
236
- - spec/lob/resources/area_spec.rb
237
195
  - spec/lob/resources/bank_account_spec.rb
238
196
  - spec/lob/resources/check_spec.rb
197
+ - spec/lob/resources/group_spec.rb
239
198
  - spec/lob/resources/intl_verifications_spec.rb
240
199
  - spec/lob/resources/letter_spec.rb
200
+ - spec/lob/resources/member_spec.rb
241
201
  - spec/lob/resources/postcard_spec.rb
242
202
  - spec/lob/resources/resource_base_spec.rb
243
- - spec/lob/resources/route_spec.rb
203
+ - spec/lob/resources/us_autocompletions_spec.rb
244
204
  - spec/lob/resources/us_verifications_spec.rb
245
205
  - spec/lob/resources/us_zip_lookups_spec.rb
246
206
  - spec/lob_spec.rb
@@ -1,33 +0,0 @@
1
- require "lob/resources/resource_base"
2
-
3
- module Lob
4
- module Resources
5
- class Route < Lob::Resources::ResourceBase
6
-
7
- undef_method :create, :destroy
8
-
9
- def initialize(config)
10
- super(config)
11
- @endpoint = "routes"
12
- end
13
-
14
- def list(options = {})
15
- if options.is_a?(String)
16
- request = {
17
- method: :get,
18
- url: resource_url(options)
19
- }
20
- else
21
- request = {
22
- method: :get,
23
- url: endpoint_url,
24
- query: options
25
- }
26
- end
27
-
28
- submit request
29
- end
30
-
31
- end
32
- end
33
- end
@@ -1,59 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Lob::Resources::Area do
4
- before :each do
5
- @sample_area_params = {
6
- description: "Test Area",
7
- front: "https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf",
8
- back: "https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf",
9
- routes: ["94158-C001", "94107-C031"],
10
- }
11
- end
12
-
13
- subject { Lob::Client.new(api_key: API_KEY) }
14
-
15
- describe "list" do
16
- it "should list areas" do
17
- assert subject.areas.list["object"] == "list"
18
- end
19
- end
20
-
21
- describe "create" do
22
- it "should create an area object" do
23
- result = subject.areas.create @sample_area_params
24
-
25
- result["object"].must_equal("area")
26
- end
27
-
28
- it "should create an area object with optionals params" do
29
- @sample_area_params[:target_type] = "all"
30
-
31
- result = subject.areas.create @sample_area_params
32
-
33
- result["description"].must_equal @sample_area_params[:description]
34
- end
35
-
36
- it "should create an area object with a single route" do
37
- @sample_area_params[:routes] = "94158-C001"
38
- result = subject.areas.create @sample_area_params
39
-
40
- result["object"].must_equal("area")
41
- end
42
-
43
- it "should create an area object with zip_codes" do
44
- @sample_area_params[:routes] = ["94158"];
45
- result = subject.areas.create @sample_area_params
46
-
47
- result["object"].must_equal("area")
48
- end
49
- end
50
-
51
- describe "find" do
52
- it "should find an area" do
53
- new_area = subject.areas.create @sample_area_params
54
-
55
- result = subject.areas.find new_area["id"]
56
- result["object"].must_equal("area")
57
- end
58
- end
59
- end
@@ -1,39 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Lob::Resources::Route do
4
-
5
- subject { Lob::Client.new(api_key: API_KEY) }
6
-
7
- describe "find" do
8
-
9
- it "should fetch a route" do
10
- zip_code = "94158"
11
- routes = subject.routes.find(zip_code)
12
- routes["zip_code"].must_equal(zip_code)
13
- end
14
-
15
- end
16
-
17
- describe "list" do
18
-
19
- it "should list routes" do
20
- zip_code = "94158"
21
- routes = subject.routes.list(zip_codes: zip_code)
22
- routes["data"][0]["zip_code"].must_equal(zip_code)
23
- end
24
-
25
- it "should accept a single ZIP code as input" do
26
- zip_code = "94158"
27
- routes = subject.routes.list(zip_code)
28
- routes["zip_code"].must_equal(zip_code)
29
- end
30
-
31
- it "should list routes given multiple zip codes" do
32
- zip_codes = ["94107", "94158"]
33
- routes = subject.routes.list(zip_codes: zip_codes)
34
- routes["data"][0]["zip_code"].must_equal(zip_codes[0])
35
- end
36
-
37
- end
38
-
39
- end