usps-imis-api 0.9.8 → 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.
- checksums.yaml +4 -4
- data/Readme.md +2 -0
- data/lib/usps/imis/api.rb +11 -12
- data/lib/usps/imis/business_object.rb +7 -11
- data/lib/usps/imis/config.rb +1 -1
- data/lib/usps/imis/data.rb +4 -0
- data/lib/usps/imis/error.rb +1 -1
- data/lib/usps/imis/query.rb +50 -21
- data/lib/usps/imis/requests.rb +11 -3
- data/lib/usps/imis/version.rb +1 -1
- metadata +1 -27
- data/.github/workflows/main.yml +0 -57
- data/.gitignore +0 -5
- data/.rspec +0 -2
- data/.rubocop.yml +0 -89
- data/.ruby-version +0 -1
- data/.simplecov +0 -8
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -129
- data/Rakefile +0 -12
- data/bin/console +0 -21
- data/bin/setup +0 -8
- data/spec/lib/usps/imis/api_spec.rb +0 -171
- data/spec/lib/usps/imis/business_object_spec.rb +0 -87
- data/spec/lib/usps/imis/config_spec.rb +0 -59
- data/spec/lib/usps/imis/data_spec.rb +0 -66
- data/spec/lib/usps/imis/error_spec.rb +0 -17
- data/spec/lib/usps/imis/errors/response_error_spec.rb +0 -107
- data/spec/lib/usps/imis/mapper_spec.rb +0 -55
- data/spec/lib/usps/imis/mocks/business_object_spec.rb +0 -65
- data/spec/lib/usps/imis/panels/base_panel_spec.rb +0 -33
- data/spec/lib/usps/imis/panels/education_spec.rb +0 -70
- data/spec/lib/usps/imis/panels/vsc_spec.rb +0 -37
- data/spec/lib/usps/imis/properties_spec.rb +0 -19
- data/spec/lib/usps/imis_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -38
- data/usps-imis-api.gemspec +0 -20
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
module Usps
|
|
6
|
-
module Imis
|
|
7
|
-
module Panels
|
|
8
|
-
class InvalidPanel < BasePanel; end
|
|
9
|
-
|
|
10
|
-
class InvalidPanelWithBusinessObject < BasePanel
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def business_object = 'Something'
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe Usps::Imis::Panels::BasePanel do
|
|
20
|
-
it 'requires #business_object to be defined' do
|
|
21
|
-
expect { Usps::Imis::Panels::InvalidPanel.new.get(1) }.to raise_error(
|
|
22
|
-
Usps::Imis::Errors::PanelUnimplementedError,
|
|
23
|
-
'Usps::Imis::Panels::InvalidPanel must implement #business_object'
|
|
24
|
-
)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'requires #payload(data) to be defined' do
|
|
28
|
-
expect { Usps::Imis::Panels::InvalidPanelWithBusinessObject.new.create({}) }.to raise_error(
|
|
29
|
-
Usps::Imis::Errors::PanelUnimplementedError,
|
|
30
|
-
'Usps::Imis::Panels::InvalidPanelWithBusinessObject must implement #payload(data)'
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe Usps::Imis::Panels::Education 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 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
|
data/spec/lib/usps/imis_spec.rb
DELETED
|
@@ -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,38 +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
|
-
RSpec.configure do |config|
|
|
15
|
-
# Enable flags like --only-failures and --next-failure
|
|
16
|
-
config.example_status_persistence_file_path = 'tmp/.rspec_status'
|
|
17
|
-
|
|
18
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
19
|
-
config.disable_monkey_patching!
|
|
20
|
-
|
|
21
|
-
config.expose_dsl_globally = true
|
|
22
|
-
|
|
23
|
-
config.expect_with :rspec do |c|
|
|
24
|
-
c.syntax = :expect
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
config.before(:suite) do
|
|
28
|
-
Usps::Imis.configure do |imis_config|
|
|
29
|
-
imis_config.environment = :development
|
|
30
|
-
imis_config.imis_id_query_name = ENV.fetch('IMIS_ID_QUERY_NAME', '')
|
|
31
|
-
|
|
32
|
-
imis_config.username = ENV.fetch('IMIS_USERNAME', '')
|
|
33
|
-
imis_config.password = ENV.fetch('IMIS_PASSWORD', '')
|
|
34
|
-
|
|
35
|
-
imis_config.logger = Logger.new(nil)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
data/usps-imis-api.gemspec
DELETED
|
@@ -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
|