lob 1.1 → 1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +16 -10
- data/lib/lob/v1/job.rb +2 -1
- data/lob.gemspec +1 -1
- data/spec/lob/v1/address_spec.rb +2 -2
- data/spec/lob/v1/job_spec.rb +37 -0
- data/spec/lob/v1/postcard_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc23512932804b6f7ab2f1e15f2db402fbd51517
|
4
|
+
data.tar.gz: da3019d42bf5dd557c1fa4369a217fe13792c652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a2f560d31987b814e11b8e2baa0e592b698547601fe18f723852eca913f8db7b93682f9a309bc482ed2cbe1823c3e4500b700ba8cb4ebce77f48b099126c756
|
7
|
+
data.tar.gz: 7541054ab21ad31ee44d03baa99f55812023b549d46c5691f9cdc568ce99f0dd724fa0c371cf3ddbe07a6e0894fbab611c573fef82c82c69d6e055d7c3d4cda5
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -141,14 +141,16 @@ end
|
|
141
141
|
name: "FromAddress",
|
142
142
|
address_line1: "120, 6th Ave",
|
143
143
|
city: "Boston",
|
144
|
-
|
144
|
+
state: "MA",
|
145
|
+
country: "US",
|
145
146
|
zip: 12345
|
146
147
|
},
|
147
148
|
to: {
|
148
149
|
name: "ToAddress",
|
149
150
|
address_line1: "120, 6th Ave",
|
150
151
|
city: "Boston",
|
151
|
-
|
152
|
+
state: "MA",
|
153
|
+
country: "US",
|
152
154
|
zip: 12345
|
153
155
|
},
|
154
156
|
objects: "object-id"
|
@@ -177,7 +179,8 @@ end
|
|
177
179
|
name: "ToAddress",
|
178
180
|
address_line1: "120, 6th Ave",
|
179
181
|
city: "Boston",
|
180
|
-
|
182
|
+
state: "MA",
|
183
|
+
country: "US",
|
181
184
|
zip: 12345
|
182
185
|
},
|
183
186
|
objects: ["object-id", "another-object-id"]
|
@@ -268,7 +271,8 @@ You'll have to specify either the `message` option or the `back` option.
|
|
268
271
|
@lob.postcards.create(
|
269
272
|
name: "John Joe",
|
270
273
|
to: "to-address-id",
|
271
|
-
message:
|
274
|
+
message: "Hey buddy. Waiting to hear your stories",
|
275
|
+
front: File.new("/path/to/file.pdf")
|
272
276
|
)
|
273
277
|
|
274
278
|
# create using address params, front, back and from address
|
@@ -278,17 +282,19 @@ You'll have to specify either the `message` option or the `back` option.
|
|
278
282
|
name: "ToAddress",
|
279
283
|
address_line1: "120, 6th Ave",
|
280
284
|
city: "Boston",
|
281
|
-
|
285
|
+
state: "MA",
|
286
|
+
country: "US",
|
282
287
|
zip: 12345
|
283
288
|
},
|
284
289
|
message: "Hey buddy. Waiting to hear your stories",
|
285
|
-
front: "
|
286
|
-
back: File.
|
290
|
+
front: "https://www.lob.com/postcardback.pdf",
|
291
|
+
back: File.new("/path/to/file.pdf"),
|
287
292
|
from: {
|
288
293
|
name: "FromAddress",
|
289
294
|
address_line1: "120, 6th Ave",
|
290
295
|
city: "Boston",
|
291
|
-
|
296
|
+
state: "MA",
|
297
|
+
country: "US",
|
292
298
|
zip: 12345
|
293
299
|
}
|
294
300
|
)
|
@@ -330,8 +336,8 @@ You'll have to specify either the `message` option or the `back` option.
|
|
330
336
|
#### Add a bank account
|
331
337
|
|
332
338
|
```ruby
|
333
|
-
bank_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Boston", country: "
|
334
|
-
account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Boston", country: "
|
339
|
+
bank_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Boston", country: "US", zip: 12345}
|
340
|
+
account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Boston", country: "US", zip: 12345}
|
335
341
|
|
336
342
|
# Pass address params or address IDs
|
337
343
|
# The 5th argument is the options argument and is optional
|
data/lib/lob/v1/job.rb
CHANGED
@@ -17,11 +17,12 @@ module Lob
|
|
17
17
|
def create(options = {})
|
18
18
|
if options[:objects].is_a?(Array)
|
19
19
|
options[:objects].each_with_index do |object, index|
|
20
|
-
options["object#{index}"] = object
|
20
|
+
options["object#{index+1}"] = object
|
21
21
|
end
|
22
22
|
else
|
23
23
|
options["object1"] = options[:objects]
|
24
24
|
end
|
25
|
+
options.delete(:objects)
|
25
26
|
|
26
27
|
if options[:to] && !options[:to].is_a?(String)
|
27
28
|
options[:to] = @resource.format_address_params(options[:to])
|
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.2"
|
9
9
|
spec.authors = ["Akash Manohar J"]
|
10
10
|
spec.email = ["akash@akash.im"]
|
11
11
|
spec.description = %q{Lob API Ruby wrapper}
|
data/spec/lob/v1/address_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe Lob::V1::Address do
|
|
38
38
|
zip: sample_params2[:zip]
|
39
39
|
)
|
40
40
|
|
41
|
-
result["address"]["address_country"].must_equal("
|
41
|
+
result["address"]["address_country"].must_equal("United States")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -52,7 +52,7 @@ describe Lob::V1::Address do
|
|
52
52
|
zip: sample_params[:zip]
|
53
53
|
)
|
54
54
|
|
55
|
-
result["address"]["address_country"].must_equal("
|
55
|
+
result["address"]["address_country"].must_equal("United States")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/spec/lob/v1/job_spec.rb
CHANGED
@@ -100,6 +100,43 @@ describe Lob::V1::Job do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
|
103
|
+
|
104
|
+
it "should be able to create jobs from a mix of remote and local files" do
|
105
|
+
VCR.use_cassette('create_multiple_jobs_from_mix_of_remote_and_local_files') do
|
106
|
+
new_address = subject.addresses.create @sample_address_params
|
107
|
+
|
108
|
+
new_object_params = {
|
109
|
+
name: @sample_object_params[:name],
|
110
|
+
file: File.new(File.expand_path("../../../samples/test.pdf", __FILE__)),
|
111
|
+
setting_id: @test_setting_id
|
112
|
+
}
|
113
|
+
|
114
|
+
another_object_params = {
|
115
|
+
name: "Another #{@sample_object_params[:name]}",
|
116
|
+
file: "https://www.lob.com/test.pdf",
|
117
|
+
setting_id: @test_setting_id
|
118
|
+
}
|
119
|
+
|
120
|
+
result = subject.jobs.create(
|
121
|
+
name: @sample_job_params[:name],
|
122
|
+
from: new_address["id"],
|
123
|
+
to: new_address["id"],
|
124
|
+
objects: [new_object_params, another_object_params]
|
125
|
+
)
|
126
|
+
|
127
|
+
# result = subject.jobs.create(
|
128
|
+
# name: @sample_job_params[:name],
|
129
|
+
# from: new_address["id"],
|
130
|
+
# to: new_address["id"],
|
131
|
+
# objects: [new_object_params]
|
132
|
+
# )
|
133
|
+
|
134
|
+
result["name"].must_equal(@sample_job_params[:name])
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
|
103
140
|
it "should create a job with address params" do
|
104
141
|
VCR.use_cassette('create_job_with_address_params') do
|
105
142
|
settings_list = subject.settings.list
|
@@ -30,8 +30,8 @@ describe Lob::V1::Postcard do
|
|
30
30
|
new_postcard = subject.postcards.create(
|
31
31
|
name: @sample_postcard_params[:name],
|
32
32
|
to: new_address["id"],
|
33
|
-
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)
|
34
|
-
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__)
|
33
|
+
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
34
|
+
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__))
|
35
35
|
)
|
36
36
|
|
37
37
|
list_result = subject.postcards.list
|
@@ -96,8 +96,8 @@ describe Lob::V1::Postcard do
|
|
96
96
|
result = subject.postcards.create(
|
97
97
|
name: @sample_postcard_params[:name],
|
98
98
|
to: new_address["id"],
|
99
|
-
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)
|
100
|
-
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__)
|
99
|
+
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
100
|
+
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__))
|
101
101
|
)
|
102
102
|
|
103
103
|
result["name"].must_equal(@sample_postcard_params[:name])
|
@@ -115,8 +115,8 @@ describe Lob::V1::Postcard do
|
|
115
115
|
new_postcard = subject.postcards.create(
|
116
116
|
name: @sample_postcard_params[:name],
|
117
117
|
to: new_address["id"],
|
118
|
-
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)
|
119
|
-
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__)
|
118
|
+
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
119
|
+
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__))
|
120
120
|
)
|
121
121
|
|
122
122
|
result = subject.postcards.find(new_postcard["id"])
|
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.2'
|
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:
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|