lob 1.9.2 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +112 -598
- data/examples/letters.rb +35 -0
- data/lib/lob/v1/letter.rb +39 -0
- data/lib/lob/v1/resource.rb +4 -0
- data/lib/lob/version.rb +1 -1
- data/spec/lob/v1/letter_spec.rb +95 -0
- data/spec/samples/8.5x11.pdf +1113 -2
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041bd3b823b10d752fabc4401a2fc20b304101b5
|
4
|
+
data.tar.gz: 47ab28cfd82b796c50bd7f70df075a71a4836dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 166e26c4d59ef45e94f7d804f97bb55ecaf892afe3a258d2d3f171ec7a20ec32112bc76673da35926e3bdaebd215b482906bb99689e5292dea58095c36800d28
|
7
|
+
data.tar.gz: 4f4385149c826ca82dd1fcaa3687c90fceaa978b13a1b1401c1044221cf7afee7783ccbdd5a6db24266041cdd111ef7f010362f7a762e5e016e851ba270b70e0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## [**1.10.0**](https://github.com/lob/lob-ruby/releases/tag/v1.10.0)
|
2
|
+
- [**#100**] (https://github.com/lob/lob-ruby/pull/100) adds support for Simple Letter Service
|
3
|
+
|
1
4
|
## [**1.9.2**](https://github.com/lob/lob-ruby/releases/tag/v1.9.2)
|
2
5
|
- [**#94**] (https://github.com/lob/lob-ruby/pull/94) added bank account verify support
|
3
6
|
|
data/README.md
CHANGED
@@ -4,22 +4,39 @@
|
|
4
4
|
|
5
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)
|
6
6
|
|
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.
|
7
|
+
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.
|
8
8
|
|
9
9
|
Supports Ruby 1.9.3 and greater.
|
10
10
|
|
11
11
|
## Table of Contents
|
12
12
|
|
13
|
-
- [
|
14
|
-
- [
|
15
|
-
- [
|
16
|
-
- [
|
17
|
-
- [
|
18
|
-
- [
|
19
|
-
- [Testing](#testing)
|
13
|
+
- [Getting Started](#getting-started)
|
14
|
+
- [Registration](#registration)
|
15
|
+
- [Installation](#installation)
|
16
|
+
- [Usage](#usage)
|
17
|
+
- [Examples](#examples)
|
18
|
+
- [API Documentation](#api-documentation)
|
20
19
|
- [Contributing](#contributing)
|
20
|
+
- [Testing](#testing)
|
21
|
+
|
22
|
+
## Getting Started
|
23
|
+
|
24
|
+
Here's a general overview of the Lob services available, click through to read more.
|
25
|
+
|
26
|
+
- [Simple Postcard Service](https://lob.com/services/postcards)
|
27
|
+
- [Simple Letter Service](https://lob.com/services/letters)
|
28
|
+
- [Simple Check Service](https://lob.com/services/checks)
|
29
|
+
- [Simple Print Service](https://lob.com/services/sps)
|
30
|
+
- [Simple Area Mail](https://lob.com/services/sam)
|
31
|
+
- [Address Verification](https://lob.com/verification/address)
|
32
|
+
|
33
|
+
### Registration
|
21
34
|
|
22
|
-
|
35
|
+
First, you will need to first create an account at [Lob.com](https://dashboard.lob.com/#/register) and obtain your Test and Live API Keys.
|
36
|
+
|
37
|
+
Once you have created an account, you can access your API Keys from the [Settings Panel](https://dashboard.lob.com/#/settings).
|
38
|
+
|
39
|
+
### Installation
|
23
40
|
|
24
41
|
Add this line to your application's `Gemfile`:
|
25
42
|
|
@@ -33,40 +50,13 @@ Or manually install it yourself:
|
|
33
50
|
|
34
51
|
$ gem install lob
|
35
52
|
|
36
|
-
|
53
|
+
### Usage
|
37
54
|
|
38
55
|
The library uses an ActiveRecord-style interface. You'll feel right at home.
|
39
|
-
You'll need a Lob.com API key. It's free and you can get yours [here](https://dashboard.lob.com/settings).
|
40
56
|
|
41
57
|
For optional parameters and other details, refer to the docs [here](https://lob.com/docs/ruby).
|
42
58
|
|
43
|
-
####
|
44
|
-
|
45
|
-
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.
|
46
|
-
|
47
|
-
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.
|
48
|
-
|
49
|
-
## Supported Image Types
|
50
|
-
|
51
|
-
The Lob.com API supports the following image types:
|
52
|
-
|
53
|
-
- PDF
|
54
|
-
- PNG
|
55
|
-
- JPEG
|
56
|
-
|
57
|
-
For more information on prepping images please see the [Lob documentation](https://lob.com/docs/ruby#prepping).
|
58
|
-
|
59
|
-
#### Creating a PDF
|
60
|
-
|
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).
|
68
|
-
|
69
|
-
## Initialization and Configuration
|
59
|
+
#### Initialization and Configuration
|
70
60
|
|
71
61
|
```ruby
|
72
62
|
# To initialize a Lob object
|
@@ -86,555 +76,84 @@ Lob.configure do |config|
|
|
86
76
|
end
|
87
77
|
```
|
88
78
|
|
89
|
-
|
90
|
-
|
91
|
-
- [Simple Print Service](#simple-print-service)
|
92
|
-
- [lob.jobs](#lobjobs)
|
93
|
-
- [lob.jobs.create](#lobjobscreate)
|
94
|
-
- [lob.jobs.list](#lobjobslist)
|
95
|
-
- [lob.jobs.find](#lobjobsfind)
|
96
|
-
- [lob.addresses](#lobaddresses)
|
97
|
-
- [lob.addresses.create](#lobaddressescreate)
|
98
|
-
- [lob.addresses.list](#lobaddresseslist)
|
99
|
-
- [lob.addresses.find](#lobaddressesfind)
|
100
|
-
- [lob.addresses.destroy](#lobaddressesdestroy)
|
101
|
-
- [lob.addresses.verify](#lobaddressesverify)
|
102
|
-
- [lob.objects](#lobobjects)
|
103
|
-
- [lob.objects.create](#lobobjectscreate)
|
104
|
-
- [lob.objects.list](#lobobjectslist)
|
105
|
-
- [lob.objects.find](#lobobjectsfind)
|
106
|
-
- [lob.objects.destroy](#lobobjectsdestroy)
|
107
|
-
- [lob.settings](#lobsettings)
|
108
|
-
- [lob.settings.list](#lobsettingslist)
|
109
|
-
- [lob.settings.find](#lobsettingsfind)
|
110
|
-
- [lob.services](#lobservices)
|
111
|
-
- [lob.services.list](#lobserviceslist)
|
112
|
-
- [Simple Postcard Service](#simple-postcard-service)
|
113
|
-
- [lob.postcards](#lobpostcards)
|
114
|
-
- [lob.postcards.create](#lobpostcardscreate)
|
115
|
-
- [lob.postcards.list](#lobpostcardslist)
|
116
|
-
- [lob.postcards.find](#lobpostcardsfind)
|
117
|
-
- [Simple Check Service](#simple-check-service)
|
118
|
-
- [lob.checks](#lobchecks)
|
119
|
-
- [lob.checks.create](#lobcheckscreate)
|
120
|
-
- [lob.checks.list](#lobcheckslist)
|
121
|
-
- [lob.checks.find](#lobchecksfind)
|
122
|
-
- [lob.bank_accounts](#lobbank_accounts)
|
123
|
-
- [lob.bank_accounts.create](#lobbank_accountscreate)
|
124
|
-
- [lob.bank_accounts.list](#lobbank_accountslist)
|
125
|
-
- [lob.bank_accounts.find](#lobbank_accountsfind)
|
126
|
-
- [Simple Area Mail](#simple-area-mail)
|
127
|
-
- [lob.areas](#lobareas)
|
128
|
-
- [lob.areas.create](#lobareascreate)
|
129
|
-
- [lob.areas.list](#lobareaslist)
|
130
|
-
- [lob.areas.find](#lobareasfind)
|
131
|
-
- [lob.routes](#lobroutes)
|
132
|
-
- [lob.routes.find](#lobroutesfind)
|
133
|
-
- [Resources](#lobresources)
|
134
|
-
- [lob.countries](#lobcountries)
|
135
|
-
- [lob.countries.list](#lobcountrieslist)
|
136
|
-
- [lob.states](#lobstates)
|
137
|
-
- [lob.states.list](#lobstateslist)
|
138
|
-
|
139
|
-
## Simple Print Service
|
140
|
-
|
141
|
-
### lob.jobs
|
142
|
-
|
143
|
-
#### lob.jobs.create
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
|
147
|
-
# Below is an example with inline addresses and object creation
|
148
|
-
|
149
|
-
@lob.jobs.create(
|
150
|
-
name: "Inline Test Job",
|
151
|
-
from: {
|
152
|
-
name: "Test Address",
|
153
|
-
email: "test@test.com",
|
154
|
-
address_line1: "123 Test Street",
|
155
|
-
address_line2: "Unit 199",
|
156
|
-
city: "Mountain View",
|
157
|
-
state: "CA",
|
158
|
-
country: "US",
|
159
|
-
zip: 94085
|
160
|
-
},
|
161
|
-
to: {
|
162
|
-
name: "TestAddress",
|
163
|
-
email: "test@test.com",
|
164
|
-
address_line1: "123 Test Street",
|
165
|
-
address_line2: "Unit 199",
|
166
|
-
city: "Mountain View",
|
167
|
-
state: "CA",
|
168
|
-
country: "US",
|
169
|
-
zip: 94085
|
170
|
-
},
|
171
|
-
objects: {
|
172
|
-
name: "Local File Object",
|
173
|
-
file: File.new("/path/to/file.pdf"),
|
174
|
-
setting: 100
|
175
|
-
})
|
176
|
-
|
177
|
-
|
178
|
-
# name, to-address and object are the arguments
|
179
|
-
# to-address can be specified as an address-id
|
180
|
-
@lob.jobs.create(
|
181
|
-
name: "New Cool Posters",
|
182
|
-
from: "from-address-id",
|
183
|
-
to: "to-address-id",
|
184
|
-
objects: "object-id"
|
185
|
-
)
|
186
|
-
|
187
|
-
# mixing inline objects with ids
|
188
|
-
@lob.jobs.create(
|
189
|
-
name: "New Cool Posters",
|
190
|
-
from: {
|
191
|
-
name: "FromAddress",
|
192
|
-
address_line1: "120, 6th Ave",
|
193
|
-
city: "Boston",
|
194
|
-
state: "MA",
|
195
|
-
country: "US",
|
196
|
-
zip: 12345
|
197
|
-
},
|
198
|
-
to: "to-address-id",
|
199
|
-
objects: "object-id"
|
200
|
-
)
|
201
|
-
|
202
|
-
# You can also pass new object params for the object
|
203
|
-
# and other options like setting
|
204
|
-
@lob.jobs.create(
|
205
|
-
name: "New Cool Posters",
|
206
|
-
from: "from-address-id",
|
207
|
-
to: "to-address-id",
|
208
|
-
objects: "object-id",
|
209
|
-
{
|
210
|
-
name: "Your fantistic object",
|
211
|
-
file: "http://test.com/file.pdf",
|
212
|
-
setting: "some-setting"
|
213
|
-
}
|
214
|
-
)
|
215
|
-
|
216
|
-
# Multi Object Jobs (include more than 1 file)
|
217
|
-
|
218
|
-
@lob.jobs.create(
|
219
|
-
name: "New Cool Posters",
|
220
|
-
from: "from-address-id",
|
221
|
-
to: {
|
222
|
-
name: "ToAddress",
|
223
|
-
address_line1: "120, 6th Ave",
|
224
|
-
city: "Boston",
|
225
|
-
state: "MA",
|
226
|
-
country: "US",
|
227
|
-
zip: 12345
|
228
|
-
},
|
229
|
-
objects: ["object-id", "another-object-id"]
|
230
|
-
)
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
```
|
235
|
-
|
236
|
-
#### lob.jobs.list
|
237
|
-
|
238
|
-
```ruby
|
239
|
-
# returns an array of jobs
|
240
|
-
@lob.jobs.list
|
241
|
-
|
242
|
-
#you can also pass count and offset
|
243
|
-
@lob.jobs.list(count: 10, offset: 3)
|
244
|
-
```
|
245
|
-
|
246
|
-
#### lob.jobs.find
|
247
|
-
|
248
|
-
```ruby
|
249
|
-
# returns the job with the corresponding ID
|
250
|
-
@lob.jobs.find("some-job-id")
|
251
|
-
```
|
252
|
-
|
253
|
-
### lob.addresses
|
254
|
-
|
255
|
-
#### lob.addresses.create
|
256
|
-
|
257
|
-
```ruby
|
258
|
-
# name, address, city, state, country and zip are required parameters
|
259
|
-
@lob.addresses.create(
|
260
|
-
name: "John Doe",
|
261
|
-
email: "test@test.com", # optional
|
262
|
-
address_line1: "104, Printing Boulevard",
|
263
|
-
address_line2: "Sunset Town", # optional
|
264
|
-
city: "Boston",
|
265
|
-
state: "MA",
|
266
|
-
country: "US",
|
267
|
-
zip: 12345
|
268
|
-
)
|
269
|
-
```
|
270
|
-
|
271
|
-
#### lob.addresses.list
|
272
|
-
|
273
|
-
```ruby
|
274
|
-
# returns an array of addresses
|
275
|
-
@lob.addresses.list
|
276
|
-
|
277
|
-
#you can also pass count and offset
|
278
|
-
@lob.addresses.list(count: 10, offset: 3)
|
279
|
-
```
|
280
|
-
|
281
|
-
#### lob.addresses.find
|
282
|
-
|
283
|
-
```ruby
|
284
|
-
# returns the address with the corresponding ID
|
285
|
-
@lob.addresses.find("some-address-id")
|
286
|
-
```
|
287
|
-
|
288
|
-
#### lob.addresses.destroy
|
289
|
-
|
290
|
-
```ruby
|
291
|
-
# deletes the address with the corresponding ID
|
292
|
-
@lob.addresses.destroy("some-address-id")
|
293
|
-
```
|
294
|
-
|
295
|
-
#### lob.addresses.verify
|
296
|
-
|
297
|
-
```ruby
|
298
|
-
# verifies and returns an address with more details
|
299
|
-
@lob.addresses.verify(
|
300
|
-
address_line1: "220 WILLIAM T MORRISSEY BLVD",
|
301
|
-
city: "Boston",
|
302
|
-
state: "MA",
|
303
|
-
zip: "02125"
|
304
|
-
)
|
305
|
-
```
|
306
|
-
|
307
|
-
### lob.objects
|
308
|
-
|
309
|
-
#### lob.objects.create
|
310
|
-
|
311
|
-
```ruby
|
312
|
-
# You can create an object by passing the name, file url and setting ID, quantity is defaulted to 1
|
313
|
-
@lob.objects.create(
|
314
|
-
name: "Your fantastic object",
|
315
|
-
file: "https://s3-us-west-2.amazonaws.com/lob-assets/test.pdf",
|
316
|
-
setting: "201"
|
317
|
-
)
|
318
|
-
|
319
|
-
# You can also pass the quantity as an option
|
320
|
-
# Or pass a file for upload instead of a url
|
321
|
-
@lob.objects.create(
|
322
|
-
name: "Your fantastic object",
|
323
|
-
file: File.new("/path/to/file.pdf"),
|
324
|
-
setting: "some-setting",
|
325
|
-
quantity: 12
|
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
|
-
)
|
334
|
-
```
|
335
|
-
|
336
|
-
#### lob.objects.list
|
337
|
-
|
338
|
-
```ruby
|
339
|
-
# returns an array of objects
|
340
|
-
@lob.objects.list
|
341
|
-
|
342
|
-
#you can also pass count and offset
|
343
|
-
@lob.objects.list(count: 10, offset: 3)
|
344
|
-
```
|
345
|
-
|
346
|
-
#### lob.objects.find
|
347
|
-
|
348
|
-
```ruby
|
349
|
-
# returns the object with the corresponding ID
|
350
|
-
@lob.objects.find("some-object-id")
|
351
|
-
```
|
352
|
-
|
353
|
-
#### lob.objects.destroy
|
354
|
-
|
355
|
-
```ruby
|
356
|
-
# deletes the object with the corresponding ID
|
357
|
-
@lob.objects.destroy("some-object-id")
|
358
|
-
```
|
359
|
-
|
360
|
-
### lob.settings
|
361
|
-
|
362
|
-
#### lob.settings.list
|
363
|
-
```ruby
|
364
|
-
# returns an array of settings
|
365
|
-
@lob.settings.list
|
366
|
-
```
|
367
|
-
|
368
|
-
#### lob.settings.find
|
369
|
-
```ruby
|
370
|
-
# returns a setting object
|
371
|
-
@lob.settings.find("setting")
|
372
|
-
```
|
373
|
-
|
374
|
-
### lob.services
|
375
|
-
|
376
|
-
#### lob.services.list
|
377
|
-
|
378
|
-
```ruby
|
379
|
-
# returns a list of services
|
380
|
-
@lob.services.list
|
381
|
-
```
|
382
|
-
|
383
|
-
## Simple Postcard Service
|
384
|
-
|
385
|
-
### lob.postcards
|
386
|
-
|
387
|
-
#### lob.postcards.create
|
388
|
-
|
389
|
-
You'll have to specify either the `message` option or the `back` option.
|
390
|
-
|
391
|
-
```ruby
|
392
|
-
|
393
|
-
# create postcard with message
|
394
|
-
|
395
|
-
@lob.postcards.create(
|
396
|
-
name: "John Joe",
|
397
|
-
to: {
|
398
|
-
name: "ToAddress",
|
399
|
-
address_line1: "120, 6th Ave",
|
400
|
-
city: "Boston",
|
401
|
-
state: "MA",
|
402
|
-
country: "US",
|
403
|
-
zip: 12345
|
404
|
-
},
|
405
|
-
from: {
|
406
|
-
name: "FromAddress",
|
407
|
-
address_line1: "120, 6th Ave",
|
408
|
-
city: "Boston",
|
409
|
-
state: "MA",
|
410
|
-
country: "US",
|
411
|
-
zip: 12345
|
412
|
-
},
|
413
|
-
front: "https://lob.com/postcardfront.pdf",
|
414
|
-
message: "Hey Buddy, Thanks for Visiting",
|
415
|
-
full_bleed: 1
|
416
|
-
)
|
417
|
-
|
418
|
-
# create postcard with your own back, adhering to lob's template
|
419
|
-
@lob.postcards.create(
|
420
|
-
name: "John Joe",
|
421
|
-
to: {
|
422
|
-
name: "ToAddress",
|
423
|
-
address_line1: "120, 6th Ave",
|
424
|
-
city: "Boston",
|
425
|
-
state: "MA",
|
426
|
-
country: "US",
|
427
|
-
zip: 12345
|
428
|
-
},
|
429
|
-
from: {
|
430
|
-
name: "FromAddress",
|
431
|
-
address_line1: "120, 6th Ave",
|
432
|
-
city: "Boston",
|
433
|
-
state: "MA",
|
434
|
-
country: "US",
|
435
|
-
zip: 12345
|
436
|
-
},
|
437
|
-
front: "https://lob.com/postcardfront.pdf",
|
438
|
-
back: File.new("/path/to/file.pdf"),
|
439
|
-
full_bleed: 1,
|
440
|
-
template: 1
|
441
|
-
)
|
442
|
-
|
443
|
-
# create postcard with HTML string & a stored address id
|
444
|
-
@lob.postcards.create(
|
445
|
-
name: "John Joe",
|
446
|
-
to: "to-address-id",
|
447
|
-
front: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
448
|
-
message: "Hey buddy. Waiting to hear your stories."
|
449
|
-
)
|
450
|
-
```
|
451
|
-
|
452
|
-
#### lob.postcards.list
|
453
|
-
|
454
|
-
```ruby
|
455
|
-
@lob.postcards.list
|
456
|
-
|
457
|
-
#you can also pass count and offset
|
458
|
-
@lob.postcards.list(count: 10, offset: 3)
|
459
|
-
```
|
460
|
-
|
461
|
-
#### lob.postcards.find
|
462
|
-
|
463
|
-
```ruby
|
464
|
-
@lob.postcards.find("post-card-id")
|
465
|
-
```
|
466
|
-
|
467
|
-
## Simple Check Service
|
468
|
-
|
469
|
-
### lob.checks
|
470
|
-
|
471
|
-
#### lob.checks.create
|
472
|
-
|
473
|
-
```ruby
|
474
|
-
# For the "to" address, you can pass params
|
475
|
-
# Transfer $5000 to a bank account.
|
476
|
-
@lob.checks.create(
|
477
|
-
bank_account: "bank-account-id",
|
478
|
-
to: {
|
479
|
-
name: "FromAddress",
|
480
|
-
address_line1: "120, 6th Ave",
|
481
|
-
city: "Boston",
|
482
|
-
state: "MA",
|
483
|
-
country: "US",
|
484
|
-
zip: 12345
|
485
|
-
},
|
486
|
-
amount: 5000,
|
487
|
-
logo: "https://s3-us-west-2.amazonaws.com/lob-assets/lob_check_logo.png" # optional
|
488
|
-
)
|
489
|
-
|
490
|
-
# or an address ID
|
491
|
-
@lob.checks.create(
|
492
|
-
bank_account: "bank-account-id",
|
493
|
-
to: "to-address-ID",
|
494
|
-
amount: 5000,
|
495
|
-
logo: "https://s3-us-west-2.amazonaws.com/lob-assets/lob_check_logo.png" # optional
|
496
|
-
)
|
497
|
-
|
498
|
-
# You can also specify an optional 4th argument, with other options.
|
499
|
-
```
|
500
|
-
|
501
|
-
#### lob.checks.list
|
502
|
-
|
503
|
-
```ruby
|
504
|
-
@lob.checks.list
|
505
|
-
```
|
506
|
-
|
507
|
-
#### lob.checks.find
|
508
|
-
|
509
|
-
```ruby
|
510
|
-
@lob.checks.find("check-id")
|
511
|
-
```
|
512
|
-
|
513
|
-
### lob.bank_accounts
|
514
|
-
|
515
|
-
#### lob.bank_accounts.create
|
516
|
-
|
517
|
-
```ruby
|
518
|
-
bank_address =
|
519
|
-
|
520
|
-
account_address =
|
521
|
-
|
522
|
-
# Pass address params or address IDs
|
523
|
-
# The 5th argument is the options argument and is optional
|
524
|
-
@lob.bank_accounts.create(
|
525
|
-
routing_number: "routing_number",
|
526
|
-
account_number: "account_number",
|
527
|
-
signatory: "John Doe",
|
528
|
-
bank_address: {
|
529
|
-
name: "ToAddress",
|
530
|
-
address_line1: "120 6th Ave",
|
531
|
-
city: "Boston",
|
532
|
-
country: "US",
|
533
|
-
zip: 12345
|
534
|
-
},
|
535
|
-
account_address: {
|
536
|
-
name: "ToAddress",
|
537
|
-
address_line1: "120 6th Ave",
|
538
|
-
city: "Boston",
|
539
|
-
country: "US",
|
540
|
-
zip: 12345
|
541
|
-
}
|
542
|
-
)
|
543
|
-
```
|
544
|
-
|
545
|
-
#### lob.bank_accounts.list
|
546
|
-
|
547
|
-
```ruby
|
548
|
-
# returns a list of accounts
|
549
|
-
@lob.bank_accounts.list
|
550
|
-
```
|
551
|
-
|
552
|
-
#### lob.bank_accounts.find
|
553
|
-
|
554
|
-
```ruby
|
555
|
-
@lob.bank_accounts.find("bank-account-id")
|
556
|
-
```
|
557
|
-
|
558
|
-
## Simple Area Mail
|
559
|
-
|
560
|
-
### lob.areas
|
561
|
-
|
562
|
-
#### lob.areas.create
|
563
|
-
|
564
|
-
You'll have to specify front, back, and either zip_codes or routes
|
565
|
-
|
566
|
-
```ruby
|
567
|
-
# create an area request with remote files & with routes
|
568
|
-
@lob.areas.create(
|
569
|
-
name: "My Area",
|
570
|
-
front: "https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf",
|
571
|
-
back: "https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf",
|
572
|
-
routes: ["94158-C001", "94107-C031"],
|
573
|
-
target_type: "all",
|
574
|
-
full_bleed: "1"
|
575
|
-
)
|
576
|
-
|
577
|
-
# create an area request with HTML & with zip codes
|
578
|
-
@lob.areas.create(
|
579
|
-
name: "My Area",
|
580
|
-
front: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
581
|
-
back: "<html style='margin: 130px; font-size: 50;'>HTML here</html>",
|
582
|
-
zip_codes: ["95678", "94158"],
|
583
|
-
target_type: "all",
|
584
|
-
full_bleed: "1"
|
585
|
-
)
|
586
|
-
```
|
587
|
-
|
588
|
-
zip_codes and routes can be a string or an array of strings
|
589
|
-
|
590
|
-
#### lob.areas.list
|
591
|
-
```ruby
|
592
|
-
@lob.areas.list
|
593
|
-
|
594
|
-
# you can also pass count and offset
|
595
|
-
@lob.areas.list(count: 10, offset: 3)
|
596
|
-
```
|
597
|
-
|
598
|
-
#### lob.areas.find
|
599
|
-
```ruby
|
600
|
-
@lob.areas.find("area_id")
|
601
|
-
```
|
602
|
-
|
603
|
-
### lob.routes
|
604
|
-
|
605
|
-
You'll have to specify zip_codes
|
606
|
-
|
607
|
-
#### lob.routes.find
|
608
|
-
|
609
|
-
```ruby
|
610
|
-
@lob.routes.find(
|
611
|
-
zip_codes: ["95678, 94158"]
|
612
|
-
)
|
613
|
-
```
|
614
|
-
|
615
|
-
zip_codes can be a string or an array of strings
|
616
|
-
|
617
|
-
## Resources
|
618
|
-
|
619
|
-
### lob.countries
|
620
|
-
|
621
|
-
#### lob.countries.list
|
79
|
+
#### Caution: Pass zero-prefixed zip codes as strings
|
622
80
|
|
623
|
-
|
624
|
-
# returns a list of countries
|
625
|
-
@lob.countries.list
|
626
|
-
```
|
81
|
+
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.
|
627
82
|
|
628
|
-
|
83
|
+
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.
|
629
84
|
|
630
|
-
|
85
|
+
## Examples
|
86
|
+
|
87
|
+
We've provided various examples for you to try out [here](https://github.com/lob/lob-ruby/tree/master/examples).
|
88
|
+
|
89
|
+
## API Documentation
|
90
|
+
|
91
|
+
- [Introduction](https://lob.com/docs/ruby#introduction)
|
92
|
+
- [Versioning](https://lob.com/docs/ruby#version)
|
93
|
+
- [Image Prepping](https://lob.com/docs/ruby#prepping)
|
94
|
+
- **Addresses**
|
95
|
+
- [Address Book](https://lob.com/docs/ruby#addresses)
|
96
|
+
- [Create an Address](https://lob.com/docs/ruby#addresses_create)
|
97
|
+
- [Retrieve an Address](https://lob.com/docs/ruby#addresses_retrieve)
|
98
|
+
- [Delete an Address](https://lob.com/docs/ruby#addresses_delete)
|
99
|
+
- [List all Addresses](https://lob.com/docs/ruby#addresses_list)
|
100
|
+
- [Simple Address Verification](https://lob.com/docs/ruby#verify)
|
101
|
+
- [Verify an Address](https://lob.com/docs/ruby#verify_create)
|
102
|
+
- **Simple Postcard Service**
|
103
|
+
- [Postcards](https://lob.com/docs/ruby#postcards)
|
104
|
+
- [Create a Postcard](https://lob.com/docs/ruby#postcards_create)
|
105
|
+
- [Retrieve a Postcard](https://lob.com/docs/ruby#postcards_retrieve)
|
106
|
+
- [List all Postcards](https://lob.com/docs/ruby#postcards_list)
|
107
|
+
- **Simple Letter Service**
|
108
|
+
- [Letters](https://lob.com/docs/ruby#letters)
|
109
|
+
- [Create a Letter](https://lob.com/docs/ruby#letters_create)
|
110
|
+
- [Retrieve a Letter](https://lob.com/docs/ruby#letters_retrieve)
|
111
|
+
- [List all Letters](https://lob.com/docs/ruby#letters_list)
|
112
|
+
- **Simple Check Service**
|
113
|
+
- [Checks](https://lob.com/docs/ruby#checks)
|
114
|
+
- [Create a Check](https://lob.com/docs/ruby#checks_create)
|
115
|
+
- [Retrieve a Check](https://lob.com/docs/ruby#checks_retrieve)
|
116
|
+
- [List all Checks](https://lob.com/docs/ruby#checks_list)
|
117
|
+
- [Bank Accounts](https://lob.com/docs/ruby#bank-accounts)
|
118
|
+
- [Create a Bank Account](https://lob.com/docs/ruby#bankaccounts_create)
|
119
|
+
- [Retrieve a Bank Account](https://lob.com/docs/ruby#bankaccounts_retrieve)
|
120
|
+
- [List all Bank Accounts](https://lob.com/docs/ruby#bankaccounts_list)
|
121
|
+
- [Verify a Bank Account](https://lob.com/docs/ruby#bankaccounts_verify)
|
122
|
+
- [Delete a Bank Account](https://lob.com/docs/ruby#bankaccounts_delete)
|
123
|
+
- **Simple Print Service**
|
124
|
+
- [Jobs](https://lob.com/docs/ruby#jobs)
|
125
|
+
- [Create a Job](https://lob.com/docs/ruby#jobs_create)
|
126
|
+
- [Retrieve a Job](https://lob.com/docs/ruby#jobs_retrieve)
|
127
|
+
- [List all Jobs](https://lob.com/docs/ruby#jobs_list)
|
128
|
+
- [Objects](https://lob.com/docs/ruby#objects)
|
129
|
+
- [Create an Object](https://lob.com/docs/ruby#objects_create)
|
130
|
+
- [Retrieve an Object](https://lob.com/docs/ruby#objects_retrieve)
|
131
|
+
- [Delete an Object](https://lob.com/docs/ruby#objects_delete)
|
132
|
+
- [List all Objects](https://lob.com/docs/ruby#objects_list)
|
133
|
+
- [Settings](https://lob.com/docs/ruby#settings)
|
134
|
+
- [Retrieve a Setting](https://lob.com/docs/ruby#settings_retrieve)
|
135
|
+
- [List all Settings](https://lob.com/docs/ruby#settings_list)
|
136
|
+
- **Simple Area Mail**
|
137
|
+
- [Areas](https://lob.com/docs/ruby#areas)
|
138
|
+
- [Create an Area Mailing](https://lob.com/docs/ruby#areas_create)
|
139
|
+
- [Retrieve an Area Mailing](https://lob.com/docs/ruby#areas_retrieve)
|
140
|
+
- [List all Area Mailings](https://lob.com/docs/ruby#areas_list)
|
141
|
+
- [Routes](https://lob.com/docs/ruby#routes)
|
142
|
+
- [Retrieve a Zip Code](https://lob.com/docs/ruby#routes_retrieve)
|
143
|
+
- [List all Zip Codes](https://lob.com/docs/ruby#routes_list)
|
144
|
+
- **Resources**
|
145
|
+
- [Countries](https://lob.com/docs/ruby#countries)
|
146
|
+
- [List all Countries](https://lob.com/docs/ruby#countries_list)
|
147
|
+
- [States](https://lob.com/docs/ruby#states)
|
148
|
+
- [List all States](https://lob.com/docs/ruby#states_list)
|
149
|
+
- **Appendix**
|
150
|
+
- [SPS Templates](https://lob.com/docs/ruby#sps-templates)
|
151
|
+
- [Custom Fonts with HTML](https://lob.com/docs/ruby#html-fonts)
|
152
|
+
- [Postcard HTML Examples](https://lob.com/docs/ruby#postcard-examples)
|
153
|
+
- [Area HTML Examples](https://lob.com/docs/ruby#area-examples)
|
154
|
+
- [Letter HTML Examples](https://lob.com/docs/ruby#letter-examples)
|
631
155
|
|
632
|
-
|
633
|
-
# returns a list of states
|
634
|
-
@lob.states.list
|
635
|
-
```
|
636
|
-
|
637
|
-
## Developing
|
156
|
+
## Contributing
|
638
157
|
|
639
158
|
Make sure you have Ruby 2.0 installed. Copy and paste the following commands in your projects directory.
|
640
159
|
|
@@ -642,7 +161,15 @@ Make sure you have Ruby 2.0 installed. Copy and paste the following commands in
|
|
642
161
|
cd lob-ruby
|
643
162
|
bundle install
|
644
163
|
|
645
|
-
|
164
|
+
### Contributing Instructions
|
165
|
+
|
166
|
+
1. Fork it
|
167
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
168
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
169
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
170
|
+
5. Make sure the tests pass
|
171
|
+
6. Open up coverage/index.html in your browser and add tests if required
|
172
|
+
7. Create new Pull Request
|
646
173
|
|
647
174
|
## Testing
|
648
175
|
|
@@ -658,24 +185,11 @@ Here's how you can run the tests:
|
|
658
185
|
|
659
186
|
LOB_API_KEY=your_test_api_key bundle exec rake test
|
660
187
|
|
661
|
-
|
662
188
|
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`.
|
663
189
|
|
664
190
|
You can also configure, TravisCI for your fork of the repository and it'll run the tests for you, when you push.
|
665
191
|
|
666
|
-
|
667
|
-
|
668
|
-
1. Fork it
|
669
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
670
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
671
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
672
|
-
5. Make sure the tests pass
|
673
|
-
6. Open up coverage/index.html in your browser and add tests if required
|
674
|
-
7. Create new Pull Request
|
675
|
-
|
676
|
-
## Credits
|
677
|
-
|
678
|
-
* [Akash Manohar J](http://github.com/HashNuke)
|
192
|
+
=======================
|
679
193
|
|
680
194
|
Copyright © 2013 Lob.com
|
681
195
|
|