lob 1.8 → 1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +53 -44
- data/examples/checks.rb +1 -0
- data/examples/create_pdf.rb +1 -1
- data/examples/jobs.rb +1 -1
- data/lib/lob/version.rb +1 -1
- data/lob.gemspec +2 -2
- data/spec/lob/v1/bank_account_spec.rb +10 -5
- data/spec/lob/v1/check_spec.rb +6 -3
- data/spec/lob/v1/job_spec.rb +17 -17
- data/spec/lob/v1/object_spec.rb +4 -18
- data/spec/lob_spec.rb +6 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74f9905edbe7eab01d1846eb252742078a8c8f1c
|
4
|
+
data.tar.gz: 9806e7634aced9b07deeebab5aacbaaf4c89af9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 738fcbbaf6f1133a1e007da326e8262cda4db77cde4d1c78bde2634259a55a3744f6cad91378167223f555a236f4fd188e709f6fa86dd69c1861a8deebb0c402
|
7
|
+
data.tar.gz: 2ca3f28e17083574efd9cadd198d33e542cd0aa3ac3154f2ca2041ecb3f3bb86fb350a54cf746bc74ce09f54108661819bbc47abec923ba23833cfe3f2714a36
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [**1.9**](https://github.com/lob/lob-ruby/releases/tag/v1.8)
|
2
|
+
- [**#88**] (https://github.com/lob/lob-ruby/pull/88) default prawn to 1.3.0 for ruby 1.9.3
|
3
|
+
- [**#91**] (https://github.com/lob/lob-ruby/pull/91) reduce strictness of rest-client version
|
4
|
+
|
1
5
|
## [**1.8**](https://github.com/lob/lob-ruby/releases/tag/v1.8)
|
2
6
|
- [**#69**] (https://github.com/lob/lob-ruby/pull/69) fixed spelling in documentation
|
3
7
|
- [**#71**] (https://github.com/lob/lob-ruby/pull/71) fixed syntax in documentation
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# lob-ruby
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lob/lob-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/lob/lob-ruby.svg?branch=master)](https://travis-ci.org/lob/lob-ruby) [![Gem Version](https://badge.fury.io/rb/lob.svg)](http://badge.fury.io/rb/lob) [![Dependency Status](https://gemnasium.com/lob/lob-ruby.svg)](https://gemnasium.com/lob/lob-ruby) [![Coverage Status](https://coveralls.io/repos/lob/lob-ruby/badge.svg?branch=master)](https://coveralls.io/r/lob/lob-ruby?branch=master) [![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/lob?color=green&type=total)](https://rubygems.org/gems/lob)
|
4
6
|
|
5
7
|
Ruby wrapper for the [Lob.com](http://lob.com) API. This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
|
6
8
|
|
@@ -34,9 +36,9 @@ Or manually install it yourself:
|
|
34
36
|
## Usage
|
35
37
|
|
36
38
|
The library uses an ActiveRecord-style interface. You'll feel right at home.
|
37
|
-
You'll need a Lob.com API key. It's free and you can get yours [here](https://dashboard.lob.com/
|
39
|
+
You'll need a Lob.com API key. It's free and you can get yours [here](https://dashboard.lob.com/settings).
|
38
40
|
|
39
|
-
For optional parameters and other details, refer the docs here
|
41
|
+
For optional parameters and other details, refer to the docs [here](https://lob.com/docs/ruby).
|
40
42
|
|
41
43
|
#### Caution: Pass zero-prefixed zip codes as strings
|
42
44
|
|
@@ -46,17 +48,23 @@ The Ruby interpreter assumes it's not of base-10 and tries to convert it to base
|
|
46
48
|
|
47
49
|
## Supported Image Types
|
48
50
|
|
49
|
-
The
|
51
|
+
The Lob.com API supports the following image types:
|
50
52
|
|
51
53
|
- PDF
|
52
54
|
- PNG
|
53
55
|
- JPEG
|
54
56
|
|
55
|
-
For more information on prepping
|
57
|
+
For more information on prepping images please see the [Lob documentation](https://lob.com/docs/ruby#prepping).
|
56
58
|
|
57
59
|
#### Creating a PDF
|
58
60
|
|
59
|
-
If you need to generate your own PDF programmatically we recommend using [prawn](https://github.com/prawnpdf/prawn). There is an example provided in the examples folder [here](examples/create_pdf.rb)
|
61
|
+
If you need to generate your own PDF programmatically we recommend using [prawn](https://github.com/prawnpdf/prawn). There is an example provided in the examples folder [here](examples/create_pdf.rb).
|
62
|
+
|
63
|
+
## HTML Support
|
64
|
+
|
65
|
+
The Lob.com API also supports HTML strings in leiu of a file of the above type. See below for examples of submitting with HTML strings.
|
66
|
+
|
67
|
+
For templates and more information regarding HTML, please see the [Lob documentation](https://lob.com/docs/ruby#html-fonts).
|
60
68
|
|
61
69
|
## Initialization and Configuration
|
62
70
|
|
@@ -99,8 +107,6 @@ end
|
|
99
107
|
- [lob.settings](#lobsettings)
|
100
108
|
- [lob.settings.list](#lobsettingslist)
|
101
109
|
- [lob.settings.find](#lobsettingsfind)
|
102
|
-
- [lob.packagings](#lobpackagings)
|
103
|
-
- [lob.packagings.list](#lobpackagingslist)
|
104
110
|
- [lob.services](#lobservices)
|
105
111
|
- [lob.services.list](#lobserviceslist)
|
106
112
|
- [Simple Postcard Service](#simple-postcard-service)
|
@@ -165,7 +171,7 @@ end
|
|
165
171
|
objects: {
|
166
172
|
name: "Local File Object",
|
167
173
|
file: File.new("/path/to/file.pdf"),
|
168
|
-
|
174
|
+
setting: 100
|
169
175
|
})
|
170
176
|
|
171
177
|
|
@@ -194,7 +200,7 @@ end
|
|
194
200
|
)
|
195
201
|
|
196
202
|
# You can also pass new object params for the object
|
197
|
-
# and other options like
|
203
|
+
# and other options like setting
|
198
204
|
@lob.jobs.create(
|
199
205
|
name: "New Cool Posters",
|
200
206
|
from: "from-address-id",
|
@@ -203,7 +209,7 @@ end
|
|
203
209
|
{
|
204
210
|
name: "Your fantistic object",
|
205
211
|
file: "http://test.com/file.pdf",
|
206
|
-
|
212
|
+
setting: "some-setting"
|
207
213
|
}
|
208
214
|
)
|
209
215
|
|
@@ -303,21 +309,28 @@ end
|
|
303
309
|
#### lob.objects.create
|
304
310
|
|
305
311
|
```ruby
|
306
|
-
# You can create an
|
312
|
+
# You can create an object by passing the name, file url and setting ID, quantity is defaulted to 1
|
307
313
|
@lob.objects.create(
|
308
|
-
name: "Your
|
314
|
+
name: "Your fantastic object",
|
309
315
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
310
|
-
|
316
|
+
setting: "201"
|
311
317
|
)
|
312
318
|
|
313
319
|
# You can also pass the quantity as an option
|
314
320
|
# Or pass a file for upload instead of a url
|
315
321
|
@lob.objects.create(
|
316
|
-
name: "Your
|
322
|
+
name: "Your fantastic object",
|
317
323
|
file: File.new("/path/to/file.pdf"),
|
318
|
-
|
324
|
+
setting: "some-setting",
|
319
325
|
quantity: 12
|
320
326
|
)
|
327
|
+
|
328
|
+
# You can also pass an HTML string instead of a file
|
329
|
+
@lob.objects.create(
|
330
|
+
name: "Your fantastic object",
|
331
|
+
file: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
332
|
+
setting: "some-setting"
|
333
|
+
)
|
321
334
|
```
|
322
335
|
|
323
336
|
#### lob.objects.list
|
@@ -355,16 +368,7 @@ end
|
|
355
368
|
#### lob.settings.find
|
356
369
|
```ruby
|
357
370
|
# returns a setting object
|
358
|
-
@lob.settings.find("
|
359
|
-
```
|
360
|
-
|
361
|
-
### lob.packagings
|
362
|
-
|
363
|
-
#### lob.packagings.list
|
364
|
-
|
365
|
-
```ruby
|
366
|
-
# returns a list of packagings
|
367
|
-
@lob.packagings.list
|
371
|
+
@lob.settings.find("setting")
|
368
372
|
```
|
369
373
|
|
370
374
|
### lob.services
|
@@ -386,8 +390,8 @@ You'll have to specify either the `message` option or the `back` option.
|
|
386
390
|
|
387
391
|
```ruby
|
388
392
|
|
393
|
+
# create postcard with message
|
389
394
|
|
390
|
-
# create postcard with complete customization
|
391
395
|
@lob.postcards.create(
|
392
396
|
name: "John Joe",
|
393
397
|
to: {
|
@@ -405,13 +409,13 @@ You'll have to specify either the `message` option or the `back` option.
|
|
405
409
|
state: "MA",
|
406
410
|
country: "US",
|
407
411
|
zip: 12345
|
408
|
-
}
|
409
|
-
front: "https://
|
410
|
-
|
412
|
+
},
|
413
|
+
front: "https://lob.com/postcardfront.pdf",
|
414
|
+
message: "Hey Buddy, Thanks for Visiting",
|
415
|
+
full_bleed: 1
|
411
416
|
)
|
412
417
|
|
413
|
-
# create postcard with
|
414
|
-
|
418
|
+
# create postcard with your own back, adhering to lob's template
|
415
419
|
@lob.postcards.create(
|
416
420
|
name: "John Joe",
|
417
421
|
to: {
|
@@ -429,17 +433,19 @@ You'll have to specify either the `message` option or the `back` option.
|
|
429
433
|
state: "MA",
|
430
434
|
country: "US",
|
431
435
|
zip: 12345
|
432
|
-
}
|
433
|
-
front: "https://
|
434
|
-
|
436
|
+
},
|
437
|
+
front: "https://lob.com/postcardfront.pdf",
|
438
|
+
back: File.new("/path/to/file.pdf"),
|
439
|
+
full_bleed: 1,
|
440
|
+
template: 1
|
435
441
|
)
|
436
442
|
|
437
|
-
#
|
443
|
+
# create postcard with HTML string & a stored address id
|
438
444
|
@lob.postcards.create(
|
439
445
|
name: "John Joe",
|
440
446
|
to: "to-address-id",
|
441
|
-
|
442
|
-
|
447
|
+
front: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
448
|
+
message: "Hey buddy. Waiting to hear your stories."
|
443
449
|
)
|
444
450
|
```
|
445
451
|
|
@@ -477,14 +483,16 @@ You'll have to specify either the `message` option or the `back` option.
|
|
477
483
|
country: "US",
|
478
484
|
zip: 12345
|
479
485
|
},
|
480
|
-
amount: 5000
|
486
|
+
amount: 5000,
|
487
|
+
logo: "https://s3-us-west-2.amazonaws.com/lob-assets/lob_check_logo.png" # optional
|
481
488
|
)
|
482
489
|
|
483
490
|
# or an address ID
|
484
491
|
@lob.checks.create(
|
485
492
|
bank_account: "bank-account-id",
|
486
493
|
to: "to-address-ID",
|
487
|
-
amount: 5000
|
494
|
+
amount: 5000,
|
495
|
+
logo: "https://s3-us-west-2.amazonaws.com/lob-assets/lob_check_logo.png" # optional
|
488
496
|
)
|
489
497
|
|
490
498
|
# You can also specify an optional 4th argument, with other options.
|
@@ -516,6 +524,7 @@ account_address =
|
|
516
524
|
@lob.bank_accounts.create(
|
517
525
|
routing_number: "routing_number",
|
518
526
|
account_number: "account_number",
|
527
|
+
signatory: "John Doe",
|
519
528
|
bank_address: {
|
520
529
|
name: "ToAddress",
|
521
530
|
address_line1: "120 6th Ave",
|
@@ -555,7 +564,7 @@ account_address =
|
|
555
564
|
You'll have to specify front, back, and either zip_codes or routes
|
556
565
|
|
557
566
|
```ruby
|
558
|
-
# create an area request with routes
|
567
|
+
# create an area request with remote files & with routes
|
559
568
|
@lob.areas.create(
|
560
569
|
name: "My Area",
|
561
570
|
front: "https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf",
|
@@ -565,11 +574,11 @@ You'll have to specify front, back, and either zip_codes or routes
|
|
565
574
|
full_bleed: "1"
|
566
575
|
)
|
567
576
|
|
568
|
-
# create an area request with
|
577
|
+
# create an area request with HTML & with zip codes
|
569
578
|
@lob.areas.create(
|
570
579
|
name: "My Area",
|
571
|
-
front: "
|
572
|
-
back: "
|
580
|
+
front: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
581
|
+
back: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
573
582
|
zip_codes: ["95678", "94158"],
|
574
583
|
target_type: "all",
|
575
584
|
full_bleed: "1"
|
data/examples/checks.rb
CHANGED
data/examples/create_pdf.rb
CHANGED
data/examples/jobs.rb
CHANGED
@@ -14,7 +14,7 @@ setting_id = settings[setting_index]["id"]
|
|
14
14
|
michigan_logo = @lob.objects.create(
|
15
15
|
name: "Michigan Logo Document",
|
16
16
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/goblue.pdf",
|
17
|
-
|
17
|
+
setting: 101
|
18
18
|
)
|
19
19
|
|
20
20
|
# create a to address
|
data/lib/lob/version.rb
CHANGED
data/lob.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "rest-client", "~> 1.7
|
21
|
+
spec.add_dependency "rest-client", "~> 1.7"
|
22
22
|
|
23
|
-
spec.add_dependency "prawn", "
|
23
|
+
spec.add_dependency "prawn", "~> 1.3.0"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.3.2"
|
@@ -30,7 +30,8 @@ describe Lob::V1::BankAccount do
|
|
30
30
|
routing_number: @sample_bank_account_params[:routing_number],
|
31
31
|
bank_address: @sample_address_params.clone,
|
32
32
|
account_number: @sample_bank_account_params[:account_number],
|
33
|
-
account_address: @sample_address_params.clone
|
33
|
+
account_address: @sample_address_params.clone,
|
34
|
+
signatory: "John Doe"
|
34
35
|
)
|
35
36
|
|
36
37
|
list_result = subject.bank_accounts.list
|
@@ -49,7 +50,8 @@ describe Lob::V1::BankAccount do
|
|
49
50
|
routing_number: @sample_bank_account_params[:routing_number],
|
50
51
|
bank_address: new_address["id"],
|
51
52
|
account_number: @sample_bank_account_params[:account_number],
|
52
|
-
account_address: new_address["id"]
|
53
|
+
account_address: new_address["id"],
|
54
|
+
signatory: "John Doe"
|
53
55
|
)
|
54
56
|
|
55
57
|
result["account_number"].must_equal(@sample_bank_account_params[:account_number])
|
@@ -64,7 +66,8 @@ describe Lob::V1::BankAccount do
|
|
64
66
|
routing_number: @sample_bank_account_params[:routing_number],
|
65
67
|
bank_address: @sample_address_params.clone,
|
66
68
|
account_number: @sample_bank_account_params[:account_number],
|
67
|
-
account_address: @sample_address_params.clone
|
69
|
+
account_address: @sample_address_params.clone,
|
70
|
+
signatory: "John Doe"
|
68
71
|
)
|
69
72
|
|
70
73
|
result["account_number"].must_equal(@sample_bank_account_params[:account_number])
|
@@ -82,7 +85,8 @@ describe Lob::V1::BankAccount do
|
|
82
85
|
routing_number: @sample_bank_account_params[:routing_number],
|
83
86
|
bank_address: new_address["id"],
|
84
87
|
account_number: @sample_bank_account_params[:account_number],
|
85
|
-
account_address: new_address["id"]
|
88
|
+
account_address: new_address["id"],
|
89
|
+
signatory: "John Doe"
|
86
90
|
)
|
87
91
|
|
88
92
|
result = subject.bank_accounts.find(new_bank_account["id"])
|
@@ -98,7 +102,8 @@ describe Lob::V1::BankAccount do
|
|
98
102
|
routing_number: @sample_bank_account_params[:routing_number],
|
99
103
|
bank_address: @sample_address_params.clone,
|
100
104
|
account_number: @sample_bank_account_params[:account_number],
|
101
|
-
account_address: @sample_address_params.clone
|
105
|
+
account_address: @sample_address_params.clone,
|
106
|
+
signatory: "John Doe"
|
102
107
|
)
|
103
108
|
|
104
109
|
delete_result = subject.bank_accounts.destroy(new_bank_account["id"])
|
data/spec/lob/v1/check_spec.rb
CHANGED
@@ -31,7 +31,8 @@ describe Lob::V1::Check do
|
|
31
31
|
routing_number: @sample_bank_account_params[:routing_number],
|
32
32
|
bank_address: @sample_address_params,
|
33
33
|
account_number: @sample_bank_account_params[:account_number],
|
34
|
-
account_address: @sample_address_params
|
34
|
+
account_address: @sample_address_params,
|
35
|
+
signatory: "John Doe"
|
35
36
|
)
|
36
37
|
|
37
38
|
new_check = subject.checks.create(
|
@@ -56,7 +57,8 @@ describe Lob::V1::Check do
|
|
56
57
|
routing_number: @sample_bank_account_params[:routing_number],
|
57
58
|
bank_address: @sample_address_params,
|
58
59
|
account_number: @sample_bank_account_params[:account_number],
|
59
|
-
account_address: @sample_address_params
|
60
|
+
account_address: @sample_address_params,
|
61
|
+
signatory: "John Doe"
|
60
62
|
)
|
61
63
|
|
62
64
|
result = subject.checks.create(
|
@@ -80,7 +82,8 @@ describe Lob::V1::Check do
|
|
80
82
|
routing_number: @sample_bank_account_params[:routing_number],
|
81
83
|
bank_address: @sample_address_params,
|
82
84
|
account_number: @sample_bank_account_params[:account_number],
|
83
|
-
account_address: @sample_address_params
|
85
|
+
account_address: @sample_address_params,
|
86
|
+
signatory: "John Doe"
|
84
87
|
)
|
85
88
|
|
86
89
|
new_check = subject.checks.create(
|
data/spec/lob/v1/job_spec.rb
CHANGED
@@ -30,7 +30,7 @@ describe Lob::V1::Job do
|
|
30
30
|
new_object = subject.objects.create(
|
31
31
|
name: @sample_object_params[:name],
|
32
32
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
33
|
-
|
33
|
+
setting: @test_setting_id
|
34
34
|
)
|
35
35
|
|
36
36
|
new_job = subject.jobs.create(
|
@@ -56,7 +56,7 @@ describe Lob::V1::Job do
|
|
56
56
|
new_object = subject.objects.create(
|
57
57
|
name: @sample_object_params[:name],
|
58
58
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
59
|
-
|
59
|
+
setting: @test_setting_id
|
60
60
|
)
|
61
61
|
|
62
62
|
result = subject.jobs.create(
|
@@ -77,15 +77,15 @@ describe Lob::V1::Job do
|
|
77
77
|
settings_list = subject.settings.list
|
78
78
|
|
79
79
|
new_object_params = {
|
80
|
-
name:
|
81
|
-
file:
|
82
|
-
|
80
|
+
name: @sample_object_params[:name],
|
81
|
+
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
82
|
+
setting: 500
|
83
83
|
}
|
84
84
|
|
85
85
|
another_object_params = {
|
86
|
-
name:
|
87
|
-
file:
|
88
|
-
|
86
|
+
name: "Another #{@sample_object_params[:name]}",
|
87
|
+
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
88
|
+
setting: 500
|
89
89
|
}
|
90
90
|
|
91
91
|
result = subject.jobs.create(
|
@@ -106,15 +106,15 @@ describe Lob::V1::Job do
|
|
106
106
|
new_address = subject.addresses.create @sample_address_params
|
107
107
|
|
108
108
|
new_object_params = {
|
109
|
-
name:
|
110
|
-
file:
|
111
|
-
|
109
|
+
name: @sample_object_params[:name],
|
110
|
+
file: File.new(File.expand_path("../../../samples/test.pdf", __FILE__)),
|
111
|
+
setting: 500
|
112
112
|
}
|
113
113
|
|
114
114
|
another_object_params = {
|
115
|
-
name:
|
116
|
-
file:
|
117
|
-
|
115
|
+
name: "Another #{@sample_object_params[:name]}",
|
116
|
+
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
117
|
+
setting: 500
|
118
118
|
}
|
119
119
|
|
120
120
|
result = subject.jobs.create(
|
@@ -143,7 +143,7 @@ describe Lob::V1::Job do
|
|
143
143
|
new_object = subject.objects.create(
|
144
144
|
name: @sample_object_params[:name],
|
145
145
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
146
|
-
|
146
|
+
setting: @test_setting_id
|
147
147
|
)
|
148
148
|
|
149
149
|
result = subject.jobs.create(
|
@@ -164,7 +164,7 @@ describe Lob::V1::Job do
|
|
164
164
|
new_object_params = {
|
165
165
|
name: @sample_object_params[:name],
|
166
166
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
167
|
-
|
167
|
+
setting: @test_setting_id
|
168
168
|
}
|
169
169
|
|
170
170
|
result = subject.jobs.create(
|
@@ -188,7 +188,7 @@ describe Lob::V1::Job do
|
|
188
188
|
new_object = subject.objects.create(
|
189
189
|
name: @sample_object_params[:name],
|
190
190
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
191
|
-
|
191
|
+
setting: @test_setting_id
|
192
192
|
)
|
193
193
|
|
194
194
|
new_job = subject.jobs.create(
|
data/spec/lob/v1/object_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe Lob::V1::Object do
|
|
18
18
|
new_object = subject.objects.create(
|
19
19
|
name: @sample_params[:name],
|
20
20
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
21
|
-
|
21
|
+
setting: @test_setting_id
|
22
22
|
)
|
23
23
|
|
24
24
|
list_result = subject.objects.list
|
@@ -34,7 +34,7 @@ describe Lob::V1::Object do
|
|
34
34
|
result = subject.objects.create(
|
35
35
|
name: @sample_params[:name],
|
36
36
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
37
|
-
|
37
|
+
setting: @test_setting_id
|
38
38
|
)
|
39
39
|
|
40
40
|
result["name"].must_equal(@sample_params[:name])
|
@@ -47,25 +47,11 @@ describe Lob::V1::Object do
|
|
47
47
|
result = subject.objects.create(
|
48
48
|
name: @sample_params[:name],
|
49
49
|
file: File.new(File.expand_path("../../../samples/test.pdf", __FILE__), "rb"),
|
50
|
-
setting_id: @test_setting_id
|
51
|
-
)
|
52
|
-
|
53
|
-
result["name"].must_equal(@sample_params[:name])
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should create an object with a new api version" do
|
58
|
-
Lob.api_version = "2014-12-18"
|
59
|
-
VCR.use_cassette("create_object_with_new_version") do
|
60
|
-
result = subject.objects.create(
|
61
|
-
name: @sample_params[:name],
|
62
|
-
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
63
50
|
setting: @test_setting_id
|
64
51
|
)
|
65
52
|
|
66
53
|
result["name"].must_equal(@sample_params[:name])
|
67
54
|
end
|
68
|
-
Lob.api_version = "2014-11-24"
|
69
55
|
end
|
70
56
|
end
|
71
57
|
|
@@ -76,7 +62,7 @@ describe Lob::V1::Object do
|
|
76
62
|
new_object = subject.objects.create(
|
77
63
|
name: @sample_params[:name],
|
78
64
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
79
|
-
|
65
|
+
setting: @test_setting_id
|
80
66
|
)
|
81
67
|
|
82
68
|
find_result = subject.objects.find(new_object["id"])
|
@@ -92,7 +78,7 @@ describe Lob::V1::Object do
|
|
92
78
|
new_object = subject.objects.create(
|
93
79
|
name: @sample_params[:name],
|
94
80
|
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
95
|
-
|
81
|
+
setting: @test_setting_id
|
96
82
|
)
|
97
83
|
|
98
84
|
delete_result = subject.objects.destroy(new_object["id"])
|
data/spec/lob_spec.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lob do
|
4
|
+
|
5
|
+
after do
|
6
|
+
Lob.api_version = nil
|
7
|
+
end
|
8
|
+
|
4
9
|
it "should return the resource object for the valid version" do
|
5
10
|
Lob(api_key: "test", api_version: "2014-11-25").must_be_kind_of(Lob::V1::Resource)
|
6
11
|
end
|
@@ -34,7 +39,7 @@ describe Lob do
|
|
34
39
|
Lob.api_key = "test"
|
35
40
|
Lob.load.wont_be_nil
|
36
41
|
|
37
|
-
Lob.load(api_key: "test"
|
42
|
+
Lob.load(api_key: "test").must_be_kind_of(Lob::V1::Resource)
|
38
43
|
end
|
39
44
|
|
40
45
|
it "should handle API errors gracefully" do
|
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.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.7
|
19
|
+
version: '1.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.7
|
26
|
+
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: prawn
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|