lob 5.4.1 → 5.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cba07a0c8f145a8df9e935499f91a0dd6d1554f97b9ba8479b2fcd4ccaa5d3b9
4
- data.tar.gz: 8d48e11c13ba9a5d611a161ad6c9d78a315464f610910ec71f553cd365ccf0b9
3
+ metadata.gz: 14de59724a258146efda8e6e01416f8c783c5f63e92989dd017ca1ec17c7c43a
4
+ data.tar.gz: 49c06775670f7101fec498ea258ad2c415d086ea16c15cee163d34379ebacbae
5
5
  SHA512:
6
- metadata.gz: 010dd2a65e955352fec5e191c306e980a29ab40cb45b41b557c47e27edf9dad1f0e63067fc2758a9366163ed36f16d426f2ca1bebe8088be2bbc86deeee334bc
7
- data.tar.gz: 49d65f5c597defa7a3989c6888869e12870736724970598c44c4e6460775f48ab0340d32e41dbf87c8c0a4f32d0fac2a7bc4feef45eee591ed0a21c295c7d31b
6
+ metadata.gz: ad126ff6eef5e894245b99842ada43132454074dbad8d43093828f3069b173c1ff97940769cb55febe079d6bb48de8152d42ac28ed904e7f93df011252528084
7
+ data.tar.gz: d8f04a69fca64ef67ddfd2ed109f851917ac269f6996ae74009939f8601cd8060eeed56868c40303b9fad56857f5c6df3ff374f19a8a315e6c9ac6bbe39eb60c
@@ -0,0 +1,32 @@
1
+ name: Run tests
2
+
3
+ on: [pull_request]
4
+ jobs:
5
+ ruby_tests:
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ matrix:
9
+ ruby-version: ['jruby-9.2.9.0', '2.6', '2.7', '3.0']
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Setup
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby-version }}
16
+ - name: Install Dependencies
17
+ run: bundle install
18
+ - name: Run Tests
19
+ env:
20
+ API_KEY: ${{ secrets.API_KEY }}
21
+ JRUBY_OPT: --2.0
22
+ run: bundle exec rake test
23
+ - name: Send coverage to Coveralls
24
+ uses: coverallsapp/github-action@master
25
+ with:
26
+ github-token: ${{ secrets.GITHUB_TOKEN }}
27
+ path-to-lcov: ./coverage/lcov/lcov.info
28
+
29
+
30
+
31
+
32
+
@@ -0,0 +1,27 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish_gem:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Setup
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.7
16
+ - name: Install Dependencies
17
+ run: bundle install
18
+ - name: Publish Gem
19
+ run: |
20
+ mkdir -p $HOME/.gem
21
+ touch $HOME/.gem/credentials
22
+ chmod 0600 $HOME/.gem/credentials
23
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
24
+ gem build *.gemspec
25
+ gem push *.gem
26
+ env:
27
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .config
5
5
  .yardoc
6
6
  .DS_Store
7
+ .idea
7
8
  Gemfile.lock
8
9
  InstalledFiles
