lob 5.1.0 → 5.2.0

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
- SHA1:
3
- metadata.gz: 1eddef68c4e49063f15b7f4634832a240c3a23cf
4
- data.tar.gz: 3edfed3dba4fddc7d7750921be0e7b96327712db
2
+ SHA256:
3
+ metadata.gz: 58d9c6ae15fcc102d200e7f5658c0ec7ffabe144a5c1c7a5dad4b3d73c7a446c
4
+ data.tar.gz: b52642eddc9ccad70128c13d9c4a2686216117592e8aa65132742d42dbc5d782
5
5
  SHA512:
6
- metadata.gz: c7b161bf7195552d5ebccfa434404b091341374cc7cccc7da5d52c3d4b8fd64c197d5cdcb1768f7a00a05e00e21a7597005ac8df84e6b910ee28fa41538282f9
7
- data.tar.gz: 497354d79e8fb4be0ee802ee518461caab60b5562bb3f3b9f16fa6c8c9ead1c613e6d6099f772233a225d9af26a2acde6fcb0680f5cc0f3f83db368dadf653af
6
+ metadata.gz: 0704b2ada68338190157031692d209082b261a0701208eb9dbdcac0145a4a014d0a86e13e5b6215e2a57f04f4a26dc253b3bd8113fbdea827fb11f48dfe26c57
7
+ data.tar.gz: 503e570a1803fc459ce45ba4fb7fc7dd99fae7c0a848d8946db9cbabda744cff5d01edbee6eed88ab207130e0689b6288c751c1c9be27204b4c59311408bf45d
data/.travis.yml CHANGED
@@ -1,15 +1,12 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - jruby-9.0.5.0
5
4
  - jruby-9.1.9.0
6
- - 2.1
7
- - 2.2
8
- - 2.3
5
+ - jruby-9.2.9.0
9
6
  - 2.4
10
7
  - 2.5
11
8
  - 2.6
12
-
9
+ - 2.7
13
10
  env:
14
11
  JRUBY_OPTS=--2.0
