lob 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd13287769fd6454755acf823e093f3e5959bca2
4
- data.tar.gz: b5a6de920dc8f82c1015077dbac47e7dcba686e4
3
+ metadata.gz: bc23512932804b6f7ab2f1e15f2db402fbd51517
4
+ data.tar.gz: da3019d42bf5dd557c1fa4369a217fe13792c652
5
5
  SHA512:
6
- metadata.gz: e047997e2c9b3c859d045683177ace7958d9be852b352e3ab8842f18a2165991da1291460ac433e60fad59acb5d337879ab3c65e824de7771dafed3f2772805c
7
- data.tar.gz: 5e7c5d82fdd9168544707c5f06c0fc347066e2cf619f64a0e6e70fd3e6942a654751b8833a01aa3da3606e2e6d2532e19cddec8817681186d1b5a80281d0912f
6
+ metadata.gz: 9a2f560d31987b814e11b8e2baa0e592b698547601fe18f723852eca913f8db7b93682f9a309bc482ed2cbe1823c3e4500b700ba8cb4ebce77f48b099126c756
7
+ data.tar.gz: 7541054ab21ad31ee44d03baa99f55812023b549d46c5691f9cdc568ce99f0dd724fa0c371cf3ddbe07a6e0894fbab611c573fef82c82c69d6e055d7c3d4cda5
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ rvm:
3
3
  - 1.9.3
4
4
  - jruby-19mode
5
5
  - 2.0.0
6
+ - 2.1.0
6
7
 
7
8
  env:
8
9
  - LOB_API_KEY=test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc
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
- country: "USA",
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
- country: "USA",
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
- country: "USA",
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: front: File.read("/path/to/file.pdf")
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
- country: "USA",
285
+ state: "MA",
286
+ country: "US",
282
287
  zip: 12345
283
288
  },
284
289
  message: "Hey buddy. Waiting to hear your stories",
285
- front: "http://test.com/file.pdf",
286
- back: File.read("/path/to/file.pdf"),
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
- country: "USA",
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: "USA", zip: 12345}
334
- account_address = {name: "ToAddress", address_line1: "120, 6th Ave", city: "Boston", country: "USA", zip: 12345}
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.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}
@@ -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("US")
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("US")
55
+ result["address"]["address_country"].must_equal("United States")
56
56
  end
57
57
  end
58
58
  end
@@ -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__), "rb"),
34
- back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
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__), "rb"),
100
- back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
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__), "rb"),
119
- back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__), "rb")
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.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: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client