lob 4.3.0 → 5.2.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -10
  3. data/CHANGELOG.md +30 -0
  4. data/README.md +15 -20
  5. data/examples/README.md +4 -0
  6. data/examples/checks.rb +1 -1
  7. data/examples/csv_checks/create_checks.rb +1 -1
  8. data/examples/csv_letters/create_letters.rb +1 -1
  9. data/examples/csv_letters/letter_template.html +1 -1
  10. data/examples/csv_postcards/create_postcards.rb +1 -1
  11. data/examples/csv_postcards/input.csv +7 -7
  12. data/examples/csv_postcards/postcard_back.html +1 -1
  13. data/examples/csv_verify/verify.rb +1 -1
  14. data/examples/letters.rb +2 -2
  15. data/examples/postcards.rb +3 -3
  16. data/examples/self_mailers.rb +37 -0
  17. data/lib/lob/client.rb +13 -8
  18. data/lib/lob/resources/{area.rb → group.rb} +2 -4
  19. data/lib/lob/resources/groups_member.rb +66 -0
  20. data/lib/lob/resources/resource_base.rb +8 -5
  21. data/lib/lob/resources/self_mailer.rb +14 -0
  22. data/lib/lob/version.rb +1 -1
  23. data/lob.gemspec +4 -7
  24. data/spec/lob/resources/check_spec.rb +21 -0
  25. data/spec/lob/resources/group_spec.rb +50 -0
  26. data/spec/lob/resources/intl_verifications_spec.rb +4 -7
  27. data/spec/lob/resources/letter_spec.rb +24 -4
  28. data/spec/lob/resources/member_spec.rb +65 -0
  29. data/spec/lob/resources/postcard_spec.rb +30 -5
  30. data/spec/lob/resources/resource_base_spec.rb +4 -16
  31. data/spec/lob/resources/self_mailer_spec.rb +177 -0
  32. data/spec/samples/sfm-12x9-inside.pdf +0 -0
  33. data/spec/samples/sfm-12x9-outside.pdf +0 -0
  34. data/spec/samples/sfm-6x18-inside.pdf +0 -0
  35. data/spec/samples/sfm-6x18-outside.pdf +0 -0
  36. data/spec/spec_helper.rb +3 -3
  37. metadata +29 -60
  38. data/lib/lob/resources/route.rb +0 -33
  39. data/spec/lob/resources/area_spec.rb +0 -59
  40. data/spec/lob/resources/route_spec.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8225f20dd05a0f5b903f986a88f5e93254dec38e28361076a9724cfef0c50661
4
- data.tar.gz: d0e4ccd13e9bd6f5b9b4010f48a7b6e9f2926c57de5a6a914d4f6153ecfd43a0
3
+ metadata.gz: 58d9c6ae15fcc102d200e7f5658c0ec7ffabe144a5c1c7a5dad4b3d73c7a446c
4
+ data.tar.gz: b52642eddc9ccad70128c13d9c4a2686216117592e8aa65132742d42dbc5d782
5
5
  SHA512:
6
- metadata.gz: 7f21d43ad6e066f4c94d00365d92bc155947bd4c56c2b0794aebfcecd75cd9f5189dab7583a39585eedc8060a788d0fa20ee6111097291ddefb06ef7f38ae37e
7
- data.tar.gz: c8df84c18215df4af65573cd1109b80d6bb053160a5958a867cfc5ab0bfcf3b09f9bb568c2235e4830a1c270f69512ae9727ea2704312316043e1d6073fdf581
6
+ metadata.gz: 0704b2ada68338190157031692d209082b261a0701208eb9dbdcac0145a4a014d0a86e13e5b6215e2a57f04f4a26dc253b3bd8113fbdea827fb11f48dfe26c57
7
+ data.tar.gz: 503e570a1803fc459ce45ba4fb7fc7dd99fae7c0a848d8946db9cbabda744cff5d01edbee6eed88ab207130e0689b6288c751c1c9be27204b4c59311408bf45d
data/.travis.yml CHANGED
@@ -1,19 +1,13 @@
1
1
  language: ruby
2
2
 
3
- sudo: false
4
-
5
3
  rvm:
6
- - jruby-9.0.5.0
7
4
  - jruby-9.1.9.0
8
- - 2.1
9
- - 2.2
10
- - 2.3
5
+ - jruby-9.2.9.0
11
6
  - 2.4
