usps-imis-api 0.6.0 → 0.6.1
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/.rubocop.yml +0 -2
- data/Gemfile.lock +29 -1
- data/Readme.md +8 -7
- data/lib/usps/imis/config.rb +15 -9
- data/lib/usps/imis/version.rb +1 -1
- data/spec/lib/usps/imis/config_spec.rb +29 -3
- data/spec/spec_helper.rb +1 -0
- data/usps-imis-api.gemspec +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cbe7660dffdee043ffdbe92a012879ceb439946b737f34fe9ca16d6f34e68b1
|
|
4
|
+
data.tar.gz: 065c486f386c7b73501dda6bf92a0214680e3ab13104388de29613d4bb4d7315
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67e8a5cf1cb919bccaada7960f1680426491880340f68eb8ed3ed57e5922bfdd6ab98208534367679aaec6b0026c1afb8161e5df73c7fd1dff383293882239b7
|
|
7
|
+
data.tar.gz: 830f0e96d1528bd434a4122511ab15165d27ef42f0383713e10640906395d19742e49b5da8858021fa3a2dbd64be699c5adf2c08f4897a5c3d6b94f8bb3d270f
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
usps-imis-api (0.6.
|
|
4
|
+
usps-imis-api (0.6.1)
|
|
5
|
+
activesupport (~> 8.0)
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
10
|
+
activesupport (8.0.3)
|
|
11
|
+
base64
|
|
12
|
+
benchmark (>= 0.3)
|
|
13
|
+
bigdecimal
|
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
15
|
+
connection_pool (>= 2.2.5)
|
|
16
|
+
drb
|
|
17
|
+
i18n (>= 1.6, < 2)
|
|
18
|
+
logger (>= 1.4.2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
securerandom (>= 0.3)
|
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
+
uri (>= 0.13.1)
|
|
9
23
|
ast (2.4.2)
|
|
24
|
+
base64 (0.3.0)
|
|
25
|
+
benchmark (0.4.1)
|
|
26
|
+
bigdecimal (3.3.1)
|
|
27
|
+
concurrent-ruby (1.3.5)
|
|
28
|
+
connection_pool (2.5.4)
|
|
10
29
|
date (3.4.1)
|
|
11
30
|
diff-lcs (1.5.1)
|
|
12
31
|
docile (1.4.1)
|
|
13
32
|
dotenv (3.1.4)
|
|
33
|
+
drb (2.2.3)
|
|
14
34
|
erb (5.0.3)
|
|
35
|
+
i18n (1.14.7)
|
|
36
|
+
concurrent-ruby (~> 1.0)
|
|
15
37
|
io-console (0.8.1)
|
|
16
38
|
irb (1.15.2)
|
|
17
39
|
pp (>= 0.6.0)
|
|
@@ -19,6 +41,8 @@ GEM
|
|
|
19
41
|
reline (>= 0.4.2)
|
|
20
42
|
json (2.7.2)
|
|
21
43
|
language_server-protocol (3.17.0.3)
|
|
44
|
+
logger (1.7.0)
|
|
45
|
+
minitest (5.26.0)
|
|
22
46
|
parallel (1.26.3)
|
|
23
47
|
parser (3.3.5.0)
|
|
24
48
|
ast (~> 2.4.1)
|
|
@@ -67,6 +91,7 @@ GEM
|
|
|
67
91
|
rubocop-rspec (3.1.0)
|
|
68
92
|
rubocop (~> 1.61)
|
|
69
93
|
ruby-progressbar (1.13.0)
|
|
94
|
+
securerandom (0.4.1)
|
|
70
95
|
simplecov (0.22.0)
|
|
71
96
|
docile (~> 1.1)
|
|
72
97
|
simplecov-html (~> 0.11)
|
|
@@ -75,7 +100,10 @@ GEM
|
|
|
75
100
|
simplecov_json_formatter (0.1.4)
|
|
76
101
|
stringio (3.1.7)
|
|
77
102
|
tsort (0.2.0)
|
|
103
|
+
tzinfo (2.0.6)
|
|
104
|
+
concurrent-ruby (~> 1.0)
|
|
78
105
|
unicode-display_width (2.6.0)
|
|
106
|
+
uri (1.0.4)
|
|
79
107
|
|
|
80
108
|
PLATFORMS
|
|
81
109
|
arm64-darwin-23
|
data/Readme.md
CHANGED
|
@@ -13,7 +13,7 @@ gem install usps-imis-api
|
|
|
13
13
|
or add this line to your Gemfile:
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
gem 'usps-imis-api', '
|
|
16
|
+
gem 'usps-imis-api', '~> 0.6.1'
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Setup
|
|
@@ -25,9 +25,11 @@ require 'dotenv/load' # Optionally load environment variables from `.env` file
|
|
|
25
25
|
require 'usps/imis'
|
|
26
26
|
|
|
27
27
|
Usps::Imis.configure do |config|
|
|
28
|
-
|
|
29
|
-
config.
|
|
28
|
+
# This will default to `Rails.env` if available.
|
|
29
|
+
config.environment = :development
|
|
30
30
|
|
|
31
|
+
# These options will default to the listed `ENV` variable if available.
|
|
32
|
+
config.imis_id_query_name = ENV['IMIS_ID_QUERY_NAME']
|
|
31
33
|
config.username = ENV['IMIS_USERNAME']
|
|
32
34
|
config.password = ENV['IMIS_PASSWORD']
|
|
33
35
|
end
|
|
@@ -222,10 +224,7 @@ end
|
|
|
222
224
|
|
|
223
225
|
## Exception Handling
|
|
224
226
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
To print exception information to STDERR when raising, set the environment
|
|
228
|
-
variable `IMIS_ERROR_LOG_TO_STDERR=true`.
|
|
227
|
+
All internal exceptions inherit from `Usps::Imis::ApiError`.
|
|
229
228
|
|
|
230
229
|
## Automated Testing and Linting
|
|
231
230
|
|
|
@@ -241,6 +240,8 @@ Linting is available by running:
|
|
|
241
240
|
bundle exec rubocop
|
|
242
241
|
```
|
|
243
242
|
|
|
243
|
+
100% branch coverage is enforced on the test suite.
|
|
244
|
+
|
|
244
245
|
### GitHub Actions
|
|
245
246
|
|
|
246
247
|
Testing and linting are automatically run on every push.
|
data/lib/usps/imis/config.rb
CHANGED
|
@@ -8,25 +8,31 @@ module Usps
|
|
|
8
8
|
IMIS_ROOT_URL_PROD = 'https://portal.americasboatingclub.org'
|
|
9
9
|
IMIS_ROOT_URL_DEV = 'https://abcdev.imiscloud.com'
|
|
10
10
|
|
|
11
|
-
attr_accessor :
|
|
11
|
+
attr_accessor :imis_id_query_name, :username, :password
|
|
12
|
+
attr_reader :environment
|
|
12
13
|
|
|
13
14
|
def initialize
|
|
15
|
+
@environment = defined?(Rails) ? Rails.env : ActiveSupport::StringInquirer.new('development')
|
|
16
|
+
@imis_id_query_name = ENV.fetch('IMIS_ID_QUERY_NAME', nil)
|
|
17
|
+
@username = ENV.fetch('IMIS_USERNAME', nil)
|
|
18
|
+
@password = ENV.fetch('IMIS_PASSWORD', nil)
|
|
19
|
+
|
|
14
20
|
yield self if block_given?
|
|
15
21
|
end
|
|
16
22
|
|
|
23
|
+
def environment=(env)
|
|
24
|
+
@environment = ActiveSupport::StringInquirer.new(env.to_s)
|
|
25
|
+
end
|
|
26
|
+
|
|
17
27
|
# Environment-specific API endpoint hostname
|
|
18
28
|
#
|
|
19
29
|
# @return The API hostname for the current environment
|
|
20
30
|
#
|
|
21
31
|
def hostname
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
IMIS_ROOT_URL_DEV
|
|
27
|
-
else
|
|
28
|
-
raise Error::ApiError, "Unexpected API environment: #{environment}"
|
|
29
|
-
end
|
|
32
|
+
return IMIS_ROOT_URL_PROD if environment.production?
|
|
33
|
+
return IMIS_ROOT_URL_DEV if environment.development?
|
|
34
|
+
|
|
35
|
+
raise Error::ApiError, "Unexpected API environment: #{environment}"
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
# Ruby 3.5 instance variable filter
|
data/lib/usps/imis/version.rb
CHANGED
|
@@ -5,10 +5,36 @@ require 'spec_helper'
|
|
|
5
5
|
describe Usps::Imis::Config do
|
|
6
6
|
let(:config) { described_class.new }
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
describe 'environment' do
|
|
9
|
+
subject { config.environment }
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let(:config) { described_class.new }
|
|
12
|
+
|
|
13
|
+
context 'when not specified' do
|
|
14
|
+
it { is_expected.to be_development }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context 'when specified' do
|
|
18
|
+
before { config.environment = 'something' }
|
|
19
|
+
|
|
20
|
+
it { is_expected.to be_something }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'when specified on initialize' do
|
|
24
|
+
subject { config.environment }
|
|
25
|
+
|
|
26
|
+
let(:config) do
|
|
27
|
+
described_class.new { |c| c.environment = 'test' }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it { is_expected.to be_test }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context 'when in Rails' do
|
|
34
|
+
before { stub_const('Rails', Struct.new(:env).new(ActiveSupport::StringInquirer.new('qa'))) }
|
|
35
|
+
|
|
36
|
+
it { is_expected.to be_qa }
|
|
37
|
+
end
|
|
12
38
|
end
|
|
13
39
|
|
|
14
40
|
describe '#hostname' do
|
data/spec/spec_helper.rb
CHANGED
data/usps-imis-api.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usps-imis-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activesupport
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '8.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '8.0'
|
|
12
26
|
description: A wrapper for the iMIS API.
|
|
13
27
|
email: jsfiander@gmail.com
|
|
14
28
|
executables: []
|