lob 1.13.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +0 -4
- data/CHANGELOG.md +10 -0
- data/README.md +2 -7
- data/Rakefile +0 -19
- data/lib/lob.rb +2 -8
- data/lib/lob/v1/address.rb +3 -4
- data/lib/lob/v1/area.rb +1 -1
- data/lib/lob/v1/bank_account.rb +1 -9
- data/lib/lob/v1/check.rb +1 -5
- data/lib/lob/v1/country.rb +1 -1
- data/lib/lob/v1/job.rb +1 -9
- data/lib/lob/v1/letter.rb +1 -11
- data/lib/lob/v1/object.rb +1 -1
- data/lib/lob/v1/postcard.rb +1 -9
- data/lib/lob/v1/resource.rb +0 -16
- data/lib/lob/v1/route.rb +1 -1
- data/lib/lob/v1/service.rb +1 -1
- data/lib/lob/v1/setting.rb +1 -1
- data/lib/lob/v1/state.rb +1 -1
- data/lib/lob/version.rb +1 -1
- data/lob.gemspec +0 -1
- data/spec/lob/v1/address_spec.rb +21 -34
- data/spec/lob/v1/area_spec.rb +15 -31
- data/spec/lob/v1/bank_account_spec.rb +57 -80
- data/spec/lob/v1/check_spec.rb +44 -69
- data/spec/lob/v1/country_spec.rb +1 -4
- data/spec/lob/v1/job_spec.rb +114 -144
- data/spec/lob/v1/letter_spec.rb +39 -58
- data/spec/lob/v1/object_spec.rb +31 -49
- data/spec/lob/v1/postcard_spec.rb +65 -89
- data/spec/lob/v1/resource_spec.rb +1 -6
- data/spec/lob/v1/route_spec.rb +3 -7
- data/spec/lob/v1/service_spec.rb +1 -4
- data/spec/lob/v1/setting_spec.rb +4 -12
- data/spec/lob/v1/state_spec.rb +1 -4
- data/spec/lob_spec.rb +2 -6
- data/spec/samples/8.5x11.pdf +0 -0
- data/spec/samples/postcardback.pdf +2288 -1
- data/spec/samples/postcardfront.pdf +1550 -0
- data/spec/spec_helper.rb +0 -6
- metadata +8 -19
- data/lib/lob/v1/packaging.rb +0 -21
- data/spec/lob/v1/packaging_spec.rb +0 -16
data/spec/lob/v1/letter_spec.rb
CHANGED
@@ -8,10 +8,10 @@ describe Lob::V1::Letter do
|
|
8
8
|
email: "test@test.com",
|
9
9
|
address_line1: "123 Test Street",
|
10
10
|
address_line2: "Unit 199",
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
address_city: "Mountain View",
|
12
|
+
address_state: "CA",
|
13
|
+
address_country: "US",
|
14
|
+
address_zip: 94085
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
@@ -19,75 +19,56 @@ describe Lob::V1::Letter do
|
|
19
19
|
|
20
20
|
describe "list" do
|
21
21
|
it "should list letter" do
|
22
|
-
|
23
|
-
new_address = subject.addresses.create @sample_address_params
|
24
|
-
|
25
|
-
new_letter = subject.letters.create(
|
26
|
-
description: "TestLetter",
|
27
|
-
color: true,
|
28
|
-
file: "https://s3-us-west-2.amazonaws.com/lob-assets/letter-goblue.pdf",
|
29
|
-
to: new_address["id"],
|
30
|
-
from: new_address["id"]
|
31
|
-
)
|
32
|
-
|
33
|
-
list_result = subject.letters.list
|
34
|
-
assert /#{new_letter["description"]}/ =~ list_result.to_s
|
35
|
-
end
|
22
|
+
assert subject.letters.list["object"] == "list"
|
36
23
|
end
|
37
24
|
end
|
38
25
|
|
39
26
|
|
40
27
|
describe "create" do
|
41
28
|
it "should create a letter with address_id" do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
new_letter["description"].must_equal("TestLetter")
|
54
|
-
end
|
29
|
+
new_address = subject.addresses.create @sample_address_params
|
30
|
+
|
31
|
+
new_letter = subject.letters.create(
|
32
|
+
description: "TestLetter",
|
33
|
+
color: true,
|
34
|
+
file: "https://s3-us-west-2.amazonaws.com/lob-assets/letter-goblue.pdf",
|
35
|
+
to: new_address["id"],
|
36
|
+
from: @sample_address_params
|
37
|
+
)
|
38
|
+
|
39
|
+
new_letter["description"].must_equal("TestLetter")
|
55
40
|
end
|
56
41
|
|
57
42
|
it "should create a letter with a local file" do
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
new_letter["description"].must_equal("TestLetter")
|
70
|
-
end
|
43
|
+
new_address = subject.addresses.create @sample_address_params
|
44
|
+
|
45
|
+
new_letter = subject.letters.create(
|
46
|
+
description: "TestLetter",
|
47
|
+
color: true,
|
48
|
+
file: File.new(File.expand_path("../../../samples/8.5x11.pdf", __FILE__)),
|
49
|
+
to: new_address["id"],
|
50
|
+
from: @sample_address_params
|
51
|
+
)
|
52
|
+
|
53
|
+
new_letter["description"].must_equal("TestLetter")
|
71
54
|
end
|
72
55
|
end
|
73
56
|
|
74
57
|
|
75
58
|
describe "find" do
|
76
59
|
it "should find a letter" do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
assert /#{new_letter["description"]}/ =~ result.to_s
|
90
|
-
end
|
60
|
+
new_address = subject.addresses.create @sample_address_params
|
61
|
+
|
62
|
+
new_letter = subject.letters.create(
|
63
|
+
description: "TestLetter",
|
64
|
+
color: true,
|
65
|
+
file: "https://s3-us-west-2.amazonaws.com/lob-assets/letter-goblue.pdf",
|
66
|
+
to: new_address["id"],
|
67
|
+
from: new_address["id"]
|
68
|
+
)
|
69
|
+
|
70
|
+
result = subject.letters.find(new_letter["id"])
|
71
|
+
assert /#{new_letter["description"]}/ =~ result.to_s
|
91
72
|
end
|
92
73
|
end
|
93
74
|
|
data/spec/lob/v1/object_spec.rb
CHANGED
@@ -13,77 +13,59 @@ describe Lob::V1::Object do
|
|
13
13
|
|
14
14
|
describe "list" do
|
15
15
|
it "should list objects" do
|
16
|
-
|
17
|
-
settings_list = subject.settings.list
|
18
|
-
new_object = subject.objects.create(
|
19
|
-
description: @sample_params[:description],
|
20
|
-
file: "https://lob.com/postcardfront.pdf",
|
21
|
-
setting: @test_setting_id
|
22
|
-
)
|
23
|
-
|
24
|
-
list_result = subject.objects.list
|
25
|
-
assert /#{new_object["description"]}/ =~ list_result.to_s
|
26
|
-
end
|
16
|
+
assert subject.objects.list["object"] == "list"
|
27
17
|
end
|
28
18
|
end
|
29
19
|
|
30
20
|
describe "create" do
|
31
21
|
it "should create an object with file url" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
)
|
22
|
+
settings_list = subject.settings.list
|
23
|
+
result = subject.objects.create(
|
24
|
+
description: @sample_params[:description],
|
25
|
+
file: "https://lob.com/postcardfront.pdf",
|
26
|
+
setting: @test_setting_id
|
27
|
+
)
|
39
28
|
|
40
|
-
|
41
|
-
end
|
29
|
+
result["description"].must_equal(@sample_params[:description])
|
42
30
|
end
|
43
31
|
|
44
32
|
it "should create an object with file" do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
)
|
33
|
+
settings_list = subject.settings.list
|
34
|
+
result = subject.objects.create(
|
35
|
+
description: @sample_params[:description],
|
36
|
+
file: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__), "rb"),
|
37
|
+
setting: @test_setting_id
|
38
|
+
)
|
52
39
|
|
53
|
-
|
54
|
-
end
|
40
|
+
result["description"].must_equal(@sample_params[:description])
|
55
41
|
end
|
56
42
|
end
|
57
43
|
|
58
44
|
describe "find" do
|
59
45
|
it "should find an object" do
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
)
|
46
|
+
settings_list = subject.settings.list
|
47
|
+
new_object = subject.objects.create(
|
48
|
+
description: @sample_params[:description],
|
49
|
+
file: "https://lob.com/postcardfront.pdf",
|
50
|
+
setting: @test_setting_id
|
51
|
+
)
|
67
52
|
|
68
|
-
|
69
|
-
|
70
|
-
end
|
53
|
+
find_result = subject.objects.find(new_object["id"])
|
54
|
+
find_result["description"].must_equal(@sample_params[:description])
|
71
55
|
end
|
72
56
|
end
|
73
57
|
|
74
58
|
describe "destroy" do
|
75
59
|
it "should delete an object" do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
)
|
60
|
+
settings_list = subject.settings.list
|
61
|
+
new_object = subject.objects.create(
|
62
|
+
description: @sample_params[:description],
|
63
|
+
file: "https://lob.com/postcardfront.pdf",
|
64
|
+
setting: @test_setting_id
|
65
|
+
)
|
83
66
|
|
84
|
-
|
85
|
-
|
86
|
-
end
|
67
|
+
delete_result = subject.objects.destroy(new_object["id"])
|
68
|
+
assert_equal(new_object["id"], delete_result["id"])
|
87
69
|
end
|
88
70
|
end
|
89
71
|
|
@@ -8,10 +8,10 @@ describe Lob::V1::Postcard do
|
|
8
8
|
email: "test@test.com",
|
9
9
|
address_line1: "123 Test Street",
|
10
10
|
address_line2: "Unit 199",
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
address_city: "Mountain View",
|
12
|
+
address_state: "CA",
|
13
|
+
address_country: "US",
|
14
|
+
address_zip: 94085
|
15
15
|
}
|
16
16
|
|
17
17
|
@sample_postcard_params = {
|
@@ -24,97 +24,75 @@ describe Lob::V1::Postcard do
|
|
24
24
|
|
25
25
|
describe "list" do
|
26
26
|
it "should list postcards" do
|
27
|
-
|
28
|
-
new_address = subject.addresses.create @sample_address_params
|
29
|
-
|
30
|
-
new_postcard = subject.postcards.create(
|
31
|
-
name: @sample_postcard_params[:name],
|
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__))
|
35
|
-
)
|
36
|
-
|
37
|
-
list_result = subject.postcards.list
|
38
|
-
assert /#{new_postcard["name"]}/ =~ list_result.to_s
|
39
|
-
end
|
27
|
+
assert subject.postcards.list["object"] == "list"
|
40
28
|
end
|
41
29
|
end
|
42
30
|
|
43
31
|
|
44
32
|
describe "create" do
|
45
33
|
it "should create a postcard with address_id" do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
57
|
-
end
|
34
|
+
new_address = subject.addresses.create @sample_address_params
|
35
|
+
|
36
|
+
result = subject.postcards.create(
|
37
|
+
name: @sample_postcard_params[:name],
|
38
|
+
to: new_address["id"],
|
39
|
+
message: @sample_postcard_params[:message],
|
40
|
+
front: "https://lob.com/postcardfront.pdf",
|
41
|
+
)
|
42
|
+
|
43
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
58
44
|
end
|
59
45
|
|
60
46
|
it "should create a postcard with to address params" do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
70
|
-
end
|
47
|
+
result = subject.postcards.create(
|
48
|
+
name: @sample_postcard_params[:name],
|
49
|
+
to: @sample_address_params,
|
50
|
+
message: @sample_postcard_params[:message],
|
51
|
+
front: "https://lob.com/postcardfront.pdf"
|
52
|
+
)
|
53
|
+
|
54
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
71
55
|
end
|
72
56
|
|
73
57
|
it "should create a postcard with from address params" do
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
86
|
-
end
|
58
|
+
new_address = subject.addresses.create @sample_address_params
|
59
|
+
|
60
|
+
result = subject.postcards.create(
|
61
|
+
name: @sample_postcard_params[:name],
|
62
|
+
to: new_address["id"],
|
63
|
+
from: @sample_address_params,
|
64
|
+
message: @sample_postcard_params[:message],
|
65
|
+
front: "https://lob.com/postcardfront.pdf"
|
66
|
+
)
|
67
|
+
|
68
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
87
69
|
end
|
88
70
|
|
89
71
|
it "should create a postcard with front and back as urls" do
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
101
|
-
end
|
72
|
+
new_address = subject.addresses.create @sample_address_params
|
73
|
+
|
74
|
+
result = subject.postcards.create(
|
75
|
+
name: @sample_postcard_params[:name],
|
76
|
+
to: new_address["id"],
|
77
|
+
front: "https://lob.com/postcardfront.pdf",
|
78
|
+
back: "https://lob.com/postcardback.pdf"
|
79
|
+
)
|
80
|
+
|
81
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
102
82
|
end
|
103
83
|
|
104
84
|
|
105
85
|
it "should create a postcard with front and back as PDFs" do
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
117
|
-
end
|
86
|
+
new_address = subject.addresses.create @sample_address_params
|
87
|
+
|
88
|
+
result = subject.postcards.create(
|
89
|
+
name: @sample_postcard_params[:name],
|
90
|
+
to: new_address["id"],
|
91
|
+
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
92
|
+
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__))
|
93
|
+
)
|
94
|
+
|
95
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
118
96
|
end
|
119
97
|
|
120
98
|
end
|
@@ -122,19 +100,17 @@ describe Lob::V1::Postcard do
|
|
122
100
|
|
123
101
|
describe "find" do
|
124
102
|
it "should find a postcard" do
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
result["name"].must_equal(@sample_postcard_params[:name])
|
137
|
-
end
|
103
|
+
new_address = subject.addresses.create @sample_address_params
|
104
|
+
|
105
|
+
new_postcard = subject.postcards.create(
|
106
|
+
name: @sample_postcard_params[:name],
|
107
|
+
to: new_address["id"],
|
108
|
+
front: File.new(File.expand_path("../../../samples/postcardfront.pdf", __FILE__)),
|
109
|
+
back: File.new(File.expand_path("../../../samples/postcardback.pdf", __FILE__))
|
110
|
+
)
|
111
|
+
|
112
|
+
result = subject.postcards.find(new_postcard["id"])
|
113
|
+
result["name"].must_equal(@sample_postcard_params[:name])
|
138
114
|
end
|
139
115
|
end
|
140
116
|
|
@@ -19,7 +19,6 @@ describe Lob::V1::Resource do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
22
|
it "should return addresses resource" do
|
24
23
|
subject.addresses.must_be_kind_of(Lob::V1::Address)
|
25
24
|
end
|
@@ -32,10 +31,6 @@ describe Lob::V1::Resource do
|
|
32
31
|
subject.objects.must_be_kind_of(Lob::V1::Object)
|
33
32
|
end
|
34
33
|
|
35
|
-
it "should return packagings resource" do
|
36
|
-
subject.packagings.must_be_kind_of(Lob::V1::Packaging)
|
37
|
-
end
|
38
|
-
|
39
34
|
it "should return postcards resource" do
|
40
35
|
subject.postcards.must_be_kind_of(Lob::V1::Postcard)
|
41
36
|
end
|
@@ -43,7 +38,7 @@ describe Lob::V1::Resource do
|
|
43
38
|
it "should return services resource" do
|
44
39
|
subject.services.must_be_kind_of(Lob::V1::Service)
|
45
40
|
end
|
46
|
-
|
41
|
+
|
47
42
|
it "should return settings resource" do
|
48
43
|
subject.settings.must_be_kind_of(Lob::V1::Setting)
|
49
44
|
end
|