9
10
  _yardoc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [**5.4.5**](https://github.com/lob/lob-ruby/releases/tag/v5.4.5) (2022-01-11)
2
+ - [**203**](https://github.com/lob/lob-ruby/pull/203) Pass through proxy to rest-client if supplied
3
+ ## [**5.4.4**](https://github.com/lob/lob-ruby/releases/tag/v5.4.4) (2021-12-16)
4
+ - [**202**](https://github.com/lob/lob-ruby/pull/202) Fix for coveralls API for GH actions and fix for error in resource_base.rb
5
+ ## [**5.4.3**](https://github.com/lob/lob-ruby/releases/tag/v5.4.3) (2021-12-15)
6
+ - [**199**](https://github.com/lob/lob-ruby/pull/199) Refactor ResourceBase to make the options sent to rest-client more configurable
7
+ ## [**5.4.2**](https://github.com/lob/lob-ruby/releases/tag/v5.4.2) (2021-12-08)
8
+ - [**198**](https://github.com/lob/lob-ruby/pull/198) specified ruby version in publish action
9
+ - [**195**](https://github.com/lob/lob-ruby/pull/195) added links to example scripts in README file & gh actions to release
1
10
  ## [**5.4.1**](https://github.com/lob/lob-ruby/releases/tag/v5.4.1) (2021-09-28)
2
11
  - [**193**](https://github.com/lob/lob-ruby/pull/193) Minor patches
3
12
  ## [**5.4.0**](https://github.com/lob/lob-ruby/releases/tag/v5.4.0) (2021-09-21)
data/README.md CHANGED
@@ -69,6 +69,9 @@ lob = Lob::Client.new(api_key: "your-api-key")
69
69
 
70
70
  # To initialize a Lob object with an older API version
71
71
  lob = Lob::Client.new(api_key: "your-api-key", api_version: "2014-12-18")
72
+
73
+ # To initialize a Lob object that needs to communicate via a proxy
74
+ lob = Lob::Client.new(api_key: "your-api-key", proxy: "http://proxy.example.com)
72
75
  ```
73
76
 
74
77
  #### Caution: Pass zero-prefixed zip codes as strings
data/examples/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Ruby Examples
2
2
 
3
- Here we have put together a handful of ruby examples to help get you started. Please read through the official [API Documentation](https://docs.lob.com) to get a complete sense of what to expect from each endpoint. As always, feel free to [contact us](https://lob.com/support) directly if you have any questions on implementation.
3
+ Here we have put together a handful of ruby examples to help get you started. Please read through the official [API Documentation](https://docs.lob.com) to get a complete sense of what to expect from each endpoint. As always, feel free to [contact us](https://lob.com/support) directly if you have any questions on implementation. Thank you for using Lob!
4
4
 
5
5
  To run these example commands, make sure you have a supported version of Ruby installed, including all the necessary gems.
6
6
 
7
- ## /csv_checks/
7
+ ## [/csv_checks/](./csv_checks/)
8
8
 
9
9
  An example showing how to dynamically create checks from a CSV using HTML, merge variables, and Lob's [Checks API](https://lob.com/services/checks).
10
10
 
@@ -12,7 +12,7 @@ An example showing how to dynamically create checks from a CSV using HTML, merge
12
12
  bundle exec ruby examples/csv_checks/create_checks.rb
13
13
  ```
14
14
 
15
- ## /csv_letters/
15
+ ## [/csv_letters/](./csv_letters/)
16
16
 
17
17
  An example showing how to dynamically create letters from a CSV using HTML, a custom font, merge variables, and Lob's [Letters API](https://lob.com/services/letters).
18
18
 
@@ -20,7 +20,7 @@ An example showing how to dynamically create letters from a CSV using HTML, a cu
20
20
  bundle exec ruby examples/csv_letters/create_letters.rb
21
21
  ```
22
22
 
23
- ## /csv_postcards/
23
+ ## [/csv_postcards/](./csv_postcards/)
24
24
 
25
25
  An example showing how to dynamically create postcards from a CSV using HTML, a custom font, merge variables, and Lob's [Postcards API](https://lob.com/services/postcards).
26
26
 
@@ -28,7 +28,7 @@ An example showing how to dynamically create postcards from a CSV using HTML, a
28
28
  bundle exec ruby examples/csv_postcards/create_postcards.rb
29
29
  ```
30
30
 
31
- ## /csv_verify/
31
+ ## [/csv_verify/](./csv_verify/)
32
32
 
33
33
  An example showing how to validate and cleanse a CSV spreadsheet full of shipping addresses using Lob's [US Verification API](https://lob.com/services/verifications).
34
34
 
@@ -38,7 +38,7 @@ Please note that if you are running this with a Test API Key, the verification A
38
38
  bundle exec ruby examples/csv_verify/verify.rb
39
39
  ```
40
40
 
41
- ## /checks.rb
41
+ ## [/checks.rb](./checks.rb)
42
42
 
43
43
  An example showing how to create a check using Lob's [Checks API](https://lob.com/services/checks).
44
44
 
@@ -46,7 +46,7 @@ An example showing how to create a check using Lob's [Checks API](https://lob.co
46
46
  bundle exec ruby examples/checks.rb
47
47
  ```
48
48
 
49
- ## /letters.rb
49
+ ## [/letters.rb](./letters.rb)
50
50
 
51
51
  An example showing how to create a letter using Lob's [Letters API](https://lob.com/services/letters).
52
52
 
@@ -54,7 +54,7 @@ An example showing how to create a letter using Lob's [Letters API](https://lob.
54
54
  bundle exec ruby examples/letters.rb
55
55
  ```
56
56
 
57
- ## /postcards.rb
57
+ ## [/postcards.rb](./postcards.rb)
58
58
 
59
59
  An example showing how to create a postcard using Lob's [Postcards API](https://lob.com/services/postcards).
60
60
 
@@ -62,7 +62,7 @@ An example showing how to create a postcard using Lob's [Postcards API](https://
62
62
  bundle exec ruby examples/postcards.rb
63
63
  ```
64
64
 
65
- ## /postcards_idempotent.rb
65
+ ## [/postcards_idempotent.rb](./postcards_idempotent.rb)
66
66
 
67
67
  An example showing how to create an idempotent postcard request using Lob's [Postcards API](https://lob.com/services/postcards).
68
68
 
@@ -70,7 +70,7 @@ An example showing how to create an idempotent postcard request using Lob's [Pos
70
70
  bundle exec ruby examples/postcards_idempotent.rb
71
71
  ```
72
72
 
73
- ## /postcards_intl.rb
73
+ ## [/postcards_intl.rb](./postcards_intl.rb)
74
74
 
75
75
  An example showing how to create an international postcard using Lob's [Postcards API](https://lob.com/services/postcards).
76
76
 
@@ -78,7 +78,7 @@ An example showing how to create an international postcard using Lob's [Postcard
78
78
  bundle exec ruby examples/postcards_intl.rb
79
79
  ```
80
80
 
81
- ## /postcards_remote.rb
81
+ ## [/postcards_remote.rb](./postcards_remote.rb)
82
82
 
83
83
  An example showing how to create a postcard with remote files, using Lob's [Postcards API](https://lob.com/services/postcards).
84
84
 
@@ -86,7 +86,7 @@ An example showing how to create a postcard with remote files, using Lob's [Post
86
86
  bundle exec ruby examples/postcards_remote.rb
87
87
  ```
88
88
 
89
- ## /postcards_send_date.rb
89
+ ## [/postcards_send_date.rb](./postcards_send_date.rb)
90
90
 
91
91
  An example showing how to create a postcard with a specified send date, using Lob's [Postcards API](https://lob.com/services/postcards).
92
92
 
@@ -94,7 +94,7 @@ An example showing how to create a postcard with a specified send date, using Lo
94
94
  bundle exec ruby examples/postcards_send_date.rb
95
95
  ```
96
96
 
97
- ## /postcards_template.rb
97
+ ## [/postcards_template.rb](./postcards_template.rb)
98
98
 
99
99
  An example showing how to create a postcard with a saved template, using Lob's [Postcards API](https://lob.com/services/postcards).
100
100
 
@@ -102,7 +102,7 @@ An example showing how to create a postcard with a saved template, using Lob's [
102
102
  bundle exec ruby examples/postcards_template.rb
103
103
  ```
104
104
 
105
- ## /self_mailers.rb
105
+ ## [/self_mailers.rb](./self_mailers.rb)
106
106
 
107
107
  An example showing how to create a self mailer using Lob's Self Mailers API.
108
108
 
@@ -71,17 +71,25 @@ module Lob
71
71
  if query != {}
72
72
  url = "#{url}?#{build_nested_query(query)}"
73
73
  end
74
-
75
- begin
76
- if method == :get || method == :delete
77
- response = RestClient.send(method, url, headers)
78
- else
79
- if body[:merge_variables] and body[:merge_variables].class == Hash
80
- body[:merge_variables] = body[:merge_variables].to_json()
81
- end
82
- response = RestClient.send(method, url, body, headers)
74
+
75
+ client_params = {
76
+ headers: headers,
77
+ method: method,
78
+ url: url,
79
+ }
80
+
81
+ client_params[:proxy] = config[:proxy] if config.key?(:proxy)
82
+
83
+ unless method == :delete || method == :get
84
+ if body and body[:merge_variables] and body[:merge_variables].class == Hash
85
+ body[:merge_variables] = body[:merge_variables].to_json
83
86
  end
84
87
 
88
+ client_params[:payload] = body
89
+ end
90
+ begin
91
+ response = RestClient::Request.execute(client_params)
92
+
85
93
  body = JSON.parse(response)
86
94
 
87
95
  body.define_singleton_method(:_response) do
data/lib/lob/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lob
2
- VERSION = "5.4.1"
2
+ VERSION = "5.4.5"
3
3
  end
data/lob.gemspec CHANGED
@@ -23,8 +23,9 @@ Gem::Specification.new do |spec|
23
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.23"
27
- spec.add_development_dependency "simplecov", "~> 0.16.1"
26
+ spec.add_development_dependency "simplecov-lcov"
27
+ spec.add_development_dependency "coveralls_reborn", "~> 0.23.1"
28
+ spec.add_development_dependency "simplecov", "~> 0.21.0"
28
29
  spec.add_development_dependency "json", "~> 2.3.1"
29
30
  spec.add_development_dependency "uri", "~> 0.10.1"
30
31
  end
data/spec/spec_helper.rb CHANGED
@@ -3,10 +3,12 @@ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
3
3
  require "simplecov"
4
4
  require "coveralls"
5
5
 
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
7
- SimpleCov::Formatter::HTMLFormatter,
8
- Coveralls::SimpleCov::Formatter
9
- ])
6
+ require 'simplecov-lcov'
7
+
8
+ SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
9
+ SimpleCov::Formatter::LcovFormatter.config.lcov_file_name = 'lcov.info'
10
+
11
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
10
12
  SimpleCov.start
11
13
 
12
14
  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.4.1
4
+ version: 5.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -73,33 +73,47 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.2'
75
75
  - !ruby/object:Gem::Dependency
76
- name: coveralls
76
+ name: simplecov-lcov
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: coveralls_reborn
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: 0.8.23
95
+ version: 0.23.1
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: 0.8.23
102
+ version: 0.23.1
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: simplecov
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: 0.16.1
109
+ version: 0.21.0
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: 0.16.1
116
+ version: 0.21.0
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: json
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -135,8 +149,9 @@ executables: []
135
149
  extensions: []
136
150
  extra_rdoc_files: []
137
151
  files:
152
+ - ".github/workflows/run_tests_job.yml"
153
+ - ".github/workflows/update_gem.yml"
138
154
  - ".gitignore"
139
- - ".travis.yml"
140
155
  - CHANGELOG.md
141
156
  - CONTRIBUTING.md
142
157
  - Gemfile
@@ -232,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
247
  - !ruby/object:Gem::Version
233
248
  version: '0'
234
249
  requirements: []
235
- rubygems_version: 3.0.3
250
+ rubygems_version: 3.1.6
236
251
  signing_key:
237
252
  specification_version: 4
238
253
  summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - jruby-9.1.9.0
5
- - jruby-9.2.9.0
6
- - 2.6
7
- - 2.7
8
- - 3.0
9
- env:
10
- JRUBY_OPTS=--2.0
11
-
12
- script: bundle exec rake test