15
12
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## [**5.2.0**](https://github.com/lob/lob-ruby/releases/tag/v5.2.0) (2021-05-03)
2
+ - [**188**](https://github.com/lob/lob-ruby/pull/188) Adds support for Self Mailers
3
+ ## 5.1.2 (2021-02-18)
4
+
5
+ ##### Chores and Bug Fixes
6
+
7
+ - [**185**](https://github.com/lob/lob-ruby/pull/185) Bumps rake to 12.3.3, adds Ruby 2.7, update example asset links, other cleanup.
8
+ ## 5.1.1 (2020-05-21)
9
+
10
+ ##### Chores
11
+
12
+ * **intl-verification:** update international verifications test mode fix ([#179](https://github.com/lob/lob-ruby/pull/179)) ([4ab7e7e2](https://github.com/lob/lob-ruby/commit/4ab7e7e2852706c37b00bd8f2df58207897bc0a3))
13
+
14
+ ##### Bug Fixes
15
+
16
+ * **merge-variables:** convert to json ([fa93885f](https://github.com/lob/lob-ruby/commit/fa93885f2aab4537e100b82d8a9f53cdec042f2e))
17
+
1
18
  ## [**5.1.0**](https://github.com/lob/lob-ruby/releases/tag/v5.1.0)
2
19
  - [**176**](https://github.com/lob/lob-ruby/pull/176) Adds support for Group Members (beta feature)
3
20
  - [**175**](https://github.com/lob/lob-ruby/pull/175) Adds support for Groups (beta feature)
data/README.md CHANGED
@@ -24,10 +24,10 @@ Supports Ruby 2.0.0 and greater.
24
24
 
25
25
  Here's a general overview of the Lob services available, click through to read more.
26
26
 
27
- - [Postcards API](https://lob.com/services/postcards)
28
- - [Letters API](https://lob.com/services/letters)
29
- - [Checks API](https://lob.com/services/checks)
30
- - [Address Verification API](https://lob.com/services/verifications)
27
+ - [Postcards API](https://lob.com/products/print-mail/postcards)
28
+ - [Letters API](https://lob.com/products/print-mail/letters)
29
+ - [Checks API](https://lob.com/products/print-mail/checks)
30
+ - [Address Verification API](https://lob.com/products/address-verification)
31
31
 
32
32
  Please read through the official [API Documentation](#api-documentation) to get a complete sense of what to expect from each endpoint.
33
33
 
@@ -146,6 +146,13 @@ There are simple scripts to demonstrate how to create all the core Lob objects (
146
146
  - [Retrieve a Postcard](https://lob.com/docs/ruby#postcards_retrieve)
147
147
  - [Cancel a Postcard](https://lob.com/docs/ruby#postcards_delete)
148
148
  - [List all Postcards](https://lob.com/docs/ruby#postcards_list)
149
+ - **Self Mailers API**
150
+ - [Self Mailers](https://lob.com/docs/ruby#self_mailers)
151
+ - [The Self Mailer Object](https://lob.com/docs/ruby#self_mailers_object)
152
+ - [Create a Self Mailer](https://lob.com/docs/ruby#self_mailers_create)
153
+ - [Retrieve a Self Mailer](https://lob.com/docs/ruby#self_mailers_retrieve)
154
+ - [Cancel a Self Mailer](https://lob.com/docs/ruby#self_mailers_delete)
155
+ - [List all Self Mailers](https://lob.com/docs/ruby#self_mailers_list)
149
156
  - **Letters API**
150
157
  - [Letters](https://lob.com/docs/ruby#letters)
151
158
  - [The Letter Object](https://lob.com/docs/ruby#letters_object)
data/examples/README.md CHANGED
@@ -31,3 +31,7 @@ An example showing how to create a letter using Lob's [Letters API](https://lob.
31
31
  ## /postcards.rb
32
32
 
33
33
  An example showing how to create a postcard using Lob's [Postcards API](https://lob.com/services/postcards).
34
+
35
+ ## /self_mailers.rb
36
+
37
+ An example showing how to create a self mailer using Lob's Self Mailers API.
@@ -0,0 +1,37 @@
1
+ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
+ require 'lob'
3
+
4
+ # initialize Lob object
5
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
6
+
7
+ # create a to address
8
+ to_address = lob.addresses.create(
9
+ name: "ToAddress",
10
+ address_line1: "120 6th Ave",
11
+ address_city: "Boston",
12
+ address_state: "MA",
13
+ address_country: "US",
14
+ address_zip: 12345
15
+ )
16
+
17
+ # create a from address
18
+ from_address = lob.addresses.create(
19
+ name: "FromAddress",
20
+ address_line1: "120 6th Ave",
21
+ address_city: "Boston",
22
+ address_state: "MA",
23
+ address_country: "US",
24
+ address_zip: 12345
25
+ )
26
+
27
+
28
+ # send a self mailer
29
+ puts lob.self_mailers.create(
30
+ description: "Beach Postcard",
31
+ to: to_address["id"],
32
+ from: from_address["id"],
33
+ metadata: { campaign: "Summer 2021 Beach" },
34
+ merge_variables: { name: "Albert" },
35
+ outside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_outside.pdf",
36
+ inside: "<h1>Hi {{name}}, please RSVP as soon as possible to reserve your lounge chair.</h1>"
37
+ )
data/lib/lob/client.rb CHANGED
@@ -6,6 +6,7 @@ require "lob/resources/groups_member"
6
6
  require "lob/resources/intl_verifications"
7
7
  require "lob/resources/letter"
8
8
  require "lob/resources/postcard"
9
+ require "lob/resources/self_mailer"
9
10
  require "lob/resources/us_autocompletions"
10
11
  require "lob/resources/us_verifications"
11
12
  require "lob/resources/us_zip_lookups"
@@ -55,6 +56,10 @@ module Lob
55
56
  Lob::Resources::Postcard.new(config)
56
57
  end
57
58
 
59
+ def self_mailers
60
+ Lob::Resources::SelfMailer.new(config)
61
+ end
62
+
58
63
  def us_autocompletions
59
64
  Lob::Resources::USAutocompletions.new(config)
60
65
  end
@@ -19,7 +19,7 @@ module Lob
19
19
  query: query
20
20
  }
21
21
 
22
- submit request
22
+ submit(request)
23
23
  end
24
24
 
25
25
  def find(resource_id)
@@ -28,7 +28,7 @@ module Lob
28
28
  url: resource_url(resource_id)
29
29
  }
30
30
 
31
- submit request
31
+ submit(request)
32
32
  end
33
33
 
34
34
  def create(body={}, headers={}, query={})
@@ -40,7 +40,7 @@ module Lob
40
40
  query: query
41
41
  }
42
42
 
43
- submit request
43
+ submit(request)
44
44
  end
45
45
 
46
46
  def destroy(resource_id)
@@ -49,7 +49,7 @@ module Lob
49
49
  url: resource_url(resource_id)
50
50
  }
51
51
 
52
- submit request
52
+ submit(request)
53
53
  end
54
54
 
55
55
  private
@@ -71,11 +71,14 @@ module Lob
71
71
  if query != {}
72
72
  url = "#{url}?#{build_nested_query(query)}"
73
73
  end
74
-
74
+
75
75
  begin
76
76
  if method == :get || method == :delete
77
77
  response = RestClient.send(method, url, headers)
78
78
  else
79
+ if body[:merge_variables] and body[:merge_variables].class == Hash
80
+ body[:merge_variables] = body[:merge_variables].to_json()
81
+ end
79
82
  response = RestClient.send(method, url, body, headers)
80
83
  end
81
84
 
@@ -0,0 +1,14 @@
1
+ require "lob/resources/resource_base"
2
+
3
+ module Lob
4
+ module Resources
5
+ class SelfMailer < Lob::Resources::ResourceBase
6
+
7
+ def initialize(config)
8
+ super(config)
9
+ @endpoint = "self_mailers"
10
+ end
11
+
12
+ end
13
+ end
14
+ end
data/lib/lob/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lob
2
- VERSION = "5.1.0"
2
+ VERSION = "5.2.0"
3
3
  end
data/lob.gemspec CHANGED
@@ -18,11 +18,11 @@ 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.8", "< 3.0"
21
+ spec.add_dependency "rest-client", ">= 2.0.1", "< 3.0"
22
22
 
23
- spec.add_development_dependency "rake", "~> 10.4.2"
23
+ spec.add_development_dependency "rake", "~> 12.3.3"
24
24
  spec.add_development_dependency "minitest", "~> 5.6.1"
25
25
  spec.add_development_dependency "webmock", "~> 1.2"
26
- spec.add_development_dependency "coveralls", "~> 0.8.1"
27
- spec.add_development_dependency "simplecov", "~> 0.10.0"
26
+ spec.add_development_dependency "coveralls", "~> 0.8.13"
27
+ spec.add_development_dependency "simplecov", "~> 0.11.0"
28
28
  end
@@ -50,6 +50,27 @@ describe Lob::Resources::Check do
50
50
 
51
51
  result["amount"].to_s.must_equal("2000.12")
52
52
  end
53
+
54
+ it "should create a check with a merge variable conditional" do
55
+ new_address = subject.addresses.create @sample_address_params
56
+
57
+ new_bank_account = subject.bank_accounts.create(@sample_bank_account_params)
58
+
59
+ subject.bank_accounts.verify(new_bank_account["id"], amounts: [1, 2])
60
+
61
+ result = subject.checks.create(
62
+ bank_account: new_bank_account["id"],
63
+ to: new_address["id"],
64
+ from: new_address["id"],
65
+ amount: "2000.12",
66
+ attachment: "<html>{{#is_awesome}}You are awesome!{{/is_awesome}}</html>",
67
+ merge_variables: {
68
+ is_awesome: false
69
+ }
70
+ )
71
+
72
+ result["merge_variables"]["is_awesome"].must_equal(false)
73
+ end
53
74
  end
54
75
 
55
76
 
@@ -15,13 +15,10 @@ describe Lob::Resources::IntlVerifications do
15
15
  subject { Lob::Client.new(api_key: API_KEY) }
16
16
 
17
17
  describe "verify" do
18
- it "should return a 403 in test mode" do
19
- begin
20
- subject.intl_verifications.verify @sample_params
21
- rescue Lob::InvalidRequestError => e
22
- assert e.http_status == 403
23
- assert e._response.headers.include?(:content_type)
24
- end
18
+ it "should verify an international address" do
19
+ result = subject.intl_verifications.verify @sample_params
20
+
21
+ result["recipient"].must_equal("TEST KEYS DO NOT VERIFY ADDRESSES")
25
22
  end
26
23
  end
27
24
 
@@ -52,6 +52,26 @@ describe Lob::Resources::Letter do
52
52
 
53
53
  new_letter["description"].must_equal("TestLetter")
54
54
  end
55
+
56
+ it "should create a letter with a merge variable object" do
57
+ new_address = subject.addresses.create @sample_address_params
58
+
59
+ new_letter = subject.letters.create(
60
+ description: "TestLetter",
61
+ color: true,
62
+ file: "<html>{{data.name}}</html>",
63
+ to: new_address["id"],
64
+ from: @sample_address_params,
65
+ merge_variables: {
66
+ data: {
67
+ name: "Kobe"
68
+ }
69
+ }
70
+ )
71
+
72
+ new_letter["description"].must_equal("TestLetter")
73
+ new_letter["merge_variables"]["data"]["name"].must_equal("Kobe")
74
+ end
55
75
  end
56
76
 
57
77
 
@@ -68,7 +88,7 @@ describe Lob::Resources::Letter do
68
88
  )
69
89
 
70
90
  result = subject.letters.find(new_letter["id"])
71
- assert /#{new_letter["description"]}/ =~ result.to_s
91
+ assert %r{#{new_letter["description"]}} =~ result.to_s
72
92
  end
73
93
  end
74
94
 
@@ -37,7 +37,7 @@ describe Lob::Resources::Postcard do
37
37
  description: @sample_postcard_params[:description],
38
38
  to: new_address["id"],
39
39
  back: @sample_postcard_params[:back],
40
- front: "https://lob.com/postcardfront.pdf"
40
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf"
41
41
  )
42
42
 
43
43
  result["description"].must_equal(@sample_postcard_params[:description])
@@ -48,7 +48,7 @@ describe Lob::Resources::Postcard do
48
48
  description: @sample_postcard_params[:description],
49
49
  to: @sample_address_params,
50
50
  back: @sample_postcard_params[:back],
51
- front: "https://lob.com/postcardfront.pdf"
51
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf"
52
52
  )
53
53
 
54
54
  result["description"].must_equal(@sample_postcard_params[:description])
@@ -62,7 +62,7 @@ describe Lob::Resources::Postcard do
62
62
  to: new_address["id"],
63
63
  from: @sample_address_params,
64
64
  back: @sample_postcard_params[:back],
65
- front: "https://lob.com/postcardfront.pdf"
65
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf"
66
66
  )
67
67
 
68
68
  result["description"].must_equal(@sample_postcard_params[:description])
@@ -74,8 +74,8 @@ describe Lob::Resources::Postcard do
74
74
  result = subject.postcards.create(
75
75
  description: @sample_postcard_params[:description],
76
76
  to: new_address["id"],
77
- front: "https://lob.com/postcardfront.pdf",
78
- back: "https://lob.com/postcardback.pdf"
77
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf",
78
+ back: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_back.pdf"
79
79
  )
80
80
 
81
81
  result["description"].must_equal(@sample_postcard_params[:description])
@@ -95,6 +95,31 @@ describe Lob::Resources::Postcard do
95
95
  result["description"].must_equal(@sample_postcard_params[:description])
96
96
  end
97
97
 
98
+ it "should create a postcard with a merge variable list" do
99
+ new_address = subject.addresses.create @sample_address_params
100
+ merge_variables = {
101
+ list: [
102
+ {
103
+ name: "Larissa"
104
+ },
105
+ {
106
+ name: "Larry"
107
+ }
108
+ ]
109
+ }
110
+
111
+ result = subject.postcards.create(
112
+ description: @sample_postcard_params[:description],
113
+ to: new_address["id"],
114
+ back: "<html>{{#list}} {{name}} {{/list}}</html>",
115
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf",
116
+ merge_variables: merge_variables
117
+ )
118
+
119
+ result["description"].must_equal(@sample_postcard_params[:description])
120
+ result["merge_variables"]["list"][0]["name"].must_equal("Larissa")
121
+ result["merge_variables"]["list"][1]["name"].must_equal("Larry")
122
+ end
98
123
  end
99
124
 
100
125
 
@@ -55,7 +55,7 @@ describe Lob::Resources::ResourceBase do
55
55
  description: sample_postcard_params[:description],
56
56
  to: new_address["id"],
57
57
  back: sample_postcard_params[:back],
58
- front: "https://lob.com/postcardfront.pdf"
58
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf"
59
59
  }, {
60
60
  "Idempotency-Key" => idempotency_key
61
61
  })
@@ -64,7 +64,7 @@ describe Lob::Resources::ResourceBase do
64
64
  description: sample_postcard_params[:description],
65
65
  to: new_address["id"],
66
66
  back: sample_postcard_params[:back],
67
- front: "https://lob.com/postcardfront.pdf"
67
+ front: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/pc_4x6_front.pdf"
68
68
  }, {
69
69
  "Idempotency-Key" => idempotency_key
70
70
  })
@@ -0,0 +1,177 @@
1
+ require "spec_helper"
2
+
3
+ describe Lob::Resources::SelfMailer do
4
+
5
+ before :each do
6
+ @sample_address_params = {
7
+ name: "TestAddress",
8
+ email: "test@test.com",
9
+ address_line1: "123 Test Street",
10
+ address_line2: "Unit 199",
11
+ address_city: "Mountain View",
12
+ address_state: "CA",
13
+ address_country: "US",
14
+ address_zip: 94085
15
+ }
16
+
17
+ @sample_self_mailer_params = {
18
+ description: "Test Self Mailer",
19
+ outside: "<h1>Sample Self Mailer Outside</h1>",
20
+ inside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_inside.pdf",
21
+ }
22
+ end
23
+
24
+ subject { Lob::Client.new(api_key: API_KEY) }
25
+
26
+ describe "list" do
27
+ it "should list self mailers" do
28
+ self_mailers = subject.self_mailers.list()
29
+ assert self_mailers["object"] == "list"
30
+ end
31
+ end
32
+
33
+
34
+ describe "create" do
35
+ it "should create a self mailer with address_id" do
36
+ new_address = subject.addresses.create @sample_address_params
37
+
38
+ result = subject.self_mailers.create(
39
+ description: @sample_self_mailer_params[:description],
40
+ to: new_address["id"],
41
+ outside: @sample_self_mailer_params[:outside],
42
+ inside: @sample_self_mailer_params[:inside],
43
+ )
44
+
45
+ result["description"].must_equal(@sample_self_mailer_params[:description])
46
+ end
47
+
48
+ it "should create a self mailer with to address params" do
49
+ result = subject.self_mailers.create(
50
+ description: @sample_self_mailer_params[:description],
51
+ to: @sample_address_params,
52
+ outside: @sample_self_mailer_params[:outside],
53
+ inside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_inside.pdf"
54
+ )
55
+
56
+ result["description"].must_equal(@sample_self_mailer_params[:description])
57
+ end
58
+
59
+ it "should create a self mailer with from address params" do
60
+ new_address = subject.addresses.create @sample_address_params
61
+
62
+ result = subject.self_mailers.create(
63
+ description: @sample_self_mailer_params[:description],
64
+ to: new_address["id"],
65
+ from: @sample_address_params,
66
+ outside: @sample_self_mailer_params[:outside],
67
+ inside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_inside.pdf"
68
+ )
69
+
70
+ result["description"].must_equal(@sample_self_mailer_params[:description])
71
+ end
72
+
73
+ it "should create a self mailer with front and back as urls" do
74
+ new_address = subject.addresses.create @sample_address_params
75
+
76
+ result = subject.self_mailers.create(
77
+ description: @sample_self_mailer_params[:description],
78
+ to: new_address["id"],
79
+ outside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_outside.pdf",
80
+ inside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_inside.pdf"
81
+ )
82
+
83
+ result["description"].must_equal(@sample_self_mailer_params[:description])
84
+ end
85
+
86
+
87
+ it "should create a self mailer with front and back as PDFs" do
88
+ new_address = subject.addresses.create @sample_address_params
89
+
90
+ result = subject.self_mailers.create(
91
+ description: @sample_self_mailer_params[:description],
92
+ to: new_address["id"],
93
+ outside: File.new(File.expand_path("../../../samples/sfm-6x18-outside.pdf", __FILE__)),
94
+ inside: File.new(File.expand_path("../../../samples/sfm-6x18-inside.pdf", __FILE__))
95
+ )
96
+
97
+ result["description"].must_equal(@sample_self_mailer_params[:description])
98
+ end
99
+
100
+ it "should create a self mailer with front and back as 12x9 PDFs" do
101
+ new_address = subject.addresses.create @sample_address_params
102
+
103
+ result = subject.self_mailers.create(
104
+ description: @sample_self_mailer_params[:description],
105
+ to: new_address["id"],
106
+ size: "12x9_bifold",
107
+ outside: File.new(File.expand_path("../../../samples/sfm-12x9-outside.pdf", __FILE__)),
108
+ inside: File.new(File.expand_path("../../../samples/sfm-12x9-inside.pdf", __FILE__))
109
+ )
110
+
111
+ result["description"].must_equal(@sample_self_mailer_params[:description])
112
+ end
113
+
114
+
115
+ it "should create a self mailer with a merge variable list" do
116
+ new_address = subject.addresses.create @sample_address_params
117
+ merge_variables = {
118
+ list: [
119
+ {
120
+ name: "Larissa"
121
+ },
122
+ {
123
+ name: "Larry"
124
+ }
125
+ ]
126
+ }
127
+
128
+ result = subject.self_mailers.create(
129
+ description: @sample_self_mailer_params[:description],
130
+ to: new_address["id"],
131
+ outside: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/self_mailers/6x18_sfm_inside.pdf",
132
+ inside: "<html>{{#list}} {{name}} {{/list}}</html>",
133
+ merge_variables: merge_variables
134
+ )
135
+
136
+ result["description"].must_equal(@sample_self_mailer_params[:description])
137
+ result["merge_variables"]["list"][0]["name"].must_equal("Larissa")
138
+ result["merge_variables"]["list"][1]["name"].must_equal("Larry")
139
+ end
140
+ end
141
+
142
+
143
+ describe "find" do
144
+ it "should find a self mailer" do
145
+ new_address = subject.addresses.create @sample_address_params
146
+
147
+ new_self_mailer = subject.self_mailers.create(
148
+ description: @sample_self_mailer_params[:description],
149
+ to: new_address["id"],
150
+ outside: @sample_self_mailer_params[:outside],
151
+ inside: @sample_self_mailer_params[:inside]
152
+ )
153
+
154
+ result = subject.self_mailers.find(new_self_mailer["id"])
155
+ result["description"].must_equal(@sample_self_mailer_params[:description])
156
+ end
157
+ end
158
+
159
+
160
+ describe "destroy" do
161
+ it "should destroy a self mailer" do
162
+ new_address = subject.addresses.create @sample_address_params
163
+
164
+ new_self_mailer = subject.self_mailers.create(
165
+ description: @sample_self_mailer_params[:description],
166
+ to: new_address["id"],
167
+ outside: @sample_self_mailer_params[:outside],
168
+ inside: @sample_self_mailer_params[:inside]
169
+ )
170
+
171
+ result = subject.self_mailers.destroy(new_self_mailer["id"])
172
+ result["id"].must_equal(new_self_mailer["id"])
173
+ result["deleted"].must_equal(true)
174
+ end
175
+ end
176
+
177
+ end
Binary file
Binary file
Binary file
Binary file
data/spec/spec_helper.rb CHANGED
@@ -3,10 +3,10 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
3
3
  require "simplecov"
4
4
  require "coveralls"
5
5
 
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
7
7
  SimpleCov::Formatter::HTMLFormatter,
8
8
  Coveralls::SimpleCov::Formatter
9
- ]
9
+ ])
10
10
  SimpleCov.start
11
11
 
12
12
  require "lob"
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: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-30 00:00:00.000000000 Z
11
+ date: 2021-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: 2.0.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '3.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1.8'
29
+ version: 2.0.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.0'
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 10.4.2
39
+ version: 12.3.3
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 10.4.2
46
+ version: 12.3.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 0.8.1
81
+ version: 0.8.13
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.8.1
88
+ version: 0.8.13
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: simplecov
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.10.0
95
+ version: 0.11.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.10.0
102
+ version: 0.11.0
103
103
  description: Lob API Ruby wrapper
104
104
  email:
105
105
  - support@lob.com
@@ -130,6 +130,7 @@ files:
130
130
  - examples/csv_verify/verify.rb
131
131
  - examples/letters.rb
132
132
  - examples/postcards.rb
133
+ - examples/self_mailers.rb
133
134
  - lib/lob.rb
134
135
  - lib/lob/client.rb
135
136
  - lib/lob/errors/invalid_request_error.rb
@@ -143,6 +144,7 @@ files:
143
144
  - lib/lob/resources/letter.rb
144
145
  - lib/lob/resources/postcard.rb
145
146
  - lib/lob/resources/resource_base.rb
147
+ - lib/lob/resources/self_mailer.rb
146
148
  - lib/lob/resources/us_autocompletions.rb
147
149
  - lib/lob/resources/us_verifications.rb
148
150
  - lib/lob/resources/us_zip_lookups.rb
@@ -158,6 +160,7 @@ files:
158
160
  - spec/lob/resources/member_spec.rb
159
161
  - spec/lob/resources/postcard_spec.rb
160
162
  - spec/lob/resources/resource_base_spec.rb
163
+ - spec/lob/resources/self_mailer_spec.rb
161
164
  - spec/lob/resources/us_autocompletions_spec.rb
162
165
  - spec/lob/resources/us_verifications_spec.rb
163
166
  - spec/lob/resources/us_zip_lookups_spec.rb
@@ -165,6 +168,10 @@ files:
165
168
  - spec/samples/8.5x11.pdf
166
169
  - spec/samples/postcardback.pdf
167
170
  - spec/samples/postcardfront.pdf
171
+ - spec/samples/sfm-12x9-inside.pdf
172
+ - spec/samples/sfm-12x9-outside.pdf
173
+ - spec/samples/sfm-6x18-inside.pdf
174
+ - spec/samples/sfm-6x18-outside.pdf
168
175
  - spec/spec_helper.rb
169
176
  homepage: https://github.com/lob/lob-ruby
170
177
  licenses:
@@ -185,8 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
192
  - !ruby/object:Gem::Version
186
193
  version: '0'
187
194
  requirements: []
188
- rubyforge_project:
189
- rubygems_version: 2.5.2.3
195
+ rubygems_version: 3.0.3
190
196
  signing_key:
191
197
  specification_version: 4
192
198
  summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax
@@ -201,6 +207,7 @@ test_files:
201
207
  - spec/lob/resources/member_spec.rb
202
208
  - spec/lob/resources/postcard_spec.rb
203
209
  - spec/lob/resources/resource_base_spec.rb
210
+ - spec/lob/resources/self_mailer_spec.rb
204
211
  - spec/lob/resources/us_autocompletions_spec.rb
205
212
  - spec/lob/resources/us_verifications_spec.rb
206
213
  - spec/lob/resources/us_zip_lookups_spec.rb
@@ -208,4 +215,8 @@ test_files:
208
215
  - spec/samples/8.5x11.pdf
209
216
  - spec/samples/postcardback.pdf
210
217
  - spec/samples/postcardfront.pdf
218
+ - spec/samples/sfm-12x9-inside.pdf
219
+ - spec/samples/sfm-12x9-outside.pdf
220
+ - spec/samples/sfm-6x18-inside.pdf
221
+ - spec/samples/sfm-6x18-outside.pdf
211
222
  - spec/spec_helper.rb