usps-imis-api 0.4.1 → 0.4.3

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: 2539e0ba94306f96b55dc0bb009875a4ef810b1ddd361dff751eabe113d1d1d7
4
- data.tar.gz: 82f4733468b0b00d9dd7be58d2d3a5dea23ba6a082e5f3948d0def97ba787d95
3
+ metadata.gz: 3e49829b6dee8973f1de4b275516060ced7b426cedd00fe7e4ccaba5e29efc52
4
+ data.tar.gz: 8558346d33b416f3d58f9fa5047b925f580c8d8d5123463c6fe137335ddd93d7
5
5
  SHA512:
6
- metadata.gz: 77732983cdfd02ee695173f8873000f70ab98d2cb20e4ff8742119e167dc4757f6bdb278a26114823f998a7706ed5034b48600ffc9c5bf79851352e0db6fc6e6
7
- data.tar.gz: 30a48655eb204abbaf8a4084241661bb52bc27937964984b59e13bffb8373919550f93c51f770d3d4c627a77970c1461525237adbcd3540b9d5360462bc8d02e
6
+ metadata.gz: 89f31684df0cb6001fa31966eec99bf8ec9e9dbdab86ae8213a43200f23bf306b204bc9ecb61d9f6ac066869387e4ba048923af1a77b4c7dd1dec59a9cb9b215
7
+ data.tar.gz: 376cc34e675f9caadd5c985733b28ea2e93d4ba3752de8d9fd843d3a15866280f3075138a275be47dfd77d06bb24f2ba81cad8527308060a1e8893befbe5381e
@@ -16,17 +16,25 @@ jobs:
16
16
  rubocop:
17
17
  runs-on: ubuntu-24.04
18
18
  environment: "USPS iMIS API - Ruby"
19
+ strategy:
20
+ matrix:
21
+ ruby: ['3.4', head]
19
22
  steps:
20
23
  - name: Checkout Code
21
24
  uses: actions/checkout@v4
22
25
  - name: Setup Ruby
23
26
  uses: ruby/setup-ruby@v1
24
- with: { bundler-cache: true }
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
25
30
  - name: Run Rubocop
26
31
  run: bundle exec rubocop
27
32
  rspec:
28
33
  runs-on: ubuntu-24.04
29
34
  environment: "USPS iMIS API - Ruby"
35
+ strategy:
36
+ matrix:
37
+ ruby: ['3.4', head]
30
38
  env:
31
39
  IMIS_USERNAME: ${{ secrets.IMIS_USERNAME }}
32
40
  IMIS_PASSWORD: ${{ secrets.IMIS_PASSWORD }}
@@ -36,12 +44,14 @@ jobs:
36
44
  uses: actions/checkout@v4
37
45
  - name: Setup Ruby
38
46
  uses: ruby/setup-ruby@v1
39
- with: { bundler-cache: true }
47
+ with:
48
+ ruby-version: ${{ matrix.ruby }}
49
+ bundler-cache: true
40
50
  - name: Run Rspec
41
51
  run: bundle exec rspec --format documentation --order rand --color --tty
42
52
  - name: Store Coverage
43
53
  uses: actions/upload-artifact@v4
44
54
  with:
45
- name: coverage-rspec
55
+ name: coverage-rspec-${{ matrix.ruby }}
46
56
  include-hidden-files: true
47
57
  path: coverage/
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ require:
2
2
  - rubocop-rspec
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 3.0
5
+ TargetRubyVersion: 3.4
6
6
  Exclude:
7
7
  - bin/**/*
8
8
  - config/**/*
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.3
1
+ 3.5-dev
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'dotenv', '>= 3.1.4'
7
+ gem 'irb', '>= 1.15.2'
7
8
  gem 'rake', '>= 13.2.1'
8
9
  gem 'rspec', '>= 3.13.0'
9
10
  gem 'rubocop', '>= 1.66.1'