12
-
7
+ - 2.5
8
+ - 2.6
9
+ - 2.7
13
10
  env:
14
11
  JRUBY_OPTS=--2.0
15
12
 
16
- before_install:
17
- - gem install bundler
18
-
19
13
  script: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
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
+
18
+ ## [**5.1.0**](https://github.com/lob/lob-ruby/releases/tag/v5.1.0)
19
+ - [**176**](https://github.com/lob/lob-ruby/pull/176) Adds support for Group Members (beta feature)
20
+ - [**175**](https://github.com/lob/lob-ruby/pull/175) Adds support for Groups (beta feature)
21
+ - [**174**](https://github.com/lob/lob-ruby/pull/174) Add Ruby 2.5-6, remove API keys, other cleanup
22
+ - [**173**](https://github.com/lob/lob-ruby/pull/173) Update example asset links
23
+
24
+ ## 5.0.0
25
+
26
+ Version 5.0.0 introduces a breaking change. It removes support for the area mail resources (`Areas` and `Routes`).
27
+
28
+ * Removes `Lob.areas`.
29
+ * Removes `Lob.routes`.
30
+
1
31
  ## [**4.3.0**](https://github.com/lob/lob-ruby/releases/tag/v4.3.0)
2
32
  - [**171**](https://github.com/lob/lob-ruby/pull/171) add USAutocompletions
3
33
  - [**170**](https://github.com/lob/lob-ruby/pull/170) Fix test name
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # lob-ruby
2
2
 
3
3
  [![Build Status](https://travis-ci.org/lob/lob-ruby.svg?branch=master)](https://travis-ci.org/lob/lob-ruby)
4
- [![Gem Version](https://badge.fury.io/rb/lob.svg)](http://badge.fury.io/rb/lob)
5
- [![Dependency Status](https://gemnasium.com/lob/lob-ruby.svg)](https://gemnasium.com/lob/lob-ruby)
4
+ [![Gem Version](https://badge.fury.io/rb/lob.svg)](https://badge.fury.io/rb/lob)
6
5
  [![Coverage Status](https://coveralls.io/repos/lob/lob-ruby/badge.svg?branch=master)](https://coveralls.io/r/lob/lob-ruby?branch=master)
7
- [![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/lob?color=green&type=total)](https://rubygems.org/gems/lob)
6
+ [![Downloads](https://ruby-gem-downloads-badge.herokuapp.com/lob?color=green&type=total)](https://rubygems.org/gems/lob)
8
7
 
9
- Ruby wrapper for the [Lob.com](http://lob.com) API. See the full Lob.com [API Documentation](https://lob.com/docs/ruby). For best results, be sure that you're using [the latest version](https://lob.com/docs/ruby#version) of the Lob API and the latest version of the ruby wrapper. This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
8
+ Ruby wrapper for the [Lob.com](https://lob.com) API. See the full Lob.com [API Documentation](https://lob.com/docs/ruby). For best results, be sure that you're using [the latest version](https://lob.com/docs/ruby#version) of the Lob API and the latest version of the ruby wrapper. This gem gives you an ActiveRecord-style syntax to use the Lob.com API.
10
9
 
11
10
  Supports Ruby 2.0.0 and greater.
12
11
 
@@ -25,11 +24,10 @@ Supports Ruby 2.0.0 and greater.
25
24
 
26
25
  Here's a general overview of the Lob services available, click through to read more.
27
26
 
28
- - [Postcards API](https://lob.com/services/postcards)
29
- - [Letters API](https://lob.com/services/letters)
30
- - [Checks API](https://lob.com/services/checks)
31
- - [Area Mail API](https://lob.com/services/area)
32
- - [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)
33
31
 
34
32
  Please read through the official [API Documentation](#api-documentation) to get a complete sense of what to expect from each endpoint.
35
33
 
@@ -96,7 +94,7 @@ You can also access headers from `Lob::InvalidRequestError`s.
96
94
 
97
95
  ```ruby
98
96
  begin
99
- lob.objects.create(name: "Test", file: "https://lob.com/test.pdf", bad_param: "bad_value")
97
+ lob.objects.create(name: "Test", file: "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/incorrect_size.pdf", bad_param: "bad_value")
100
98
  rescue Lob::InvalidRequestError => e
101
99
  e._response.headers[:content_type]
102
100
  # => "application/json; charset=utf-8"
@@ -148,6 +146,13 @@ There are simple scripts to demonstrate how to create all the core Lob objects (
148
146
  - [Retrieve a Postcard](https://lob.com/docs/ruby#postcards_retrieve)
149
147
  - [Cancel a Postcard](https://lob.com/docs/ruby#postcards_delete)
150
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)
151
156
  - **Letters API**
152
157
  - [Letters](https://lob.com/docs/ruby#letters)
153
158
  - [The Letter Object](https://lob.com/docs/ruby#letters_object)
@@ -169,16 +174,6 @@ There are simple scripts to demonstrate how to create all the core Lob objects (
169
174
  - [Delete a Bank Account](https://lob.com/docs/ruby#bankaccounts_delete)
170
175
  - [Verify a Bank Account](https://lob.com/docs/ruby#bankaccounts_verify)
171
176
  - [List all Bank Accounts](https://lob.com/docs/ruby#bankaccounts_list)
172
- - **Area Mail API**
173
- - [Areas](https://lob.com/docs/ruby#areas)
174
- - [The Area Object](https://lob.com/docs/ruby#areas_object)
175
- - [Create an Area Mailing](https://lob.com/docs/ruby#areas_create)
176
- - [Retrieve an Area Mailing](https://lob.com/docs/ruby#areas_retrieve)
177
- - [List all Area Mailings](https://lob.com/docs/ruby#areas_list)
178
- - [Routes](https://lob.com/docs/ruby#routes)
179
- - [The Routes Object](https://lob.com/docs/ruby#routes_object)
180
- - [Retrieve Routes](https://lob.com/docs/ruby#routes_retrieve)
181
- - [List all Routes](https://lob.com/docs/ruby#routes_list)
182
177
  - **Appendix**
183
178
  - [API Changelog](https://lob.com/docs/ruby#changelog)
184
179
  - [The Tracking Event Object](https://lob.com/docs/ruby#tracking_event_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.
data/examples/checks.rb CHANGED
@@ -2,7 +2,7 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
2
  require 'lob'
3
3
 
4
4
  # initialize Lob object
5
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
5
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
6
6
 
7
7
  # create an address
8
8
  to_address = lob.addresses.create(
@@ -3,7 +3,7 @@ require 'lob'
3
3
  require 'csv'
4
4
 
5
5
  # Initialize Lob object
6
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
6
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
7
7
 
8
8
  # Create a bank account
9
9
  bank_account = lob.bank_accounts.create(
@@ -3,7 +3,7 @@ require 'lob'
3
3
  require 'csv'
4
4
 
5
5
  # Initialize Lob object
6
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
6
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
7
7
 
8
8
  # Load the HTML from letter_template.html
9
9
  letter_html = File.open(File.expand_path('../letter_template.html', __FILE__)).read
@@ -11,7 +11,7 @@
11
11
  font-family: 'Loved by the King';
12
12
  font-style: normal;
13
13
  font-weight: 400;
14
- src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
14
+ src: url('https://s3-us-west-2.amazonaws.com/public.lob.com/fonts/lovedByTheKing/LovedbytheKing.ttf') format('truetype');
15
15
  }
16
16
 
17
17
  .text {
@@ -3,7 +3,7 @@ require 'lob'
3
3
  require 'csv'
4
4
 
5
5
  # Initialize Lob object
6
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
6
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
7
7
 
8
8
  # Load the HTML from postcard_front.html and postcard_back.html.
9
9
  front_html = File.open(File.expand_path('../postcard_front.html', __FILE__)).read
@@ -1,7 +1,7 @@
1
- Peter,https://s3-us-west-2.amazonaws.com/lob-assets/df-car2.jpg,LightBlue,Jeep Wrangler,65000,Peter,123 Main Street,Apt. 101,San Francisco,CA,94107,US
2
- Marcus,https://s3-us-west-2.amazonaws.com/lob-assets/df-car.jpg,Bisque,Honda Pilot,65000,Marcus,456 Oak Street ,Apt. 102,San Francisco,CA,94185,US
3
- Leore,https://s3-us-west-2.amazonaws.com/lob-assets/df-car2.jpg,PaleGreen,Jeep Wrangler,50000,Leore,123 Test Street,Apt. 101,San Francisco,CA,94105,US
4
- Harry,https://s3-us-west-2.amazonaws.com/lob-assets/df-car.jpg,Thistle,Jeep Wrangler,50000,Harry,789 Elm Street,Apt. 101,San Francisco,CA,94107,US
5
- Elnaz,https://s3-us-west-2.amazonaws.com/lob-assets/df-car2.jpg,PaleTurqoise,Jeep Wrangler,35000,Elnaz,111 Washington Street,Apt. 101,San Francisco,CA,94112,US
6
- Robin,https://s3-us-west-2.amazonaws.com/lob-assets/df-car.jpg,Wheat,Jeep Wrangler,35000,Robin,888 Jefferson Street,Apt. 101,San Francisco,CA,94197,US
7
- Russell,https://s3-us-west-2.amazonaws.com/lob-assets/df-car2.jpg,WhiteSmoke,Jeep Wrangler,15000,Russell,1212 Fourth Street,Apt. 101,San Francisco,CA,94166,US
1
+ Peter,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car2.jpg,LightBlue,Jeep Wrangler,65000,Peter,123 Main Street,Apt. 101,San Francisco,CA,94107,US
2
+ Marcus,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car.jpg,Bisque,Honda Pilot,65000,Marcus,456 Oak Street ,Apt. 102,San Francisco,CA,94185,US
3
+ Leore,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car2.jpg,PaleGreen,Jeep Wrangler,50000,Leore,123 Test Street,Apt. 101,San Francisco,CA,94105,US
4
+ Harry,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car.jpg,Thistle,Jeep Wrangler,50000,Harry,789 Elm Street,Apt. 101,San Francisco,CA,94107,US
5
+ Elnaz,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car2.jpg,PaleTurqoise,Jeep Wrangler,35000,Elnaz,111 Washington Street,Apt. 101,San Francisco,CA,94112,US
6
+ Robin,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car.jpg,Wheat,Jeep Wrangler,35000,Robin,888 Jefferson Street,Apt. 101,San Francisco,CA,94197,US
7
+ Russell,https://s3-us-west-2.amazonaws.com/public.lob.com/assets/example_companies/df-car2.jpg,WhiteSmoke,Jeep Wrangler,15000,Russell,1212 Fourth Street,Apt. 101,San Francisco,CA,94166,US
@@ -6,7 +6,7 @@
6
6
  font-family: 'Arimo';
7
7
  font-style: normal;
8
8
  font-weight: 400;
9
- src: url('https://s3-us-west-2.amazonaws.com/lob-assets/Arimo-Regular.ttf') format('truetype');
9
+ src: url('https://s3-us-west-2.amazonaws.com/public.lob.com/fonts/arimo/Arimo-Regular.ttf') format('truetype');
10
10
  }
11
11
  body {
12
12
  width:11.25in;
@@ -4,7 +4,7 @@ require 'csv'
4
4
  require 'lob'
5
5
 
6
6
  # Initialize Lob object
7
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
7
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
8
8
 
9
9
  output = File.open(File.expand_path('../output.csv', __FILE__), 'w')
10
10
 
data/examples/letters.rb CHANGED
@@ -2,7 +2,7 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
2
  require 'lob'
3
3
 
4
4
  # initialize Lob object
5
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
5
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
6
6
 
7
7
  html = %{
8
8
  <html>
@@ -18,7 +18,7 @@ html = %{
18
18
  font-family: 'Loved by the King';
19
19
  font-style: normal;
20
20
  font-weight: 400;
21
- src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
21
+ src: url('https://s3-us-west-2.amazonaws.com/public.lob.com/fonts/lovedByTheKing/LovedbytheKing.ttf') format('truetype');
22
22
  }
23
23
 
24
24
  .text {
@@ -2,7 +2,7 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
2
  require 'lob'
3
3
 
4
4
  # initialize Lob object
5
- lob = Lob::Client.new(api_key: 'test_799ff27291c166d10ba191902ad02fb059c')
5
+ lob = Lob::Client.new(api_key: 'YOUR_API_KEY_HERE')
6
6
 
7
7
  # HTML to send to the server
8
8
  html = %{
@@ -20,7 +20,7 @@ html = %{
20
20
  font-family: 'Loved by the King';
21
21
  font-style: normal;
22
22
  font-weight: 400;
23
- src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
23
+ src: url('https://s3-us-west-2.amazonaws.com/public.lob.com/fonts/lovedByTheKing/LovedbytheKing.ttf') format('truetype');
24
24
  }
25
25
 
26
26
  body {
@@ -29,7 +29,7 @@ html = %{
29
29
  margin: 0;
30
30
  padding: 0;
31
31
  /* If using an image, the background image should have dimensions of 1875x1275 pixels. */
32
- background-image: url(https://s3-us-west-2.amazonaws.com/lob-assets/beach.jpg);
32
+ background-image: url(https://s3-us-west-2.amazonaws.com/public.lob.com/assets/beach.jpg);
33
33
  background-size: 6.25in 4.25in;
34
34
  background-repeat: no-repeat;
35
35
  }
@@ -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
@@ -1,11 +1,12 @@
1
1
  require "lob/resources/address"
2
- require "lob/resources/area"
3
2
  require "lob/resources/bank_account"
4
3
  require "lob/resources/check"
4
+ require "lob/resources/group"
5
+ require "lob/resources/groups_member"
5
6
  require "lob/resources/intl_verifications"
6
7
  require "lob/resources/letter"
7
8
  require "lob/resources/postcard"
8
- require "lob/resources/route"
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"
@@ -23,10 +24,6 @@ module Lob
23
24
  @config = config
24
25
  end
25
26
 
26
- def areas
27
- Lob::Resources::Area.new(config)
28
- end
29
-
30
27
  def addresses
31
28
  Lob::Resources::Address.new(config)
32
29
  end
@@ -38,6 +35,14 @@ module Lob
38
35
  def checks
39
36
  Lob::Resources::Check.new(config)
40
37
  end
38
+
39
+ def groups
40
+ Lob::Resources::Group.new(config)
41
+ end
42
+
43
+ def groups_members
44
+ Lob::Resources::GroupsMember.new(config)
45
+ end
41
46
 
42
47
  def intl_verifications
43
48
  Lob::Resources::IntlVerifications.new(config)
@@ -51,8 +56,8 @@ module Lob
51
56
  Lob::Resources::Postcard.new(config)
52
57
  end
53
58
 
54
- def routes
55
- Lob::Resources::Route.new(config)
59
+ def self_mailers
60
+ Lob::Resources::SelfMailer.new(config)
56
61
  end
57
62
 
58
63
  def us_autocompletions
@@ -2,13 +2,11 @@ require "lob/resources/resource_base"
2
2
 
3
3
  module Lob
4
4
  module Resources
5
- class Area < Lob::Resources::ResourceBase
6
-
7
- undef_method :destroy
5
+ class Group < Lob::Resources::ResourceBase
8
6
 
9
7
  def initialize(config)
10
8
  super(config)
11
- @endpoint = "areas"
9
+ @endpoint = "groups"
12
10
  end
13
11
 
14
12
  end
@@ -0,0 +1,66 @@
1
+ require "rest-client"
2
+ require "json"
3
+ require "uri"
4
+
5
+ module Lob
6
+ module Resources
7
+ class GroupsMember < Lob::Resources::ResourceBase
8
+
9
+ attr_reader :config, :endpoint
10
+
11
+ def initialize(config)
12
+ super(config)
13
+ @endpoint = "members"
14
+ end
15
+
16
+ def list(group_id, query={})
17
+ request = {
18
+ method: :get,
19
+ url: endpoint_url(group_id),
20
+ query: query
21
+ }
22
+
23
+ submit request
24
+ end
25
+
26
+ def find(group_id, resource_id)
27
+ request = {
28
+ method: :get,
29
+ url: resource_url(group_id, resource_id)
30
+ }
31
+
32
+ submit request
33
+ end
34
+
35
+ def create(group_id, body={}, headers={}, query={})
36
+ request = {
37
+ method: :post,
38
+ url: endpoint_url(group_id),
39
+ body: body,
40
+ headers: headers,
41
+ query: query
42
+ }
43
+
44
+ submit request
45
+ end
46
+
47
+ def destroy(group_id, resource_id)
48
+ request = {
49
+ method: :delete,
50
+ url: resource_url(group_id, resource_id)
51
+ }
52
+
53
+ submit request
54
+ end
55
+
56
+ def endpoint_url(group_id)
57
+ "#{base_url}/groups/#{group_id}/#{endpoint}"
58
+ end
59
+
60
+ def resource_url(group_id, resource_id)
61
+ "#{endpoint_url(group_id)}/#{resource_id}"
62
+ end
63
+
64
+ end
65
+ end
66
+ end