lob 1.10.0 → 1.11.0
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/.gitignore +0 -1
- data/Rakefile +3 -3
- data/examples/checks.rb +4 -1
- data/examples/create_pdf.rb +2 -3
- data/examples/jobs.rb +15 -11
- data/examples/letters.rb +40 -2
- data/examples/postcards.rb +55 -3
- data/lib/lob.rb +1 -2
- data/lib/lob/version.rb +1 -1
- data/lob.gemspec +5 -4
- data/spec/lob/v1/area_spec.rb +2 -8
- data/spec/lob/v1/bank_account_spec.rb +1 -0
- data/spec/lob/v1/check_spec.rb +1 -0
- data/spec/lob/v1/country_spec.rb +1 -0
- data/spec/lob/v1/job_spec.rb +34 -50
- data/spec/lob/v1/letter_spec.rb +0 -1
- data/spec/lob/v1/object_spec.rb +15 -15
- data/spec/lob/v1/postcard_spec.rb +6 -6
- data/spec/lob/v1/route_spec.rb +1 -0
- data/spec/lob/v1/state_spec.rb +1 -0
- metadata +24 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f49c6eee569ce8ae820f9b1cb73be42d8237421
|
4
|
+
data.tar.gz: d8ca2304fd2a2e320e771d260b712b73a96a7c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc75178045eef86ff9633f173c1796544e983a0308890f6932445395bcea7b3c88895812b28ef25bcf4aa41b975c6cbcc8a1c347b742ef671828554343c7a2d1
|
7
|
+
data.tar.gz: 5adfe47244f5282011443dd34ee4c5475482c3e9f3f6604064e96e2fb33f595ce74ac05928089ec7e5386e1afafd11ee0f36ff622d1fb1e6471dea4c466fe42e
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -15,9 +15,9 @@ namespace :dev do
|
|
15
15
|
task :setup do
|
16
16
|
Dir.mkdir("spec/samples") unless File.exist?("spec/samples")
|
17
17
|
files = [
|
18
|
-
{url: "https://
|
19
|
-
{url: "https://
|
20
|
-
{url: "https://s3-us-west-2.amazonaws.com/lob-assets/
|
18
|
+
{url: "https://lob.com/postcardfront.pdf", name: "postcardfront.pdf"},
|
19
|
+
{url: "https://lob.com/postcardback.pdf", name: "postcardback.pdf"},
|
20
|
+
{url: "https://s3-us-west-2.amazonaws.com/lob-assets/letter-goblue.pdf", name: "8.5x11.pdf"},
|
21
21
|
]
|
22
22
|
files.each do |f|
|
23
23
|
system "curl #{f[:url]} -o spec/samples/#{f[:name]}"
|
data/examples/checks.rb
CHANGED
@@ -38,9 +38,12 @@ bank_account = @lob.bank_accounts.create(
|
|
38
38
|
}
|
39
39
|
)
|
40
40
|
|
41
|
+
puts bank_account
|
42
|
+
@lob.bank_accounts.verify(bank_account['id'], amounts: [23, 12])
|
43
|
+
|
41
44
|
# send a $1000 check using an already created bank and address
|
42
45
|
puts @lob.checks.create(
|
43
|
-
|
46
|
+
description: "Test Check",
|
44
47
|
check_number: "10000",
|
45
48
|
bank_account: bank_account["id"],
|
46
49
|
to: to_address["id"],
|
data/examples/create_pdf.rb
CHANGED
@@ -16,10 +16,9 @@ pdf.text 'Print with Lob!', :align => :center, :size => 32
|
|
16
16
|
pdf.render_file 'sample.pdf'
|
17
17
|
|
18
18
|
object = @lob.objects.create(
|
19
|
-
|
19
|
+
description: 'Test Object',
|
20
20
|
file: File.new('sample.pdf'),
|
21
|
-
setting: 201
|
22
|
-
full_bleed: 1
|
21
|
+
setting: 201
|
23
22
|
)
|
24
23
|
|
25
24
|
puts 'You can view your created PDF here: ' + object['url']
|
data/examples/jobs.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
2
|
+
require 'open-uri'
|
3
|
+
require 'prawn'
|
2
4
|
require 'lob'
|
3
5
|
|
4
6
|
# initialize Lob object
|
5
7
|
Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
|
6
8
|
@lob = Lob.load
|
7
9
|
|
8
|
-
|
9
|
-
settings = @lob.settings.list
|
10
|
-
setting_index = settings.find_index { |setting| setting["type"] === "documents" }
|
11
|
-
setting_id = settings[setting_index]["id"]
|
10
|
+
POINTS_PER_INCH = 72 # 72 PostScript Points per Inch
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
pdf = Prawn::Document.new(:page_size => [4.25 * POINTS_PER_INCH, 6.25 * POINTS_PER_INCH])
|
13
|
+
pdf.image open('https://s3-us-west-2.amazonaws.com/lob-assets/printing_icon.png'), :position => :center
|
14
|
+
pdf.text 'Print with Lob!', :align => :center, :size => 32
|
15
|
+
|
16
|
+
pdf.render_file 'sample.pdf'
|
17
|
+
|
18
|
+
object = @lob.objects.create(
|
19
|
+
description: 'Test Object',
|
20
|
+
file: File.new('sample.pdf'),
|
21
|
+
setting: 201
|
18
22
|
)
|
19
23
|
|
20
24
|
# create a to address
|
@@ -40,8 +44,8 @@ from_address = @lob.addresses.create(
|
|
40
44
|
|
41
45
|
# send the object you created
|
42
46
|
puts @lob.jobs.create(
|
43
|
-
|
47
|
+
description: "Michigan Logo to Harry",
|
44
48
|
to: to_address["id"],
|
45
49
|
from: from_address["id"],
|
46
|
-
objects:
|
50
|
+
objects: object["id"]
|
47
51
|
)
|
data/examples/letters.rb
CHANGED
@@ -5,6 +5,42 @@ require 'lob'
|
|
5
5
|
Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
|
6
6
|
@lob = Lob.load
|
7
7
|
|
8
|
+
html = %{
|
9
|
+
<html>
|
10
|
+
<head>
|
11
|
+
<style>
|
12
|
+
*, *:before, *:after {
|
13
|
+
-webkit-box-sizing: border-box;
|
14
|
+
-moz-box-sizing: border-box;
|
15
|
+
box-sizing: border-box;
|
16
|
+
}
|
17
|
+
|
18
|
+
@font-face {
|
19
|
+
font-family: 'Loved by the King';
|
20
|
+
font-style: normal;
|
21
|
+
font-weight: 400;
|
22
|
+
src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
|
23
|
+
}
|
24
|
+
|
25
|
+
.text {
|
26
|
+
margin-left: 75px;
|
27
|
+
padding-top: 250px;
|
28
|
+
width: 400px;
|
29
|
+
font-family: 'Loved by the King';
|
30
|
+
font-size: 50px;
|
31
|
+
font-weight: 700;
|
32
|
+
color: black;
|
33
|
+
}
|
34
|
+
</style>
|
35
|
+
</head>
|
36
|
+
|
37
|
+
<body>
|
38
|
+
<p class="text">Hello {{name}}!<br/><br/>Join us for the {{event}}!</p>
|
39
|
+
</body>
|
40
|
+
|
41
|
+
</html>
|
42
|
+
}
|
43
|
+
|
8
44
|
# create a to address
|
9
45
|
to_address = @lob.addresses.create(
|
10
46
|
name: "ToAddress",
|
@@ -30,6 +66,8 @@ puts @lob.letters.create(
|
|
30
66
|
description: "Test letter",
|
31
67
|
to: to_address["id"],
|
32
68
|
from: from_address["id"],
|
33
|
-
file:
|
34
|
-
|
69
|
+
file: html,
|
70
|
+
data: { name: 'Albert', event: 'HTML Letter Conference'},
|
71
|
+
metadata: { campaign: 'HTML 1.0' },
|
72
|
+
color: false
|
35
73
|
)
|
data/examples/postcards.rb
CHANGED
@@ -5,6 +5,56 @@ require 'lob'
|
|
5
5
|
Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
|
6
6
|
@lob = Lob.load
|
7
7
|
|
8
|
+
# HTML to send to the server
|
9
|
+
html = %{
|
10
|
+
<html>
|
11
|
+
<head>
|
12
|
+
<title>Lob.com Sample 4x6 Postcard Front</title>
|
13
|
+
<style>
|
14
|
+
*, *:before, *:after {
|
15
|
+
-webkit-box-sizing: border-box;
|
16
|
+
-moz-box-sizing: border-box;
|
17
|
+
box-sizing: border-box;
|
18
|
+
}
|
19
|
+
|
20
|
+
@font-face {
|
21
|
+
font-family: 'Loved by the King';
|
22
|
+
font-style: normal;
|
23
|
+
font-weight: 400;
|
24
|
+
src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
|
25
|
+
}
|
26
|
+
|
27
|
+
body {
|
28
|
+
width: 6.25in;
|
29
|
+
height: 4.25in;
|
30
|
+
margin: 0;
|
31
|
+
padding: 0;
|
32
|
+
/* If using an image, the background image should have dimensions of 1875x1275 pixels. */
|
33
|
+
background-image: url(https://s3-us-west-2.amazonaws.com/lob-assets/beach.jpg);
|
34
|
+
background-size: 6.25in 4.25in;
|
35
|
+
background-repeat: no-repeat;
|
36
|
+
}
|
37
|
+
|
38
|
+
.text {
|
39
|
+
margin: 50px;
|
40
|
+
width: 400px;
|
41
|
+
font-family: 'Loved by the King';
|
42
|
+
font-size: 50px;
|
43
|
+
font-weight: 700;
|
44
|
+
color: white;
|
45
|
+
text-shadow: 3px 3px black;
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<h1 class="text">Hello {{name}}!</h1>
|
52
|
+
<p class="text">Join us for the {{event}}!</p>
|
53
|
+
</body>
|
54
|
+
|
55
|
+
</html>
|
56
|
+
}
|
57
|
+
|
8
58
|
# create a to address
|
9
59
|
to_address = @lob.addresses.create(
|
10
60
|
name: "ToAddress",
|
@@ -27,9 +77,11 @@ from_address = @lob.addresses.create(
|
|
27
77
|
|
28
78
|
# send a postcard
|
29
79
|
puts @lob.postcards.create(
|
30
|
-
|
80
|
+
description: "Beach Postcard",
|
31
81
|
to: to_address["id"],
|
32
82
|
from: from_address["id"],
|
33
|
-
|
34
|
-
|
83
|
+
metadata: { campaign: "Summer 2015 Beach" },
|
84
|
+
data: { name: "Albert", event: "Summer 2015 Beach-athon" },
|
85
|
+
front: html,
|
86
|
+
message: "Please RSVP as soon as possible to reserve your lounge chair."
|
35
87
|
)
|
data/lib/lob.rb
CHANGED
@@ -53,8 +53,7 @@ module Lob
|
|
53
53
|
def self.handle_api_error(error)
|
54
54
|
begin
|
55
55
|
response = JSON.parse(error.http_body)
|
56
|
-
|
57
|
-
message = error_obj["message"]
|
56
|
+
message = response["error"]["message"]
|
58
57
|
raise InvalidRequestError.new(message, error.http_code, error.http_body, error.response)
|
59
58
|
rescue JSON::ParserError
|
60
59
|
raise LobError.new("Invalid response object: #{}", error.http_code, error.http_body)
|
data/lib/lob/version.rb
CHANGED
data/lob.gemspec
CHANGED
@@ -18,16 +18,17 @@ 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.
|
21
|
+
spec.add_dependency "rest-client", "~> 1.8"
|
22
22
|
|
23
23
|
spec.add_dependency "prawn"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
-
spec.add_development_dependency "rake", "~> 10.
|
26
|
+
spec.add_development_dependency "rake", "~> 10.4.2"
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.6.1"
|
27
28
|
spec.add_development_dependency "webmock", "~> 1.2"
|
28
29
|
spec.add_development_dependency "travis-lint", "~> 2.0.0"
|
29
30
|
spec.add_development_dependency "vcr", "~> 2.9.2"
|
30
|
-
spec.add_development_dependency "coveralls", "~> 0.
|
31
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
31
|
+
spec.add_development_dependency "coveralls", "~> 0.8.1"
|
32
|
+
spec.add_development_dependency "simplecov", "~> 0.10.0"
|
32
33
|
spec.add_development_dependency "pry", "~> 0.10.0"
|
33
34
|
end
|
data/spec/lob/v1/area_spec.rb
CHANGED
@@ -3,6 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Lob::V1::Area do
|
4
4
|
before :each do
|
5
5
|
@sample_area_params = {
|
6
|
+
description: "Test Area",
|
6
7
|
front: "https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf",
|
7
8
|
back: "https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf",
|
8
9
|
routes: ["94158-C001", "94107-C031"],
|
@@ -14,7 +15,6 @@ describe Lob::V1::Area do
|
|
14
15
|
describe "list" do
|
15
16
|
it "should list areas" do
|
16
17
|
VCR.use_cassette('list_areas') do
|
17
|
-
@sample_area_params[:name] = "Test Area"
|
18
18
|
new_area = subject.areas.create @sample_area_params
|
19
19
|
|
20
20
|
list_result = subject.areas.list
|
@@ -35,16 +35,11 @@ describe Lob::V1::Area do
|
|
35
35
|
|
36
36
|
it "should create an area object with optionals params" do
|
37
37
|
VCR.use_cassette('create_area_object_with_optional_params') do
|
38
|
-
@sample_area_params[:name] = "123456789"
|
39
38
|
@sample_area_params[:target_type] = "all"
|
40
|
-
@sample_area_params[:full_bleed] = "1"
|
41
39
|
|
42
40
|
result = subject.areas.create @sample_area_params
|
43
41
|
|
44
42
|
result["name"].must_equal @sample_area_params[:name]
|
45
|
-
result["target_type"].must_equal @sample_area_params[:target_type]
|
46
|
-
# TODO this should be added when Lob API is updated
|
47
|
-
# result["full_bleed"].must_equal(@sample_area_params[:full_bleed])
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
@@ -70,11 +65,10 @@ describe Lob::V1::Area do
|
|
70
65
|
describe "find" do
|
71
66
|
it "should find an area" do
|
72
67
|
VCR.use_cassette('find_area') do
|
73
|
-
@sample_area_params[:name] = "Test Area"
|
74
68
|
new_area = subject.areas.create @sample_area_params
|
75
69
|
|
76
70
|
result = subject.areas.find new_area["id"]
|
77
|
-
result["
|
71
|
+
result["object"].must_equal("area")
|
78
72
|
end
|
79
73
|
end
|
80
74
|
end
|
data/spec/lob/v1/check_spec.rb
CHANGED
data/spec/lob/v1/country_spec.rb
CHANGED
data/spec/lob/v1/job_spec.rb
CHANGED
@@ -14,39 +14,37 @@ describe Lob::V1::Job do
|
|
14
14
|
zip: 94085
|
15
15
|
}
|
16
16
|
|
17
|
-
@sample_job_params = {
|
18
|
-
@sample_object_params = {
|
17
|
+
@sample_job_params = { description: "TestJob" }
|
18
|
+
@sample_object_params = { description: "TestObject" }
|
19
19
|
@test_setting_id = 201
|
20
20
|
end
|
21
21
|
|
22
22
|
subject { Lob(api_key: ENV["LOB_API_KEY"]) }
|
23
23
|
|
24
|
-
|
25
24
|
describe "list" do
|
26
25
|
it "should list jobs" do
|
27
26
|
VCR.use_cassette('list_jobs') do
|
28
27
|
new_address = subject.addresses.create @sample_address_params
|
29
28
|
settings_list = subject.settings.list
|
30
29
|
new_object = subject.objects.create(
|
31
|
-
|
32
|
-
file: "https://
|
30
|
+
description: @sample_object_params[:description],
|
31
|
+
file: "https://lob.com/postcardfront.pdf",
|
33
32
|
setting: @test_setting_id
|
34
33
|
)
|
35
34
|
|
36
35
|
new_job = subject.jobs.create(
|
37
|
-
|
36
|
+
description: @sample_job_params[:description],
|
38
37
|
from: new_address["id"],
|
39
38
|
to: new_address["id"],
|
40
39
|
objects: new_object["id"]
|
41
40
|
)
|
42
41
|
|
43
42
|
list_result = subject.jobs.list
|
44
|
-
assert /#{new_job["
|
43
|
+
assert /#{new_job["description"]}/ =~ list_result.to_s
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
49
|
-
|
50
48
|
describe "create" do
|
51
49
|
it "should create a job with address_id" do
|
52
50
|
VCR.use_cassette('create_job_with_address_id') do
|
@@ -54,22 +52,21 @@ describe Lob::V1::Job do
|
|
54
52
|
|
55
53
|
settings_list = subject.settings.list
|
56
54
|
new_object = subject.objects.create(
|
57
|
-
|
58
|
-
file: "https://
|
55
|
+
description: @sample_object_params[:description],
|
56
|
+
file: "https://lob.com/postcardfront.pdf",
|
59
57
|
setting: @test_setting_id
|
60
58
|
)
|
61
59
|
|
62
60
|
result = subject.jobs.create(
|
63
|
-
|
61
|
+
description: @sample_job_params[:description],
|
64
62
|
from: new_address["id"],
|
65
63
|
to: new_address["id"],
|
66
64
|
objects: new_object["id"]
|
67
65
|
)
|
68
|
-
result["
|
66
|
+
result["description"].must_equal(@sample_job_params[:description])
|
69
67
|
end
|
70
68
|
end
|
71
69
|
|
72
|
-
|
73
70
|
it "should be able to create multiple jobs" do
|
74
71
|
VCR.use_cassette('create_multiple_jobs') do
|
75
72
|
new_address = subject.addresses.create @sample_address_params
|
@@ -77,108 +74,95 @@ describe Lob::V1::Job do
|
|
77
74
|
settings_list = subject.settings.list
|
78
75
|
|
79
76
|
new_object_params = {
|
80
|
-
|
81
|
-
file:
|
77
|
+
description: @sample_object_params[:description],
|
78
|
+
file: "https://lob.com/postcardfront.pdf",
|
82
79
|
setting: 500
|
83
80
|
}
|
84
81
|
|
85
82
|
another_object_params = {
|
86
|
-
|
87
|
-
file:
|
83
|
+
description: "Another #{@sample_object_params[:description]}",
|
84
|
+
file: "https://lob.com/postcardfront.pdf",
|
88
85
|
setting: 500
|
89
86
|
}
|
90
87
|
|
91
88
|
result = subject.jobs.create(
|
92
|
-
|
89
|
+
description: @sample_job_params[:description],
|
93
90
|
from: new_address["id"],
|
94
91
|
to: new_address["id"],
|
95
92
|
objects: [new_object_params, another_object_params]
|
96
93
|
)
|
97
94
|
|
98
|
-
result["
|
95
|
+
result["description"].must_equal(@sample_job_params[:description])
|
99
96
|
end
|
100
97
|
end
|
101
98
|
|
102
|
-
|
103
|
-
|
104
99
|
it "should be able to create jobs from a mix of remote and local files" do
|
105
100
|
VCR.use_cassette('create_multiple_jobs_from_mix_of_remote_and_local_files') do
|
106
101
|
new_address = subject.addresses.create @sample_address_params
|
107
102
|
|
108
103
|
new_object_params = {
|
109
|
-
|
110
|
-
file:
|
104
|
+
description: @sample_object_params[:description],
|
105
|
+
file: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
111
106
|
setting: 500
|
112
107
|
}
|
113
108
|
|
114
109
|
another_object_params = {
|
115
|
-
|
116
|
-
file:
|
110
|
+
description: "Another #{@sample_object_params[:description]}",
|
111
|
+
file: "https://lob.com/postcardfront.pdf",
|
117
112
|
setting: 500
|
118
113
|
}
|
119
114
|
|
120
115
|
result = subject.jobs.create(
|
121
|
-
|
116
|
+
description: @sample_job_params[:description],
|
122
117
|
from: new_address["id"],
|
123
118
|
to: new_address["id"],
|
124
119
|
objects: [new_object_params, another_object_params]
|
125
120
|
)
|
126
121
|
|
127
|
-
|
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])
|
122
|
+
result["description"].must_equal(@sample_job_params[:description])
|
135
123
|
end
|
136
124
|
end
|
137
125
|
|
138
|
-
|
139
|
-
|
140
126
|
it "should create a job with address params" do
|
141
127
|
VCR.use_cassette('create_job_with_address_params') do
|
142
128
|
settings_list = subject.settings.list
|
143
129
|
new_object = subject.objects.create(
|
144
|
-
|
145
|
-
file: "https://
|
130
|
+
description: @sample_object_params[:description],
|
131
|
+
file: "https://lob.com/postcardfront.pdf",
|
146
132
|
setting: @test_setting_id
|
147
133
|
)
|
148
134
|
|
149
135
|
result = subject.jobs.create(
|
150
|
-
|
136
|
+
description: @sample_job_params[:description],
|
151
137
|
from: @sample_address_params,
|
152
138
|
to: @sample_address_params,
|
153
139
|
objects: new_object["id"]
|
154
140
|
)
|
155
|
-
result["
|
141
|
+
result["description"].must_equal(@sample_job_params[:description])
|
156
142
|
end
|
157
143
|
end
|
158
144
|
|
159
|
-
|
160
145
|
it "should create a job with object params" do
|
161
146
|
VCR.use_cassette('create_job_with_object_params') do
|
162
147
|
new_address = subject.addresses.create @sample_address_params
|
163
148
|
settings_list = subject.settings.list
|
164
149
|
new_object_params = {
|
165
|
-
|
166
|
-
file:
|
150
|
+
description: @sample_object_params[:description],
|
151
|
+
file: "https://lob.com/postcardfront.pdf",
|
167
152
|
setting: @test_setting_id
|
168
153
|
}
|
169
154
|
|
170
155
|
result = subject.jobs.create(
|
171
|
-
|
156
|
+
description: @sample_job_params[:description],
|
172
157
|
from: new_address["id"],
|
173
158
|
to: new_address["id"],
|
174
159
|
objects: new_object_params
|
175
160
|
)
|
176
|
-
result["
|
161
|
+
result["description"].must_equal(@sample_job_params[:description])
|
177
162
|
end
|
178
163
|
end
|
179
164
|
end
|
180
165
|
|
181
|
-
|
182
166
|
describe "find" do
|
183
167
|
it "should find a job" do
|
184
168
|
VCR.use_cassette('find_job') do
|
@@ -186,20 +170,20 @@ describe Lob::V1::Job do
|
|
186
170
|
|
187
171
|
settings_list = subject.settings.list
|
188
172
|
new_object = subject.objects.create(
|
189
|
-
|
190
|
-
file: "https://
|
173
|
+
description: @sample_object_params[:description],
|
174
|
+
file: "https://lob.com/postcardfront.pdf",
|
191
175
|
setting: @test_setting_id
|
192
176
|
)
|
193
177
|
|
194
178
|
new_job = subject.jobs.create(
|
195
|
-
|
179
|
+
description: @sample_job_params[:description],
|
196
180
|
from: new_address["id"],
|
197
181
|
to: new_address["id"],
|
198
182
|
objects: new_object["id"]
|
199
183
|
)
|
200
184
|
|
201
185
|
result = subject.jobs.find(new_job["id"])
|
202
|
-
result["
|
186
|
+
result["description"].must_equal(@sample_job_params[:description])
|
203
187
|
end
|
204
188
|
end
|
205
189
|
end
|
data/spec/lob/v1/letter_spec.rb
CHANGED
data/spec/lob/v1/object_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Lob::V1::Object do
|
|
4
4
|
|
5
5
|
before :each do
|
6
6
|
@sample_params = {
|
7
|
-
|
7
|
+
description: "TestObject",
|
8
8
|
}
|
9
9
|
@test_setting_id = 201
|
10
10
|
end
|
@@ -16,13 +16,13 @@ describe Lob::V1::Object do
|
|
16
16
|
VCR.use_cassette('list_objects') do
|
17
17
|
settings_list = subject.settings.list
|
18
18
|
new_object = subject.objects.create(
|
19
|
-
|
20
|
-
file: "https://
|
19
|
+
description: @sample_params[:description],
|
20
|
+
file: "https://lob.com/postcardfront.pdf",
|
21
21
|
setting: @test_setting_id
|
22
22
|
)
|
23
23
|
|
24
24
|
list_result = subject.objects.list
|
25
|
-
assert /#{new_object["
|
25
|
+
assert /#{new_object["description"]}/ =~ list_result.to_s
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -32,12 +32,12 @@ describe Lob::V1::Object do
|
|
32
32
|
VCR.use_cassette('create_object_with_url') do
|
33
33
|
settings_list = subject.settings.list
|
34
34
|
result = subject.objects.create(
|
35
|
-
|
36
|
-
file: "https://
|
35
|
+
description: @sample_params[:description],
|
36
|
+
file: "https://lob.com/postcardfront.pdf",
|
37
37
|
setting: @test_setting_id
|
38
38
|
)
|
39
39
|
|
40
|
-
result["
|
40
|
+
result["description"].must_equal(@sample_params[:description])
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,12 +45,12 @@ describe Lob::V1::Object do
|
|
45
45
|
VCR.use_cassette('create_object_with_file') do
|
46
46
|
settings_list = subject.settings.list
|
47
47
|
result = subject.objects.create(
|
48
|
-
|
49
|
-
file: File.new(File.expand_path("../../../samples/
|
48
|
+
description: @sample_params[:description],
|
49
|
+
file: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__), "rb"),
|
50
50
|
setting: @test_setting_id
|
51
51
|
)
|
52
52
|
|
53
|
-
result["
|
53
|
+
result["description"].must_equal(@sample_params[:description])
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -60,13 +60,13 @@ describe Lob::V1::Object do
|
|
60
60
|
VCR.use_cassette('find_object') do
|
61
61
|
settings_list = subject.settings.list
|
62
62
|
new_object = subject.objects.create(
|
63
|
-
|
64
|
-
file: "https://
|
63
|
+
description: @sample_params[:description],
|
64
|
+
file: "https://lob.com/postcardfront.pdf",
|
65
65
|
setting: @test_setting_id
|
66
66
|
)
|
67
67
|
|
68
68
|
find_result = subject.objects.find(new_object["id"])
|
69
|
-
find_result["
|
69
|
+
find_result["description"].must_equal(@sample_params[:description])
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -76,8 +76,8 @@ describe Lob::V1::Object do
|
|
76
76
|
VCR.use_cassette('delete_object') do
|
77
77
|
settings_list = subject.settings.list
|
78
78
|
new_object = subject.objects.create(
|
79
|
-
|
80
|
-
file: "https://
|
79
|
+
description: @sample_params[:description],
|
80
|
+
file: "https://lob.com/postcardfront.pdf",
|
81
81
|
setting: @test_setting_id
|
82
82
|
)
|
83
83
|
|
@@ -15,7 +15,7 @@ describe Lob::V1::Postcard do
|
|
15
15
|
}
|
16
16
|
|
17
17
|
@sample_postcard_params = {
|
18
|
-
|
18
|
+
description: "TestPostcard",
|
19
19
|
message: "Sample postcard message"
|
20
20
|
}
|
21
21
|
end
|
@@ -50,7 +50,7 @@ describe Lob::V1::Postcard do
|
|
50
50
|
name: @sample_postcard_params[:name],
|
51
51
|
to: new_address["id"],
|
52
52
|
message: @sample_postcard_params[:message],
|
53
|
-
front: "https://
|
53
|
+
front: "https://lob.com/postcardfront.pdf",
|
54
54
|
)
|
55
55
|
|
56
56
|
result["name"].must_equal(@sample_postcard_params[:name])
|
@@ -63,7 +63,7 @@ describe Lob::V1::Postcard do
|
|
63
63
|
name: @sample_postcard_params[:name],
|
64
64
|
to: @sample_address_params,
|
65
65
|
message: @sample_postcard_params[:message],
|
66
|
-
front: "https://
|
66
|
+
front: "https://lob.com/postcardfront.pdf"
|
67
67
|
)
|
68
68
|
|
69
69
|
result["name"].must_equal(@sample_postcard_params[:name])
|
@@ -79,7 +79,7 @@ describe Lob::V1::Postcard do
|
|
79
79
|
to: new_address["id"],
|
80
80
|
from: @sample_address_params,
|
81
81
|
message: @sample_postcard_params[:message],
|
82
|
-
front: "https://
|
82
|
+
front: "https://lob.com/postcardfront.pdf"
|
83
83
|
)
|
84
84
|
|
85
85
|
result["name"].must_equal(@sample_postcard_params[:name])
|
@@ -93,8 +93,8 @@ describe Lob::V1::Postcard do
|
|
93
93
|
result = subject.postcards.create(
|
94
94
|
name: @sample_postcard_params[:name],
|
95
95
|
to: new_address["id"],
|
96
|
-
front: "https://
|
97
|
-
back: "https://
|
96
|
+
front: "https://lob.com/postcardfront.pdf",
|
97
|
+
back: "https://lob.com/postcardback.pdf"
|
98
98
|
)
|
99
99
|
|
100
100
|
result["name"].must_equal(@sample_postcard_params[:name])
|
data/spec/lob/v1/route_spec.rb
CHANGED
data/spec/lob/v1/state_spec.rb
CHANGED
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.8'
|
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.
|
26
|
+
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: prawn
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 10.
|
61
|
+
version: 10.4.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 10.
|
68
|
+
version: 10.4.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.6.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.6.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: webmock
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,28 +128,28 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - ~>
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
131
|
+
version: 0.8.1
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - ~>
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
138
|
+
version: 0.8.1
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: simplecov
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - ~>
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
145
|
+
version: 0.10.0
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - ~>
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
152
|
+
version: 0.10.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: pry
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,7 +220,6 @@ files:
|
|
206
220
|
- spec/lob/v1/setting_spec.rb
|
207
221
|
- spec/lob/v1/state_spec.rb
|
208
222
|
- spec/lob_spec.rb
|
209
|
-
- spec/samples/8.5x11.pdf
|
210
223
|
- spec/spec_helper.rb
|
211
224
|
homepage: https://github.com/lob/lob-ruby
|
212
225
|
licenses:
|
@@ -250,5 +263,4 @@ test_files:
|
|
250
263
|
- spec/lob/v1/setting_spec.rb
|
251
264
|
- spec/lob/v1/state_spec.rb
|
252
265
|
- spec/lob_spec.rb
|
253
|
-
- spec/samples/8.5x11.pdf
|
254
266
|
- spec/spec_helper.rb
|