data/Gemfile.lock CHANGED
@@ -1,25 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-imis-api (0.4.1)
4
+ usps-imis-api (0.4.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
+ date (3.4.1)
10
11
  diff-lcs (1.5.1)
11
12
  docile (1.4.1)
12
13
  dotenv (3.1.4)
14
+ erb (5.0.3)
15
+ io-console (0.8.1)
16
+ irb (1.15.2)
17
+ pp (>= 0.6.0)
18
+ rdoc (>= 4.0.0)
19
+ reline (>= 0.4.2)
13
20
  json (2.7.2)
14
21
  language_server-protocol (3.17.0.3)
15
22
  parallel (1.26.3)
16
23
  parser (3.3.5.0)
17
24
  ast (~> 2.4.1)
18
25
  racc
26
+ pp (0.6.3)
27
+ prettyprint
28
+ prettyprint (0.2.0)
29
+ psych (5.2.6)
30
+ date
31
+ stringio
19
32
  racc (1.8.1)
20
33
  rainbow (3.1.1)
21
34
  rake (13.2.1)
35
+ rdoc (6.15.0)
36
+ erb
37
+ psych (>= 4.0.0)
38
+ tsort
22
39
  regexp_parser (2.9.2)
40
+ reline (0.6.2)
41
+ io-console (~> 0.5)
23
42
  rspec (3.13.0)
24
43
  rspec-core (~> 3.13.0)
25
44
  rspec-expectations (~> 3.13.0)
@@ -54,6 +73,8 @@ GEM
54
73
  simplecov_json_formatter (~> 0.1)
55
74
  simplecov-html (0.13.1)
56
75
  simplecov_json_formatter (0.1.4)
76
+ stringio (3.1.7)
77
+ tsort (0.2.0)
57
78
  unicode-display_width (2.6.0)
58
79
 
59
80
  PLATFORMS
@@ -62,6 +83,7 @@ PLATFORMS
62
83
 
63
84
  DEPENDENCIES
64
85
  dotenv (>= 3.1.4)
86
+ irb (>= 1.15.2)
65
87
  rake (>= 13.2.1)
66
88
  rspec (>= 3.13.0)
67
89
  rubocop (>= 1.66.1)
data/lib/usps/imis/api.rb CHANGED
@@ -6,7 +6,7 @@ module Usps
6
6
  AUTHENTICATION_PATH = 'Token'
7
7
  API_PATH = 'api'
8
8
  QUERY_PATH = 'api/Query'
9
- PANELS = Struct.new(:vsc)
9
+ PANELS = Struct.new(:vsc, :education)
10
10
 
11
11
  attr_reader :token, :token_expiration, :imis_id
12
12
 
@@ -24,7 +24,7 @@ module Usps
24
24
  # Convert a member's certificate number into an iMIS ID number
25
25
  #
26
26
  def imis_id_for(certificate)
27
- result = query(Imis.configuration.imis_id_query_name, { certificate: certificate })
27
+ result = query(Imis.configuration.imis_id_query_name, { certificate: })
28
28
  @imis_id = result['Items']['$values'][0]['ID']
29
29
  rescue StandardError
30
30
  raise Error::Api, 'Member not found'
@@ -34,10 +34,10 @@ module Usps
34
34
  #
35
35
  # This should be used with methods that do not change the value of `imis_id`
36
36
  #
37
- def with(id, &block)
37
+ def with(id, &)
38
38
  old_id = imis_id
39
39
  self.imis_id = id
40
- instance_eval(&block)
40
+ instance_eval(&)
41
41
  ensure
42
42
  self.imis_id = old_id
43
43
  end
@@ -45,7 +45,7 @@ module Usps
45
45
  # Get a business object for the current member
46
46
  #
47
47
  def get(business_object_name, url_id: nil)
48
- uri = uri_for(business_object_name, url_id: url_id)
48
+ uri = uri_for(business_object_name, url_id:)
49
49
  request = Net::HTTP::Get.new(uri)
50
50
  result = submit(uri, authorize(request))
51
51
  JSON.parse(result.body)
@@ -57,13 +57,13 @@ module Usps
57
57
  #
58
58
  def put_fields(business_object_name, fields, url_id: nil)
59
59
  updated = filter_fields(business_object_name, fields)
60
- put(business_object_name, updated, url_id: url_id)
60
+ put(business_object_name, updated, url_id:)
61
61
  end
62
62
 
63
63
  # Update a business object for the current member
64
64
  #
65
65
  def put(business_object_name, body, url_id: nil)
66
- uri = uri_for(business_object_name, url_id: url_id)
66
+ uri = uri_for(business_object_name, url_id:)
67
67
  request = Net::HTTP::Put.new(uri)
68
68
  request.body = JSON.dump(body)
69
69
  result = submit(uri, authorize(request))
@@ -73,7 +73,7 @@ module Usps
73
73
  # Create a business object for the current member
74
74
  #
75
75
  def post(business_object_name, body, url_id: nil)
76
- uri = uri_for(business_object_name, url_id: url_id)
76
+ uri = uri_for(business_object_name, url_id:)
77
77
  request = Net::HTTP::Post.new(uri)
78
78
  request.body = JSON.dump(body)
79
79
  result = submit(uri, authorize(request))
@@ -85,7 +85,7 @@ module Usps
85
85
  # Returns empty string on success
86
86
  #
87
87
  def delete(business_object_name, url_id: nil)
88
- uri = uri_for(business_object_name, url_id: url_id)
88
+ uri = uri_for(business_object_name, url_id:)
89
89
  request = Net::HTTP::Delete.new(uri)
90
90
  result = submit(uri, authorize(request))
91
91
  result.body
@@ -111,7 +111,8 @@ module Usps
111
111
 
112
112
  def panels
113
113
  @panels ||= PANELS.new(
114
- Panel::Vsc.new(self)
114
+ Panel::Vsc.new(self),
115
+ Panel::Education.new(self)
115
116
  )
116
117
  end
117
118
 
@@ -119,6 +120,8 @@ module Usps
119
120
  mapper.update(data)
120
121
  end
121
122
 
123
+ def instance_variables_to_inspect = %i[@token_expiration @imis_id]
124
+
122
125
  private
123
126
 
124
127
  def client(uri)
@@ -22,6 +22,8 @@ module Usps
22
22
  raise Error::Api, "Unexpected API environment: #{environment}"
23
23
  end
24
24
  end
25
+
26
+ def instance_variables_to_inspect = %i[@environment @imis_id_query_name @username]
25
27
  end
26
28
  end
27
29
  end
@@ -31,7 +31,7 @@ module Usps
31
31
  private
32
32
 
33
33
  def base_metadata
34
- { api: { status: status, body: body } }
34
+ { api: { status:, body: } }
35
35
  end
36
36
 
37
37
  def status
@@ -16,7 +16,7 @@ module Usps
16
16
 
17
17
  def initialize(api = nil, imis_id: nil)
18
18
  @api = api || Api.new
19
- api.imis_id = imis_id if imis_id
19
+ @api.imis_id = imis_id if imis_id
20
20
  end
21
21
 
22
22
  # Update a member's data on multiple affected business objects by arbitrary field names
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.4.1'
5
+ VERSION = '0.4.3'
6
6
  end
7
7
  end
@@ -34,4 +34,16 @@ describe Usps::Imis::Api do
34
34
  expect(api.with(6374) { panels.vsc.get(1433) }).to be_a(Hash)
35
35
  end
36
36
  end
37
+
38
+ describe '#inspect' do
39
+ it 'is configured to exclude the token instance variable' do
40
+ expect(api.instance_variables_to_inspect).not_to include(:@token)
41
+ end
42
+
43
+ it 'does not show the token instance variable' do
44
+ pending 'Requires Ruby 3.5' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new(3.5)
45
+
46
+ expect(api.inspect).not_to match(/ @token="/)
47
+ end
48
+ end
37
49
  end
@@ -34,7 +34,7 @@ describe Usps::Imis::Panel::Education do
34
34
  ordinal = new_record['Identity']['IdentityElements']['$values'][1]
35
35
 
36
36
  update_result =
37
- education.update(details.merge(source: 'Online Exams System - Modified', ordinal: ordinal))
37
+ education.update(details.merge(source: 'Online Exams System - Modified', ordinal:))
38
38
  updated = update_result['Properties']['$values'].find do |v|
39
39
  v['Name'] == 'ABC_Educ_Source_System'
40
40
  end
@@ -28,7 +28,7 @@ describe Usps::Imis::Panel::Vsc do
28
28
 
29
29
  ordinal = new_record['Identity']['IdentityElements']['$values'][1]
30
30
 
31
- update_result = vsc.update(details.merge(count: 43, ordinal: ordinal))
31
+ update_result = vsc.update(details.merge(count: 43, ordinal:))
32
32
  updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' }
33
33
  expect(updated['Value']['$value']).to eq(43)
34
34
 
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.metadata['rubygems_mfa_required'] = 'true'
16
16
 
17
- s.required_ruby_version = '>= 3.0'
17
+ s.required_ruby_version = '>= 3.4'
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-imis-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -56,14 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '3.0'
59
+ version: '3.4'
60
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.6.9
66
+ rubygems_version: 4.0.0.dev
67
67
  specification_version: 4
68
68
  summary: iMIS API Wrapper
69
69
  test_files: []