lob 4.3.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -10
  3. data/CHANGELOG.md +30 -0
  4. data/README.md +15 -20
  5. data/examples/README.md +4 -0
  6. data/examples/checks.rb +1 -1
  7. data/examples/csv_checks/create_checks.rb +1 -1
  8. data/examples/csv_letters/create_letters.rb +1 -1
  9. data/examples/csv_letters/letter_template.html +1 -1
  10. data/examples/csv_postcards/create_postcards.rb +1 -1
  11. data/examples/csv_postcards/input.csv +7 -7
  12. data/examples/csv_postcards/postcard_back.html +1 -1
  13. data/examples/csv_verify/verify.rb +1 -1
  14. data/examples/letters.rb +2 -2
  15. data/examples/postcards.rb +3 -3
  16. data/examples/self_mailers.rb +37 -0
  17. data/lib/lob/client.rb +13 -8
  18. data/lib/lob/resources/{area.rb → group.rb} +2 -4
  19. data/lib/lob/resources/groups_member.rb +66 -0
  20. data/lib/lob/resources/resource_base.rb +8 -5
  21. data/lib/lob/resources/self_mailer.rb +14 -0
  22. data/lib/lob/version.rb +1 -1
  23. data/lob.gemspec +4 -7
  24. data/spec/lob/resources/check_spec.rb +21 -0
  25. data/spec/lob/resources/group_spec.rb +50 -0
  26. data/spec/lob/resources/intl_verifications_spec.rb +4 -7
  27. data/spec/lob/resources/letter_spec.rb +24 -4
  28. data/spec/lob/resources/member_spec.rb +65 -0
  29. data/spec/lob/resources/postcard_spec.rb +30 -5
  30. data/spec/lob/resources/resource_base_spec.rb +4 -16
  31. data/spec/lob/resources/self_mailer_spec.rb +177 -0
  32. data/spec/samples/sfm-12x9-inside.pdf +0 -0
  33. data/spec/samples/sfm-12x9-outside.pdf +0 -0
  34. data/spec/samples/sfm-6x18-inside.pdf +0 -0
  35. data/spec/samples/sfm-6x18-outside.pdf +0 -0
  36. data/spec/spec_helper.rb +3 -3
  37. metadata +29 -60
  38. data/lib/lob/resources/route.rb +0 -33
  39. data/spec/lob/resources/area_spec.rb +0 -59
  40. data/spec/lob/resources/route_spec.rb +0 -39
Binary file
Binary file
Binary file
Binary file
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.3.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2021-05-03 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
@@ -172,19 +130,21 @@ files:
172
130
  - examples/csv_verify/verify.rb
173
131
  - examples/letters.rb
174
132
  - examples/postcards.rb
133
+ - examples/self_mailers.rb
175
134
  - lib/lob.rb
176
135
  - lib/lob/client.rb
177
136
  - lib/lob/errors/invalid_request_error.rb
178
137
  - lib/lob/errors/lob_error.rb
179
138
  - lib/lob/resources/address.rb
180
- - lib/lob/resources/area.rb
181
139
  - lib/lob/resources/bank_account.rb
182
140
  - lib/lob/resources/check.rb
141
+ - lib/lob/resources/group.rb
142
+ - lib/lob/resources/groups_member.rb
183
143
  - lib/lob/resources/intl_verifications.rb
184
144
  - lib/lob/resources/letter.rb
185
145
  - lib/lob/resources/postcard.rb
186
146
  - lib/lob/resources/resource_base.rb
187
- - lib/lob/resources/route.rb
147
+ - lib/lob/resources/self_mailer.rb
188
148
  - lib/lob/resources/us_autocompletions.rb
189
149
  - lib/lob/resources/us_verifications.rb
190
150
  - lib/lob/resources/us_zip_lookups.rb
@@ -192,14 +152,15 @@ files:
192
152
  - lob.gemspec
193
153
  - spec/lob/errors/lob_error_spec.rb
194
154
  - spec/lob/resources/address_spec.rb
195
- - spec/lob/resources/area_spec.rb
196
155
  - spec/lob/resources/bank_account_spec.rb
197
156
  - spec/lob/resources/check_spec.rb
157
+ - spec/lob/resources/group_spec.rb
198
158
  - spec/lob/resources/intl_verifications_spec.rb
199
159
  - spec/lob/resources/letter_spec.rb
160
+ - spec/lob/resources/member_spec.rb
200
161
  - spec/lob/resources/postcard_spec.rb
201
162
  - spec/lob/resources/resource_base_spec.rb
202
- - spec/lob/resources/route_spec.rb
163
+ - spec/lob/resources/self_mailer_spec.rb
203
164
  - spec/lob/resources/us_autocompletions_spec.rb
204
165
  - spec/lob/resources/us_verifications_spec.rb
205
166
  - spec/lob/resources/us_zip_lookups_spec.rb
@@ -207,6 +168,10 @@ files:
207
168
  - spec/samples/8.5x11.pdf
208
169
  - spec/samples/postcardback.pdf
209
170
  - spec/samples/postcardfront.pdf
171
+ - spec/samples/sfm-12x9-inside.pdf
172
+ - spec/samples/sfm-12x9-outside.pdf
173
+ - spec/samples/sfm-6x18-inside.pdf
174
+ - spec/samples/sfm-6x18-outside.pdf
210
175
  - spec/spec_helper.rb
211
176
  homepage: https://github.com/lob/lob-ruby
212
177
  licenses:
@@ -227,22 +192,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
192
  - !ruby/object:Gem::Version
228
193
  version: '0'
229
194
  requirements: []
230
- rubyforge_project:
231
- rubygems_version: 2.7.7
195
+ rubygems_version: 3.0.3
232
196
  signing_key:
233
197
  specification_version: 4
234
198
  summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax
235
199
  test_files:
236
200
  - spec/lob/errors/lob_error_spec.rb
237
201
  - spec/lob/resources/address_spec.rb
238
- - spec/lob/resources/area_spec.rb
239
202
  - spec/lob/resources/bank_account_spec.rb
240
203
  - spec/lob/resources/check_spec.rb
204
+ - spec/lob/resources/group_spec.rb
241
205
  - spec/lob/resources/intl_verifications_spec.rb
242
206
  - spec/lob/resources/letter_spec.rb
207
+ - spec/lob/resources/member_spec.rb
243
208
  - spec/lob/resources/postcard_spec.rb
244
209
  - spec/lob/resources/resource_base_spec.rb
245
- - spec/lob/resources/route_spec.rb
210
+ - spec/lob/resources/self_mailer_spec.rb
246
211
  - spec/lob/resources/us_autocompletions_spec.rb
247
212
  - spec/lob/resources/us_verifications_spec.rb
248
213
  - spec/lob/resources/us_zip_lookups_spec.rb
@@ -250,4 +215,8 @@ test_files:
250
215
  - spec/samples/8.5x11.pdf
251
216
  - spec/samples/postcardback.pdf
252
217
  - spec/samples/postcardfront.pdf
218
+ - spec/samples/sfm-12x9-inside.pdf
219
+ - spec/samples/sfm-12x9-outside.pdf
220
+ - spec/samples/sfm-6x18-inside.pdf
221
+ - spec/samples/sfm-6x18-outside.pdf
253
222
  - spec/spec_helper.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