lob 1.0.5 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -0
- data/README.md +88 -32
- data/Rakefile +1 -1
- data/lib/lob/v1/bank_account.rb +1 -8
- data/lib/lob/v1/check.rb +4 -6
- data/lib/lob/v1/job.rb +4 -6
- data/lib/lob/v1/object.rb +1 -2
- data/lib/lob/v1/postcard.rb +1 -3
- data/lob.gemspec +2 -1
- data/spec/lob/v1/bank_account_spec.rb +16 -16
- data/spec/lob/v1/check_spec.rb +21 -16
- data/spec/lob/v1/job_spec.rb +38 -33
- data/spec/lob/v1/object_spec.rb +15 -15
- data/spec/lob/v1/postcard_spec.rb +14 -14
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd13287769fd6454755acf823e093f3e5959bca2
|
4
|
+
data.tar.gz: b5a6de920dc8f82c1015077dbac47e7dcba686e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e047997e2c9b3c859d045683177ace7958d9be852b352e3ab8842f18a2165991da1291460ac433e60fad59acb5d337879ab3c65e824de7771dafed3f2772805c
|
7
|
+
data.tar.gz: 5e7c5d82fdd9168544707c5f06c0fc347066e2cf619f64a0e6e70fd3e6942a654751b8833a01aa3da3606e2e6d2532e19cddec8817681186d1b5a80281d0912f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# lob-ruby
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/lob/lob-ruby.png?branch=master)](https://travis-ci.org/lob/lob-ruby)
|
4
|
+
|
3
5
|
Ruby wrapper for the [Lob.com](http://lob.com) API. This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
|
4
6
|
|
5
7
|
Supports Ruby 1.9.3 and greater.
|
@@ -25,6 +27,12 @@ You'll need a Lob.com API key. It's free and you can get yours [here](https://ww
|
|
25
27
|
|
26
28
|
For optional parameters and other details, refer the docs here - <https://lob.com/docs>
|
27
29
|
|
30
|
+
#### Caution: Pass zero-prefixed zip codes as strings
|
31
|
+
|
32
|
+
When using zip codes with zero-prefixes, always quote them. For example when specifying `02125`, pass it as a string `"02125"`, instead of an integer.
|
33
|
+
|
34
|
+
The Ruby interpreter assumes it's not of base-10 and tries to convert it to base-10 number. So that might result in an entirely different zip-code than intended.
|
35
|
+
|
28
36
|
### Initialization and configuration
|
29
37
|
|
30
38
|
```ruby
|
@@ -59,7 +67,7 @@ end
|
|
59
67
|
address_line1: "104, Printing Boulevard",
|
60
68
|
city: "Boston",
|
61
69
|
state: "MA",
|
62
|
-
country: "
|
70
|
+
country: "US",
|
63
71
|
zip: 12345
|
64
72
|
)
|
65
73
|
|
@@ -71,7 +79,7 @@ end
|
|
71
79
|
address_line2: "Sunset Town",
|
72
80
|
city: "Boston",
|
73
81
|
state: "MA",
|
74
|
-
country: "
|
82
|
+
country: "US",
|
75
83
|
zip: 12345
|
76
84
|
)
|
77
85
|
```
|
@@ -108,7 +116,7 @@ end
|
|
108
116
|
address_line1: "220 WILLIAM T MORRISSEY BLVD",
|
109
117
|
city: "Boston",
|
110
118
|
state: "MA",
|
111
|
-
zip: 02125
|
119
|
+
zip: "02125"
|
112
120
|
)
|
113
121
|
```
|
114
122
|
|
@@ -119,23 +127,40 @@ end
|
|
119
127
|
```ruby
|
120
128
|
# name, to-address and object are the arguments
|
121
129
|
# to-address can be specified as an address-id
|
122
|
-
@lob.jobs.create(
|
130
|
+
@lob.jobs.create(
|
131
|
+
name: "New Cool Posters",
|
132
|
+
from: "from-address-id",
|
133
|
+
to: "to-address-id",
|
134
|
+
objects: "object-id"
|
135
|
+
)
|
123
136
|
|
124
137
|
# to-address can also be specified as address params to create new address
|
125
138
|
@lob.jobs.create(
|
126
|
-
"New Cool Posters",
|
127
|
-
|
128
|
-
|
129
|
-
|
139
|
+
name: "New Cool Posters",
|
140
|
+
from: {
|
141
|
+
name: "FromAddress",
|
142
|
+
address_line1: "120, 6th Ave",
|
143
|
+
city: "Boston",
|
144
|
+
country: "USA",
|
145
|
+
zip: 12345
|
146
|
+
},
|
147
|
+
to: {
|
148
|
+
name: "ToAddress",
|
149
|
+
address_line1: "120, 6th Ave",
|
150
|
+
city: "Boston",
|
151
|
+
country: "USA",
|
152
|
+
zip: 12345
|
153
|
+
},
|
154
|
+
objects: "object-id"
|
130
155
|
)
|
131
156
|
|
132
157
|
# You can also pass new object params for the object
|
133
158
|
# and other options like packaging_id an setting_id
|
134
159
|
@lob.jobs.create(
|
135
|
-
"New Cool Posters",
|
136
|
-
"from-address-id",
|
137
|
-
"to-address-id",
|
138
|
-
"object-id",
|
160
|
+
name: "New Cool Posters",
|
161
|
+
from: "from-address-id",
|
162
|
+
to: "to-address-id",
|
163
|
+
objects: "object-id",
|
139
164
|
{
|
140
165
|
name: "Your fantistic object",
|
141
166
|
file: "http://test.com/file.pdf",
|
@@ -146,10 +171,16 @@ end
|
|
146
171
|
# Or add a job with multiple objects
|
147
172
|
|
148
173
|
@lob.jobs.create(
|
149
|
-
"New Cool Posters",
|
150
|
-
"from-address-id",
|
151
|
-
|
152
|
-
|
174
|
+
name: "New Cool Posters",
|
175
|
+
from: "from-address-id",
|
176
|
+
to: {
|
177
|
+
name: "ToAddress",
|
178
|
+
address_line1: "120, 6th Ave",
|
179
|
+
city: "Boston",
|
180
|
+
country: "USA",
|
181
|
+
zip: 12345
|
182
|
+
},
|
183
|
+
objects: ["object-id", "another-object-id"]
|
153
184
|
)
|
154
185
|
|
155
186
|
```
|
@@ -178,17 +209,17 @@ end
|
|
178
209
|
```ruby
|
179
210
|
# You can create by passing the name, file url and setting ID
|
180
211
|
@lob.objects.create(
|
181
|
-
"Your fantistic object",
|
182
|
-
"http://test.com/file.pdf",
|
183
|
-
"some-setting-id"
|
212
|
+
name: "Your fantistic object",
|
213
|
+
file: "http://test.com/file.pdf",
|
214
|
+
setting_id: "some-setting-id"
|
184
215
|
)
|
185
216
|
|
186
217
|
# You can also pass the quantity as an option
|
187
218
|
# Or pass a file for upload instead of a url
|
188
219
|
@lob.objects.create(
|
189
|
-
"Your fantistic object",
|
190
|
-
File.new("/path/to/file.pdf"),
|
191
|
-
"some-setting-id",
|
220
|
+
name: "Your fantistic object",
|
221
|
+
file: File.new("/path/to/file.pdf"),
|
222
|
+
setting_id: "some-setting-id",
|
192
223
|
quantity: 12
|
193
224
|
)
|
194
225
|
```
|
@@ -235,19 +266,31 @@ You'll have to specify either the `message` option or the `back` option.
|
|
235
266
|
```ruby
|
236
267
|
# accepts the name, address-id to send to and options
|
237
268
|
@lob.postcards.create(
|
238
|
-
"John Joe",
|
239
|
-
"to-address-id",
|
269
|
+
name: "John Joe",
|
270
|
+
to: "to-address-id",
|
240
271
|
message: front: File.read("/path/to/file.pdf")
|
241
272
|
)
|
242
273
|
|
243
274
|
# create using address params, front, back and from address
|
244
275
|
@lob.postcards.create(
|
245
|
-
"John Joe",
|
246
|
-
|
276
|
+
name: "John Joe",
|
277
|
+
to: {
|
278
|
+
name: "ToAddress",
|
279
|
+
address_line1: "120, 6th Ave",
|
280
|
+
city: "Boston",
|
281
|
+
country: "USA",
|
282
|
+
zip: 12345
|
283
|
+
},
|
247
284
|
message: "Hey buddy. Waiting to hear your stories",
|
248
285
|
front: "http://test.com/file.pdf",
|
249
286
|
back: File.read("/path/to/file.pdf"),
|
250
|
-
from: {
|
287
|
+
from: {
|
288
|
+
name: "FromAddress",
|
289
|
+
address_line1: "120, 6th Ave",
|
290
|
+
city: "Boston",
|
291
|
+
country: "USA",
|
292
|
+
zip: 12345
|
293
|
+
}
|
251
294
|
)
|
252
295
|
```
|
253
296
|
|
@@ -263,7 +306,7 @@ You'll have to specify either the `message` option or the `back` option.
|
|
263
306
|
#### Find a postcard
|
264
307
|
|
265
308
|
```ruby
|
266
|
-
@lob.postcards.find
|
309
|
+
@lob.postcards.find("post-card-id")
|
267
310
|
```
|
268
311
|
|
269
312
|
### Services
|
@@ -292,13 +335,18 @@ account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Bost
|
|
292
335
|
|
293
336
|
# Pass address params or address IDs
|
294
337
|
# The 5th argument is the options argument and is optional
|
295
|
-
@lob.bank_accounts.create(
|
338
|
+
@lob.bank_accounts.create(
|
339
|
+
routing_number: "routing_number",
|
340
|
+
bank_address: bank_address,
|
341
|
+
account_number: "account_number",
|
342
|
+
account_address: account_address
|
343
|
+
)
|
296
344
|
```
|
297
345
|
|
298
346
|
#### Find a bank account
|
299
347
|
|
300
348
|
```ruby
|
301
|
-
@lob.bank_accounts.find
|
349
|
+
@lob.bank_accounts.find("bank-account-id")
|
302
350
|
```
|
303
351
|
|
304
352
|
### Checks
|
@@ -307,7 +355,11 @@ account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Bost
|
|
307
355
|
|
308
356
|
```ruby
|
309
357
|
# Transfer $5000 to a bank account.
|
310
|
-
@lob.checks.create(
|
358
|
+
@lob.checks.create(
|
359
|
+
bank_account: "bank-account-id",
|
360
|
+
to: "to-address-ID",
|
361
|
+
amount: 5000
|
362
|
+
)
|
311
363
|
|
312
364
|
# For the "to" address, you can pass params or an address ID
|
313
365
|
# You can also specify an optional 4th argument, with other options.
|
@@ -339,7 +391,7 @@ account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Bost
|
|
339
391
|
Make sure you have Ruby 2.0 installed. Copy and paste the following commands in your projects directory.
|
340
392
|
|
341
393
|
git clone https://github.com/lob/lob-ruby.git
|
342
|
-
cd lob
|
394
|
+
cd lob-ruby
|
343
395
|
bundle install
|
344
396
|
|
345
397
|
You are powered up and ready to roll ~!
|
@@ -359,6 +411,10 @@ Here's how you can run the tests:
|
|
359
411
|
LOB_API_KEY=your_test_api_key bundle exec rake test
|
360
412
|
|
361
413
|
|
414
|
+
When you make changes to failed tests, then clear out the vcr cassettes to re-record the http requests. You can clear out all the cassettes by running `rm -rf spec/vcr_cassettes`.
|
415
|
+
|
416
|
+
You can also configure, TravisCI for your fork of the repository and it'll run the tests for you, when you push.
|
417
|
+
|
362
418
|
## Contributing
|
363
419
|
|
364
420
|
1. Fork it
|
data/Rakefile
CHANGED
data/lib/lob/v1/bank_account.rb
CHANGED
@@ -14,14 +14,7 @@ module Lob
|
|
14
14
|
Lob.submit :get, bank_account_url(bank_account_id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def create(
|
18
|
-
options = {
|
19
|
-
routing_number: routing_number,
|
20
|
-
bank_address: bank_address,
|
21
|
-
account_number: account_number,
|
22
|
-
account_address: account_address
|
23
|
-
}.merge(options)
|
24
|
-
|
17
|
+
def create(options = {})
|
25
18
|
if !options[:bank_address].is_a?(String)
|
26
19
|
options[:bank_address] = @resource.format_address_params(options[:bank_address])
|
27
20
|
end
|
data/lib/lob/v1/check.rb
CHANGED
@@ -14,14 +14,12 @@ module Lob
|
|
14
14
|
Lob.submit :get, check_url(check_id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def create(
|
18
|
-
|
19
|
-
|
20
|
-
if !params[:to].is_a?(String)
|
21
|
-
params[:to] = @resource.format_address_params(params[:to])
|
17
|
+
def create(options = {})
|
18
|
+
if !options[:to].is_a?(String)
|
19
|
+
options[:to] = @resource.format_address_params(options[:to])
|
22
20
|
end
|
23
21
|
|
24
|
-
Lob.submit :post, check_url,
|
22
|
+
Lob.submit :post, check_url, options
|
25
23
|
end
|
26
24
|
|
27
25
|
|
data/lib/lob/v1/job.rb
CHANGED
@@ -14,15 +14,13 @@ module Lob
|
|
14
14
|
Lob.submit :get, job_url(job_id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def create(
|
18
|
-
options
|
19
|
-
|
20
|
-
if objects.is_a?(Array)
|
21
|
-
objects.each_with_index do |object, index|
|
17
|
+
def create(options = {})
|
18
|
+
if options[:objects].is_a?(Array)
|
19
|
+
options[:objects].each_with_index do |object, index|
|
22
20
|
options["object#{index}"] = object
|
23
21
|
end
|
24
22
|
else
|
25
|
-
options["object1"] = objects
|
23
|
+
options["object1"] = options[:objects]
|
26
24
|
end
|
27
25
|
|
28
26
|
if options[:to] && !options[:to].is_a?(String)
|
data/lib/lob/v1/object.rb
CHANGED
@@ -14,8 +14,7 @@ module Lob
|
|
14
14
|
Lob.submit :get, object_url(lob_object_id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def create(
|
18
|
-
options = { name: name, file: file, setting_id: setting_id }.merge(options)
|
17
|
+
def create(options = {})
|
19
18
|
Lob.submit :post, object_url, options
|
20
19
|
end
|
21
20
|
|
data/lib/lob/v1/postcard.rb
CHANGED
@@ -14,8 +14,7 @@ module Lob
|
|
14
14
|
Lob.submit :get, postcard_url(postcard_id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def create(
|
18
|
-
options = { name: name, to: to }.merge(options)
|
17
|
+
def create(options = {})
|
19
18
|
if options[:to] && !options[:to].is_a?(String)
|
20
19
|
options[:to] = @resource.format_address_params(options[:to])
|
21
20
|
end
|
@@ -27,7 +26,6 @@ module Lob
|
|
27
26
|
Lob.submit :post, postcard_url, options
|
28
27
|
end
|
29
28
|
|
30
|
-
|
31
29
|
private
|
32
30
|
|
33
31
|
def postcard_url(postcard_id = nil)
|
data/lob.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "lob"
|
8
|
-
spec.version = "1.
|
8
|
+
spec.version = "1.1"
|
9
9
|
spec.authors = ["Akash Manohar J"]
|
10
10
|
spec.email = ["akash@akash.im"]
|
11
11
|
spec.description = %q{Lob API Ruby wrapper}
|
@@ -23,5 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "webmock", '~> 1.2'
|
26
|
+
spec.add_development_dependency "travis-lint"
|
26
27
|
spec.add_development_dependency "vcr"
|
27
28
|
end
|
@@ -27,10 +27,10 @@ describe Lob::V1::BankAccount do
|
|
27
27
|
VCR.use_cassette('list_bank_accounts') do
|
28
28
|
|
29
29
|
new_bank_account = subject.bank_accounts.create(
|
30
|
-
@sample_bank_account_params[:routing_number],
|
31
|
-
@sample_address_params.clone,
|
32
|
-
@sample_bank_account_params[:account_number],
|
33
|
-
@sample_address_params.clone
|
30
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
31
|
+
bank_address: @sample_address_params.clone,
|
32
|
+
account_number: @sample_bank_account_params[:account_number],
|
33
|
+
account_address: @sample_address_params.clone
|
34
34
|
)
|
35
35
|
|
36
36
|
list_result = subject.bank_accounts.list
|
@@ -46,10 +46,10 @@ describe Lob::V1::BankAccount do
|
|
46
46
|
new_address = subject.addresses.create @sample_address_params
|
47
47
|
|
48
48
|
result = subject.bank_accounts.create(
|
49
|
-
@sample_bank_account_params[:routing_number],
|
50
|
-
new_address["id"],
|
51
|
-
@sample_bank_account_params[:account_number],
|
52
|
-
new_address["id"]
|
49
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
50
|
+
bank_address: new_address["id"],
|
51
|
+
account_number: @sample_bank_account_params[:account_number],
|
52
|
+
account_address: new_address["id"]
|
53
53
|
)
|
54
54
|
|
55
55
|
result["account_number"].must_equal(@sample_bank_account_params[:account_number])
|
@@ -61,10 +61,10 @@ describe Lob::V1::BankAccount do
|
|
61
61
|
VCR.use_cassette('create_bank_account_with_address_params') do
|
62
62
|
|
63
63
|
result = subject.bank_accounts.create(
|
64
|
-
@sample_bank_account_params[:routing_number],
|
65
|
-
@sample_address_params.clone,
|
66
|
-
@sample_bank_account_params[:account_number],
|
67
|
-
@sample_address_params.clone
|
64
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
65
|
+
bank_address: @sample_address_params.clone,
|
66
|
+
account_number: @sample_bank_account_params[:account_number],
|
67
|
+
account_address: @sample_address_params.clone
|
68
68
|
)
|
69
69
|
|
70
70
|
result["account_number"].must_equal(@sample_bank_account_params[:account_number])
|
@@ -79,10 +79,10 @@ describe Lob::V1::BankAccount do
|
|
79
79
|
new_address = subject.addresses.create @sample_address_params
|
80
80
|
|
81
81
|
new_bank_account = subject.bank_accounts.create(
|
82
|
-
@sample_bank_account_params[:routing_number],
|
83
|
-
new_address["id"],
|
84
|
-
@sample_bank_account_params[:account_number],
|
85
|
-
new_address["id"]
|
82
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
83
|
+
bank_address: new_address["id"],
|
84
|
+
account_number: @sample_bank_account_params[:account_number],
|
85
|
+
account_address: new_address["id"]
|
86
86
|
)
|
87
87
|
|
88
88
|
result = subject.bank_accounts.find(new_bank_account["id"])
|
data/spec/lob/v1/check_spec.rb
CHANGED
@@ -28,15 +28,16 @@ describe Lob::V1::Check do
|
|
28
28
|
new_address = subject.addresses.create @sample_address_params
|
29
29
|
|
30
30
|
new_bank_account = subject.bank_accounts.create(
|
31
|
-
@sample_bank_account_params[:routing_number],
|
32
|
-
@sample_address_params,
|
33
|
-
@sample_bank_account_params[:account_number],
|
34
|
-
@sample_address_params
|
31
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
32
|
+
bank_address: @sample_address_params,
|
33
|
+
account_number: @sample_bank_account_params[:account_number],
|
34
|
+
account_address: @sample_address_params
|
35
35
|
)
|
36
36
|
|
37
|
-
|
38
37
|
new_check = subject.checks.create(
|
39
|
-
new_bank_account["id"],
|
38
|
+
bank_account: new_bank_account["id"],
|
39
|
+
to: @sample_address_params,
|
40
|
+
amount: 2000
|
40
41
|
)
|
41
42
|
|
42
43
|
list_result = subject.checks.list
|
@@ -52,14 +53,16 @@ describe Lob::V1::Check do
|
|
52
53
|
new_address = subject.addresses.create @sample_address_params
|
53
54
|
|
54
55
|
new_bank_account = subject.bank_accounts.create(
|
55
|
-
@sample_bank_account_params[:routing_number],
|
56
|
-
@sample_address_params,
|
57
|
-
@sample_bank_account_params[:account_number],
|
58
|
-
@sample_address_params
|
56
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
57
|
+
bank_address: @sample_address_params,
|
58
|
+
account_number: @sample_bank_account_params[:account_number],
|
59
|
+
account_address: @sample_address_params
|
59
60
|
)
|
60
61
|
|
61
62
|
result = subject.checks.create(
|
62
|
-
new_bank_account["id"],
|
63
|
+
bank_account: new_bank_account["id"],
|
64
|
+
to: new_address["id"],
|
65
|
+
amount: "2000"
|
63
66
|
)
|
64
67
|
|
65
68
|
result["amount"].to_s.must_equal("2000.00")
|
@@ -74,14 +77,16 @@ describe Lob::V1::Check do
|
|
74
77
|
new_address = subject.addresses.create @sample_address_params
|
75
78
|
|
76
79
|
new_bank_account = subject.bank_accounts.create(
|
77
|
-
@sample_bank_account_params[:routing_number],
|
78
|
-
@sample_address_params,
|
79
|
-
@sample_bank_account_params[:account_number],
|
80
|
-
@sample_address_params
|
80
|
+
routing_number: @sample_bank_account_params[:routing_number],
|
81
|
+
bank_address: @sample_address_params,
|
82
|
+
account_number: @sample_bank_account_params[:account_number],
|
83
|
+
account_address: @sample_address_params
|
81
84
|
)
|
82
85
|
|
83
86
|
new_check = subject.checks.create(
|
84
|
-
new_bank_account["id"],
|
87
|
+
bank_account: new_bank_account["id"],
|
88
|
+
to: new_address["id"],
|
89
|
+
amount: 2000
|
85
90
|
)
|
86
91
|
|
87
92
|
result = subject.checks.find(new_check["id"])
|
data/spec/lob/v1/job_spec.rb
CHANGED
@@ -28,16 +28,16 @@ describe Lob::V1::Job do
|
|
28
28
|
new_address = subject.addresses.create @sample_address_params
|
29
29
|
settings_list = subject.settings.list
|
30
30
|
new_object = subject.objects.create(
|
31
|
-
@sample_object_params[:name],
|
32
|
-
"https://www.lob.com/test.pdf",
|
33
|
-
@test_setting_id
|
31
|
+
name: @sample_object_params[:name],
|
32
|
+
file: "https://www.lob.com/test.pdf",
|
33
|
+
setting_id: @test_setting_id
|
34
34
|
)
|
35
35
|
|
36
36
|
new_job = subject.jobs.create(
|
37
|
-
@sample_job_params[:name],
|
38
|
-
new_address["id"],
|
39
|
-
new_address["id"],
|
40
|
-
new_object["id"]
|
37
|
+
name: @sample_job_params[:name],
|
38
|
+
from: new_address["id"],
|
39
|
+
to: new_address["id"],
|
40
|
+
objects: new_object["id"]
|
41
41
|
)
|
42
42
|
|
43
43
|
list_result = subject.jobs.list
|
@@ -54,12 +54,17 @@ describe Lob::V1::Job do
|
|
54
54
|
|
55
55
|
settings_list = subject.settings.list
|
56
56
|
new_object = subject.objects.create(
|
57
|
-
@sample_object_params[:name],
|
58
|
-
"https://www.lob.com/test.pdf",
|
59
|
-
@test_setting_id
|
57
|
+
name: @sample_object_params[:name],
|
58
|
+
file: "https://www.lob.com/test.pdf",
|
59
|
+
setting_id: @test_setting_id
|
60
60
|
)
|
61
61
|
|
62
|
-
result = subject.jobs.create(
|
62
|
+
result = subject.jobs.create(
|
63
|
+
name: @sample_job_params[:name],
|
64
|
+
from: new_address["id"],
|
65
|
+
to: new_address["id"],
|
66
|
+
objects: new_object["id"]
|
67
|
+
)
|
63
68
|
result["name"].must_equal(@sample_job_params[:name])
|
64
69
|
end
|
65
70
|
end
|
@@ -84,10 +89,10 @@ describe Lob::V1::Job do
|
|
84
89
|
}
|
85
90
|
|
86
91
|
result = subject.jobs.create(
|
87
|
-
@sample_job_params[:name],
|
88
|
-
new_address["id"],
|
89
|
-
new_address["id"],
|
90
|
-
[new_object_params, another_object_params]
|
92
|
+
name: @sample_job_params[:name],
|
93
|
+
from: new_address["id"],
|
94
|
+
to: new_address["id"],
|
95
|
+
objects: [new_object_params, another_object_params]
|
91
96
|
)
|
92
97
|
|
93
98
|
result["name"].must_equal(@sample_job_params[:name])
|
@@ -99,16 +104,16 @@ describe Lob::V1::Job do
|
|
99
104
|
VCR.use_cassette('create_job_with_address_params') do
|
100
105
|
settings_list = subject.settings.list
|
101
106
|
new_object = subject.objects.create(
|
102
|
-
@sample_object_params[:name],
|
103
|
-
"https://www.lob.com/test.pdf",
|
104
|
-
@test_setting_id
|
107
|
+
name: @sample_object_params[:name],
|
108
|
+
file: "https://www.lob.com/test.pdf",
|
109
|
+
setting_id: @test_setting_id
|
105
110
|
)
|
106
111
|
|
107
112
|
result = subject.jobs.create(
|
108
|
-
@sample_job_params[:name],
|
109
|
-
@sample_address_params,
|
110
|
-
@sample_address_params,
|
111
|
-
new_object["id"]
|
113
|
+
name: @sample_job_params[:name],
|
114
|
+
from: @sample_address_params,
|
115
|
+
to: @sample_address_params,
|
116
|
+
objects: new_object["id"]
|
112
117
|
)
|
113
118
|
result["name"].must_equal(@sample_job_params[:name])
|
114
119
|
end
|
@@ -126,10 +131,10 @@ describe Lob::V1::Job do
|
|
126
131
|
}
|
127
132
|
|
128
133
|
result = subject.jobs.create(
|
129
|
-
@sample_job_params[:name],
|
130
|
-
new_address["id"],
|
131
|
-
new_address["id"],
|
132
|
-
new_object_params
|
134
|
+
name: @sample_job_params[:name],
|
135
|
+
from: new_address["id"],
|
136
|
+
to: new_address["id"],
|
137
|
+
objects: new_object_params
|
133
138
|
)
|
134
139
|
result["name"].must_equal(@sample_job_params[:name])
|
135
140
|
end
|
@@ -144,16 +149,16 @@ describe Lob::V1::Job do
|
|
144
149
|
|
145
150
|
settings_list = subject.settings.list
|
146
151
|
new_object = subject.objects.create(
|
147
|
-
@sample_object_params[:name],
|
148
|
-
"https://www.lob.com/test.pdf",
|
149
|
-
@test_setting_id
|
152
|
+
name: @sample_object_params[:name],
|
153
|
+
file: "https://www.lob.com/test.pdf",
|
154
|
+
setting_id: @test_setting_id
|
150
155
|
)
|
151
156
|
|
152
157
|
new_job = subject.jobs.create(
|
153
|
-
@sample_job_params[:name],
|
154
|
-
new_address["id"],
|
155
|
-
new_address["id"],
|
156
|
-
new_object["id"]
|
158
|
+
name: @sample_job_params[:name],
|
159
|
+
from: new_address["id"],
|
160
|
+
to: new_address["id"],
|
161
|
+
objects: new_object["id"]
|
157
162
|
)
|
158
163
|
|
159
164
|
result = subject.jobs.find(new_job["id"])
|
data/spec/lob/v1/object_spec.rb
CHANGED
@@ -17,9 +17,9 @@ describe Lob::V1::Object do
|
|
17
17
|
VCR.use_cassette('list_objects') do
|
18
18
|
settings_list = subject.settings.list
|
19
19
|
new_object = subject.objects.create(
|
20
|
-
@sample_params[:name],
|
21
|
-
"https://www.lob.com/test.pdf",
|
22
|
-
@test_setting_id
|
20
|
+
name: @sample_params[:name],
|
21
|
+
file: "https://www.lob.com/test.pdf",
|
22
|
+
setting_id: @test_setting_id
|
23
23
|
)
|
24
24
|
|
25
25
|
list_result = subject.objects.list
|
@@ -34,9 +34,9 @@ describe Lob::V1::Object do
|
|
34
34
|
VCR.use_cassette('create_object_with_url') do
|
35
35
|
settings_list = subject.settings.list
|
36
36
|
result = subject.objects.create(
|
37
|
-
@sample_params[:name],
|
38
|
-
"https://www.lob.com/test.pdf",
|
39
|
-
@test_setting_id
|
37
|
+
name: @sample_params[:name],
|
38
|
+
file: "https://www.lob.com/test.pdf",
|
39
|
+
setting_id: @test_setting_id
|
40
40
|
)
|
41
41
|
|
42
42
|
result["name"].must_equal(@sample_params[:name])
|
@@ -47,9 +47,9 @@ describe Lob::V1::Object do
|
|
47
47
|
VCR.use_cassette('create_object_with_file') do
|
48
48
|
settings_list = subject.settings.list
|
49
49
|
result = subject.objects.create(
|
50
|
-
@sample_params[:name],
|
51
|
-
File.new(File.expand_path("../../../samples/test.pdf", __FILE__), "rb"),
|
52
|
-
@test_setting_id
|
50
|
+
name: @sample_params[:name],
|
51
|
+
file: File.new(File.expand_path("../../../samples/test.pdf", __FILE__), "rb"),
|
52
|
+
setting_id: @test_setting_id
|
53
53
|
)
|
54
54
|
|
55
55
|
result["name"].must_equal(@sample_params[:name])
|
@@ -63,9 +63,9 @@ describe Lob::V1::Object do
|
|
63
63
|
VCR.use_cassette('find_object') do
|
64
64
|
settings_list = subject.settings.list
|
65
65
|
new_object = subject.objects.create(
|
66
|
-
@sample_params[:name],
|
67
|
-
"https://www.lob.com/test.pdf",
|
68
|
-
@test_setting_id
|
66
|
+
name: @sample_params[:name],
|
67
|
+
file: "https://www.lob.com/test.pdf",
|
68
|
+
setting_id: @test_setting_id
|
69
69
|
)
|
70
70
|
|
71
71
|
find_result = subject.objects.find(new_object["id"])
|
@@ -80,9 +80,9 @@ describe Lob::V1::Object do
|
|
80
80
|
VCR.use_cassette('delete_object') do
|
81
81
|
settings_list = subject.settings.list
|
82
82
|
new_object = subject.objects.create(
|
83
|
-
@sample_params[:name],
|
84
|
-
"https://www.lob.com/test.pdf",
|
85
|
-
@test_setting_id
|
83
|
+
name: @sample_params[:name],
|
84
|
+
file: "https://www.lob.com/test.pdf",
|
85
|
+
setting_id: @test_setting_id
|
86
86
|
)
|
87
87
|
|
88
88
|
delete_result = subject.objects.destroy(new_object["id"])
|
@@ -28,8 +28,8 @@ describe Lob::V1::Postcard do
|
|
28
28
|
new_address = subject.addresses.create @sample_address_params
|
29
29
|
|
30
30
|
new_postcard = subject.postcards.create(
|
31
|
-
@sample_postcard_params[:name],
|
32
|
-
new_address["id"],
|
31
|
+
name: @sample_postcard_params[:name],
|
32
|
+
to: new_address["id"],
|
33
33
|
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__), "rb"),
|
34
34
|
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
|
35
35
|
)
|
@@ -47,8 +47,8 @@ describe Lob::V1::Postcard do
|
|
47
47
|
new_address = subject.addresses.create @sample_address_params
|
48
48
|
|
49
49
|
result = subject.postcards.create(
|
50
|
-
@sample_postcard_params[:name],
|
51
|
-
new_address["id"],
|
50
|
+
name: @sample_postcard_params[:name],
|
51
|
+
to: new_address["id"],
|
52
52
|
message: @sample_postcard_params[:message],
|
53
53
|
front: "https://www.lob.com/postcardfront.pdf",
|
54
54
|
)
|
@@ -62,8 +62,8 @@ describe Lob::V1::Postcard do
|
|
62
62
|
VCR.use_cassette('create_postcard_with_address_params') do
|
63
63
|
|
64
64
|
result = subject.postcards.create(
|
65
|
-
@sample_postcard_params[:name],
|
66
|
-
@sample_address_params,
|
65
|
+
name: @sample_postcard_params[:name],
|
66
|
+
to: @sample_address_params,
|
67
67
|
message: @sample_postcard_params[:message],
|
68
68
|
front: "https://www.lob.com/postcardfront.pdf"
|
69
69
|
)
|
@@ -76,10 +76,10 @@ describe Lob::V1::Postcard do
|
|
76
76
|
it "should create a postcard with front and back as urls" do
|
77
77
|
VCR.use_cassette('create_postcard_with_front_and_back_urls') do
|
78
78
|
new_address = subject.addresses.create @sample_address_params
|
79
|
-
|
79
|
+
|
80
80
|
result = subject.postcards.create(
|
81
|
-
@sample_postcard_params[:name],
|
82
|
-
new_address["id"],
|
81
|
+
name: @sample_postcard_params[:name],
|
82
|
+
to: new_address["id"],
|
83
83
|
front: "https://www.lob.com/postcardfront.pdf",
|
84
84
|
back: "https://www.lob.com/postcardback.pdf"
|
85
85
|
)
|
@@ -92,10 +92,10 @@ describe Lob::V1::Postcard do
|
|
92
92
|
it "should create a postcard with front and back as PDFs" do
|
93
93
|
VCR.use_cassette('create_postcard_with_front_and_back_pdfs') do
|
94
94
|
new_address = subject.addresses.create @sample_address_params
|
95
|
-
|
95
|
+
|
96
96
|
result = subject.postcards.create(
|
97
|
-
@sample_postcard_params[:name],
|
98
|
-
new_address["id"],
|
97
|
+
name: @sample_postcard_params[:name],
|
98
|
+
to: new_address["id"],
|
99
99
|
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__), "rb"),
|
100
100
|
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
|
101
101
|
)
|
@@ -113,8 +113,8 @@ describe Lob::V1::Postcard do
|
|
113
113
|
new_address = subject.addresses.create @sample_address_params
|
114
114
|
|
115
115
|
new_postcard = subject.postcards.create(
|
116
|
-
@sample_postcard_params[:name],
|
117
|
-
new_address["id"],
|
116
|
+
name: @sample_postcard_params[:name],
|
117
|
+
to: new_address["id"],
|
118
118
|
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__), "rb"),
|
119
119
|
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
|
120
120
|
)
|
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: 1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akash Manohar J
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: travis-lint
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: vcr
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +102,7 @@ extensions: []
|
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
104
|
- .gitignore
|
105
|
+
- .travis.yml
|
91
106
|
- Gemfile
|
92
107
|
- LICENSE.txt
|
93
108
|
- README.md
|