usps-imis-api 0.9.9 → 0.9.10.pre.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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/usps/imis/business_object.rb +0 -3
  3. data/lib/usps/imis/config.rb +1 -1
  4. data/lib/usps/imis/query.rb +0 -3
  5. data/lib/usps/imis/requests.rb +4 -0
  6. data/lib/usps/imis/version.rb +1 -1
  7. metadata +1 -70
  8. data/.github/workflows/main.yml +0 -57
  9. data/.gitignore +0 -5
  10. data/.rspec +0 -2
  11. data/.rubocop.yml +0 -89
  12. data/.ruby-version +0 -1
  13. data/.simplecov +0 -8
  14. data/Gemfile +0 -16
  15. data/Gemfile.lock +0 -147
  16. data/Rakefile +0 -12
  17. data/bin/console +0 -21
  18. data/bin/setup +0 -8
  19. data/spec/fixtures/vcr_cassettes/.keep +0 -0
  20. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_authorize/automatically_refreshes_an_expired_token.yml +0 -67
  21. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/gets_the_iMIS_ID.yml +0 -131
  22. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/with_a_query_error/wraps_errors.yml +0 -67
  23. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/does_not_show_the_token_instance_variable.yml +0 -67
  24. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/is_configured_to_exclude_the_token_instance_variable.yml +0 -67
  25. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/chains_with_on_to_a_single_block.yml +0 -256
  26. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/nests_on_and_with.yml +0 -256
  27. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/returns_a_BusinessObject_without_a_block.yml +0 -67
  28. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/sends_an_update_from_put.yml +0 -256
  29. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/sends_an_update.yml +0 -256
  30. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/when_receiving_a_response_error/wraps_the_error.yml +0 -67
  31. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_query/collects_all_query_results.yml +0 -67
  32. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_.yml +0 -67
  33. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_for.yml +0 -67
  34. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_put.yml +0 -256
  35. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_update.yml +0 -256
  36. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/uses_a_panel_correctly.yml +0 -145
  37. data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/stores_the_initial_imis_id.yml +0 -67
  38. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/_put_field/submits_the_correct_update_request.yml +0 -627
  39. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_filter_fields/formats_fields_correctly.yml +0 -67
  40. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/delegation_to_get_fields/delegates_to_get_fields.yml +0 -67
  41. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/returns_multiple_values.yml +0 -67
  42. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_a_string_value.yml +0 -67
  43. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_an_integer_value.yml +0 -67
  44. data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_fields/returns_multiple_values.yml +0 -67
  45. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/fetches_a_mapped_field.yml +0 -158
  46. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/raises_for_unmapped_updates.yml +0 -67
  47. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax.yml +0 -158
  48. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax_on_the_Api_directly.yml +0 -158
  49. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/raises_for_unmapped_updates.yml +0 -67
  50. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/sends_a_mapped_update.yml +0 -256
  51. data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/initialize_with_imis_id/stores_the_initial_imis_id.yml +0 -67
  52. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_business_object_to_be_defined.yml +0 -67
  53. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_payload_data_to_be_defined.yml +0 -67
  54. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/loads_a_specific_object.yml +0 -146
  55. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/returns_specific_fields.yml +0 -146
  56. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_field/returns_a_specific_field.yml +0 -146
  57. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_fields/returns_specific_fields.yml +0 -146
  58. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/interacts_with_records_correctly.yml +0 -495
  59. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/initialization_with_ID/can_initialize_with_an_iMIS_ID.yml +0 -67
  60. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/_get/loads_a_specific_object.yml +0 -145
  61. data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/handles_new_records_correctly.yml +0 -319
  62. data/spec/lib/usps/imis/api_spec.rb +0 -161
  63. data/spec/lib/usps/imis/business_object_spec.rb +0 -87
  64. data/spec/lib/usps/imis/config_spec.rb +0 -59
  65. data/spec/lib/usps/imis/data_spec.rb +0 -75
  66. data/spec/lib/usps/imis/error_spec.rb +0 -17
  67. data/spec/lib/usps/imis/errors/response_error_spec.rb +0 -107
  68. data/spec/lib/usps/imis/mapper_spec.rb +0 -55
  69. data/spec/lib/usps/imis/mocks/business_object_spec.rb +0 -65
  70. data/spec/lib/usps/imis/panels/base_panel_spec.rb +0 -33
  71. data/spec/lib/usps/imis/panels/education_spec.rb +0 -70
  72. data/spec/lib/usps/imis/panels/vsc_spec.rb +0 -37
  73. data/spec/lib/usps/imis/properties_spec.rb +0 -19
  74. data/spec/lib/usps/imis_spec.rb +0 -11
  75. data/spec/spec_helper.rb +0 -78
  76. data/usps-imis-api.gemspec +0 -20
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Usps::Imis::Panels::Education, :vcr do
6
- describe 'api example' do
7
- let(:education) { described_class.new }
8
-
9
- let(:details) do
10
- {
11
- certificate: 'E136924',
12
- description: 'Marine Navigation',
13
- effective_date: Time.now.strftime('%Y-%m-%dT00:00:00'),
14
- source: 'Online Exams System',
15
- code: 'MN',
16
- type_code: 'CRS'
17
- }
18
- end
19
-
20
- before { education.api.imis_id = 6374 }
21
-
22
- describe '#get' do
23
- it 'loads a specific object' do
24
- expect(education.get(90737)).to be_a(Usps::Imis::Data)
25
- end
26
-
27
- it 'returns specific fields' do
28
- expect(education.get(90737, 'ABC_Product_Code', 'ABC_Other_Code')).to eq(%w[CRS AP])
29
- end
30
- end
31
-
32
- describe '#get_field' do
33
- it 'returns a specific field' do
34
- expect(education.get_field(90737, 'ABC_Product_Code')).to eq('CRS')
35
- end
36
- end
37
-
38
- describe '#get_fields' do
39
- it 'returns specific fields' do
40
- expect(education.get_fields(90737, 'ABC_Product_Code', 'ABC_Other_Code')).to eq(%w[CRS AP])
41
- end
42
- end
43
-
44
- # rubocop:disable RSpec/ExampleLength
45
- it 'interacts with records correctly', :aggregate_failures do
46
- new_record = education.create(details)
47
- expect(new_record).to be_a(Usps::Imis::Data)
48
-
49
- ordinal = new_record.ordinal
50
-
51
- update_result =
52
- education.update(details.merge(source: 'Online Exams System - Modified', ordinal:))
53
- expect(update_result['ABC_Educ_Source_System']).to eq('Online Exams System - Modified')
54
-
55
- put_fields_result = education.put_fields(ordinal, 'ABC_Educ_Source_System' => 'Online Exams System - Mod2')
56
- expect(put_fields_result['ABC_Educ_Source_System']).to eq('Online Exams System - Mod2')
57
-
58
- expect(education.destroy(ordinal)).to be(true)
59
- end
60
- # rubocop:enable RSpec/ExampleLength
61
- end
62
-
63
- describe 'initialization with ID' do
64
- it 'can initialize with an iMIS ID' do
65
- panel = described_class.new(imis_id: 6374)
66
-
67
- expect(panel.api.imis_id).to eq(6374)
68
- end
69
- end
70
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Usps::Imis::Panels::Vsc, :vcr do
6
- let(:vsc) { described_class.new }
7
-
8
- let(:details) do
9
- {
10
- certificate: 'E136924',
11
- year: 2024,
12
- count: 42
13
- }
14
- end
15
-
16
- before { vsc.api.imis_id = 6374 }
17
-
18
- describe '#get' do
19
- it 'loads a specific object' do
20
- expect(vsc.get(1433)).to be_a(Usps::Imis::Data)
21
- end
22
- end
23
-
24
- # rubocop:disable RSpec/ExampleLength
25
- it 'handles new records correctly', :aggregate_failures do
26
- new_record = vsc.create(details)
27
- expect(new_record).to be_a(Usps::Imis::Data)
28
-
29
- ordinal = new_record.ordinal
30
-
31
- update_result = vsc.update(details.merge(count: 43, ordinal:))
32
- expect(update_result['Quantity']).to eq(43)
33
-
34
- expect(vsc.destroy(ordinal)).to be(true)
35
- end
36
- # rubocop:enable RSpec/ExampleLength
37
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Usps::Imis::Properties do
6
- let(:builder) { described_class.new }
7
-
8
- it 'wraps boolean property values' do
9
- expect(builder.send(:wrap, true)).to eq(
10
- '$type' => 'System.Boolean', '$value' => true
11
- )
12
- end
13
-
14
- it 'raises an error for unexpected property types' do
15
- expect { builder.send(:wrap, {}) }.to raise_error(
16
- Usps::Imis::Errors::UnexpectedPropertyTypeError, 'Unexpected property type: {}'
17
- )
18
- end
19
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Usps::Imis do
6
- it 'returns configuration from configure without a block' do
7
- described_class.configuration.environment = 'development'
8
-
9
- expect(described_class.configure.environment).to eq('development')
10
- end
11
- end
data/spec/spec_helper.rb DELETED
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/setup'
4
- Bundler.setup
5
- require 'simplecov'
6
- SimpleCov.minimum_coverage(line: 100, branch: 100)
7
-
8
- require 'dotenv/load'
9
- require 'usps/imis'
10
- require 'active_support/string_inquirer'
11
-
12
- ENV['TESTING'] = 'true'
13
-
14
- require 'vcr'
15
- require 'webmock/rspec'
16
- WebMock.disable_net_connect!
17
- record_mode = ENV['VCR'] ? ENV['VCR'].to_sym : :once
18
- VCR.configure do |config|
19
- config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
20
- config.hook_into :webmock
21
- config.default_cassette_options = {
22
- record: record_mode,
23
- match_requests_on: %i[method uri]
24
- }
25
- config.configure_rspec_metadata!
26
-
27
- config.filter_sensitive_data('<USERNAME>') { ENV.fetch('IMIS_USERNAME') }
28
- config.filter_sensitive_data('<USERNAME>') { CGI.escape(ENV.fetch('IMIS_USERNAME')) }
29
-
30
- config.filter_sensitive_data('<PASSWORD>') { ENV.fetch('IMIS_PASSWORD') }
31
- config.filter_sensitive_data('<PASSWORD>') { CGI.escape(ENV.fetch('IMIS_PASSWORD')) }
32
-
33
- config.filter_sensitive_data('<ACCESS_TOKEN>') do |interaction|
34
- if interaction.response.headers['Content-Type']&.first&.include?('application/json')
35
- begin
36
- response_body = JSON.parse(interaction.response.body)
37
- response_body['access_token']
38
- rescue JSON::ParserError
39
- nil
40
- end
41
- end
42
- end
43
-
44
- config.filter_sensitive_data('<BEARER_TOKEN>') do |interaction|
45
- if interaction.request.headers['Authorization']
46
- auth_header = interaction.request.headers['Authorization'].first
47
- if (match = auth_header.match(/^Bearer\s+([^,\s]+)/))
48
- match.captures.first
49
- end
50
- end
51
- end
52
- end
53
-
54
- RSpec.configure do |config|
55
- # Enable flags like --only-failures and --next-failure
56
- config.example_status_persistence_file_path = 'tmp/.rspec_status'
57
-
58
- # Disable RSpec exposing methods globally on `Module` and `main`
59
- config.disable_monkey_patching!
60
-
61
- config.expose_dsl_globally = true
62
-
63
- config.expect_with :rspec do |c|
64
- c.syntax = :expect
65
- end
66
-
67
- config.before(:suite) do
68
- Usps::Imis.configure do |imis_config|
69
- imis_config.environment = :development
70
- imis_config.imis_id_query_name = ENV.fetch('IMIS_ID_QUERY_NAME', '')
71
-
72
- imis_config.username = ENV.fetch('IMIS_USERNAME', '')
73
- imis_config.password = ENV.fetch('IMIS_PASSWORD', '')
74
-
75
- imis_config.logger = Logger.new(nil)
76
- end
77
- end
78
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/usps/imis/version'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'usps-imis-api'
7
- s.version = Usps::Imis::VERSION
8
- s.summary = 'iMIS API Wrapper'
9
- s.description = 'A wrapper for the iMIS API.'
10
- s.homepage = 'https://github.com/unitedstatespowersquadrons/imis-api-ruby'
11
- s.authors = ['Julian Fiander']
12
- s.email = 'jsfiander@gmail.com'
13
- s.require_paths = %w[lib]
14
- s.files = `git ls-files`.split("\n")
15
- s.metadata['rubygems_mfa_required'] = 'true'
16
-
17
- s.required_ruby_version = '>= 3.4'
18
-
19
- s.add_dependency 'activesupport', '~> 8.0'
20
- end