usps-imis-api 1.0.0.pre.rc.4 → 1.0.0.pre.rc.7

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -3
  3. data/Gemfile.lock +61 -27
  4. data/Readme.md +168 -32
  5. data/lib/usps/imis/api.rb +27 -39
  6. data/lib/usps/imis/business_object.rb +93 -40
  7. data/lib/usps/imis/config.rb +27 -10
  8. data/lib/usps/imis/data.rb +72 -0
  9. data/lib/usps/imis/error.rb +51 -0
  10. data/lib/usps/imis/errors/api_error.rb +11 -0
  11. data/lib/usps/imis/errors/config_error.rb +11 -0
  12. data/lib/usps/imis/errors/locked_id_error.rb +15 -0
  13. data/lib/usps/imis/errors/mapper_error.rb +29 -0
  14. data/lib/usps/imis/errors/not_found_error.rb +11 -0
  15. data/lib/usps/imis/errors/panel_unimplemented_error.rb +34 -0
  16. data/lib/usps/imis/{error → errors}/response_error.rb +5 -8
  17. data/lib/usps/imis/errors/unexpected_property_type_error.rb +31 -0
  18. data/lib/usps/imis/mapper.rb +28 -20
  19. data/lib/usps/imis/mocks/business_object.rb +47 -0
  20. data/lib/usps/imis/mocks.rb +11 -0
  21. data/lib/usps/imis/panels/base_panel.rb +144 -0
  22. data/lib/usps/imis/panels/education.rb +33 -0
  23. data/lib/usps/imis/panels/vsc.rb +32 -0
  24. data/lib/usps/imis/panels.rb +25 -0
  25. data/lib/usps/imis/properties.rb +50 -0
  26. data/lib/usps/imis/query.rb +94 -0
  27. data/lib/usps/imis/requests.rb +29 -3
  28. data/lib/usps/imis/version.rb +1 -1
  29. data/lib/usps/imis.rb +16 -13
  30. data/spec/lib/usps/imis/api_spec.rb +26 -13
  31. data/spec/lib/usps/imis/business_object_spec.rb +47 -13
  32. data/spec/lib/usps/imis/config_spec.rb +30 -4
  33. data/spec/lib/usps/imis/data_spec.rb +66 -0
  34. data/spec/lib/usps/imis/{error/api_error_spec.rb → error_spec.rb} +1 -1
  35. data/spec/lib/usps/imis/{error → errors}/response_error_spec.rb +4 -4
  36. data/spec/lib/usps/imis/mapper_spec.rb +27 -3
  37. data/spec/lib/usps/imis/mocks/business_object_spec.rb +65 -0
  38. data/spec/lib/usps/imis/panels/base_panel_spec.rb +33 -0
  39. data/spec/lib/usps/imis/panels/education_spec.rb +70 -0
  40. data/spec/lib/usps/imis/{panel → panels}/vsc_spec.rb +6 -7
  41. data/spec/lib/usps/imis/properties_spec.rb +19 -0
  42. data/spec/spec_helper.rb +3 -0
  43. data/usps-imis-api.gemspec +3 -1
  44. metadata +43 -15
  45. data/lib/ext/hash.rb +0 -10
  46. data/lib/usps/imis/error/api_error.rb +0 -44
  47. data/lib/usps/imis/error/mapper_error.rb +0 -11
  48. data/lib/usps/imis/panel/base_panel.rb +0 -65
  49. data/lib/usps/imis/panel/education.rb +0 -113
  50. data/lib/usps/imis/panel/vsc.rb +0 -111
  51. data/spec/lib/usps/imis/panel/base_panel_spec.rb +0 -32
  52. data/spec/lib/usps/imis/panel/education_spec.rb +0 -55
@@ -6,29 +6,63 @@ describe Usps::Imis::BusinessObject do
6
6
  let(:business_object) { described_class.new(api, 'Stub') }
7
7
  let(:api) { Usps::Imis::Api.new }
8
8
 
9
- describe '#filter_fields' do
10
- let(:expected) do
11
- {
9
+ before do
10
+ allow(business_object).to receive(:raw_object).and_return(
11
+ Usps::Imis::Data[
12
12
  'Properties' => {
13
13
  '$values' => [
14
- { 'Name' => 'Stub iMIS ID', 'Value' => { '$value' => '31092' } },
15
- { 'Name' => 'Stub Integer', 'Value' => { '$value' => 43 } },
16
- { 'Name' => 'Stub String', 'Value' => 'other' }
14
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
15
+ { 'Name' => 'Stub Integer', 'Value' => { '$value' => 42 } },
16
+ { 'Name' => 'Stub String', 'Value' => 'something' }
17
17
  ]
18
18
  }
19
- }
19
+ ]
20
+ )
21
+ end
22
+
23
+ describe '#get' do
24
+ it 'returns multiple values' do
25
+ expect(business_object.get('Stub String', 'Stub Integer')).to eq(['something', 42])
26
+ end
27
+
28
+ describe 'delegation to get_fields' do
29
+ before { allow(business_object).to receive(:get_fields).with('Stub String', 'Stub Integer') }
30
+
31
+ it 'delegates to get_fields' do
32
+ business_object.get('Stub String', 'Stub Integer')
33
+
34
+ expect(business_object).to have_received(:get_fields).with('Stub String', 'Stub Integer')
35
+ end
20
36
  end
37
+ end
21
38
 
22
- before do
23
- allow(business_object).to receive(:get).and_return({
39
+ describe '#get_field' do
40
+ it 'returns a string value' do
41
+ expect(business_object.get_field('Stub String')).to eq('something')
42
+ end
43
+
44
+ it 'returns an integer value' do
45
+ expect(business_object.get_field('Stub Integer')).to eq(42)
46
+ end
47
+ end
48
+
49
+ describe '#get_fields' do
50
+ it 'returns multiple values' do
51
+ expect(business_object.get_fields('Stub String', 'Stub Integer')).to eq(['something', 42])
52
+ end
53
+ end
54
+
55
+ describe '#filter_fields' do
56
+ let(:expected) do
57
+ {
24
58
  'Properties' => {
25
59
  '$values' => [
26
- { 'Name' => 'Stub iMIS ID', 'Value' => { '$value' => '31092' } },
27
- { 'Name' => 'Stub Integer', 'Value' => { '$value' => 42 } },
28
- { 'Name' => 'Stub String', 'Value' => 'something' }
60
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
61
+ { 'Name' => 'Stub Integer', 'Value' => { '$value' => 43 } },
62
+ { 'Name' => 'Stub String', 'Value' => 'other' }
29
63
  ]
30
64
  }
31
- })
65
+ }
32
66
  end
33
67
 
34
68
  it 'formats fields correctly' do
@@ -5,10 +5,36 @@ require 'spec_helper'
5
5
  describe Usps::Imis::Config do
6
6
  let(:config) { described_class.new }
7
7
 
8
- it 'sets values on initialize' do
9
- config = described_class.new { |c| c.environment = 'test' }
8
+ describe 'environment' do
9
+ subject { config.environment }
10
10
 
11
- expect(config.environment).to eq('test')
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 { it.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
@@ -25,7 +51,7 @@ describe Usps::Imis::Config do
25
51
 
26
52
  it 'raises an error' do
27
53
  expect { config.hostname }.to raise_error(
28
- Usps::Imis::Error::ApiError, 'Unexpected API environment: nothing'
54
+ Usps::Imis::Errors::ConfigError, 'Unexpected API environment: nothing'
29
55
  )
30
56
  end
31
57
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Usps::Imis::Data do
6
+ let(:data) do
7
+ described_class[
8
+ 'EntityTypeName' => 'ABC_ASC_Individual_Demog',
9
+ 'Properties' => {
10
+ '$values' => [
11
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
12
+ { 'Name' => 'Stub Integer', 'Value' => { '$value' => 42 } },
13
+ { 'Name' => 'Stub String', 'Value' => 'something' }
14
+ ]
15
+ }
16
+ ]
17
+ end
18
+
19
+ describe 'missing property' do
20
+ it 'returns nil for missing properties' do
21
+ expect(data['Not Found']).to be_nil
22
+ end
23
+ end
24
+
25
+ describe '#properties' do
26
+ it 'iterates over the properties, excluding IDs' do
27
+ expect(data.properties.map { |field, value| "#{field}: #{value}" }).to eq(
28
+ ['Stub Integer: 42', 'Stub String: something']
29
+ )
30
+ end
31
+
32
+ it 'iterates over the properties, including IDs' do
33
+ expect(data.properties(include_ids: true).map { |field, value| "#{field}: #{value}" }).to eq(
34
+ ['ID: 31092', 'Stub Integer: 42', 'Stub String: something']
35
+ )
36
+ end
37
+ end
38
+
39
+ describe '#inspect' do
40
+ it 'generates the correct inspect string' do
41
+ expect(data.inspect).to eq('#<Usps::Imis::Data entity="ABC_ASC_Individual_Demog" imis_id=31092>')
42
+ end
43
+
44
+ context 'with data from a Panel' do
45
+ let(:data) do
46
+ described_class[
47
+ 'EntityTypeName' => 'ABC_ASC_Individual_Demog',
48
+ 'Properties' => {
49
+ '$values' => [
50
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
51
+ { 'Name' => 'Ordinal', 'Value' => { '$value' => '99' } },
52
+ { 'Name' => 'Stub Integer', 'Value' => { '$value' => 42 } },
53
+ { 'Name' => 'Stub String', 'Value' => 'something' }
54
+ ]
55
+ }
56
+ ]
57
+ end
58
+
59
+ it 'generates the correct inspect string with an ordinal' do
60
+ expect(data.inspect).to eq(
61
+ '#<Usps::Imis::Data entity="ABC_ASC_Individual_Demog" imis_id=31092 ordinal=99>'
62
+ )
63
+ end
64
+ end
65
+ end
66
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Usps::Imis::Error::ApiError do
5
+ describe Usps::Imis::Error do
6
6
  it 'builds Bugsnag metadata' do
7
7
  error = described_class.new('Example', something: :else)
8
8
 
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  ApiResponseStub = Struct.new(:code, :body)
6
6
 
7
- describe Usps::Imis::Error::ResponseError do
7
+ describe Usps::Imis::Errors::ResponseError do
8
8
  let(:error) { described_class.from(response) }
9
9
 
10
10
  describe 'error codes' do
@@ -61,7 +61,7 @@ describe Usps::Imis::Error::ResponseError do
61
61
  let(:response) { ApiResponseStub.new('500', 'Body of the API response error') }
62
62
  let(:warning_text) do
63
63
  <<~WARNING.chomp
64
- Usps::Imis::Error::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
64
+ Usps::Imis::Errors::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
65
65
  Body of the API response error
66
66
  WARNING
67
67
  end
@@ -78,7 +78,7 @@ describe Usps::Imis::Error::ResponseError do
78
78
  let(:response) { ApiResponseStub.new('500', response_body) }
79
79
  let(:warning_text) do
80
80
  <<~WARNING.chomp
81
- Usps::Imis::Error::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
81
+ Usps::Imis::Errors::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
82
82
  description
83
83
  WARNING
84
84
  end
@@ -95,7 +95,7 @@ describe Usps::Imis::Error::ResponseError do
95
95
  let(:response) { ApiResponseStub.new('500', response_body) }
96
96
  let(:warning_text) do
97
97
  <<~WARNING.chomp
98
- Usps::Imis::Error::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
98
+ Usps::Imis::Errors::ResponseError: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
99
99
  #{response_body}
100
100
  WARNING
101
101
  end
@@ -9,7 +9,31 @@ describe Usps::Imis::Mapper do
9
9
  it 'stores the initial imis_id' do
10
10
  mapper = described_class.new(imis_id: 42)
11
11
 
12
- expect(mapper.api.imis_id).to eq('42')
12
+ expect(mapper.api.imis_id).to eq(42)
13
+ end
14
+ end
15
+
16
+ describe '#fetch' do
17
+ before { api.imis_id = 31092 }
18
+
19
+ it 'fetches a mapped field' do
20
+ expect(api.mapper.fetch(:mm)).to be_a(Integer)
21
+ end
22
+
23
+ it 'supports Hash access syntax' do
24
+ expect(api.mapper[:mm]).to be_a(Integer)
25
+ end
26
+
27
+ it 'supports Hash access syntax on the Api directly' do
28
+ expect(api[:mm]).to be_a(Integer)
29
+ end
30
+
31
+ it 'raises for unmapped updates' do
32
+ expect { api.mapper.fetch(:another) }.to raise_error(
33
+ Usps::Imis::Errors::MapperError,
34
+ %(Mapper does not recognize field: "another".\n) \
35
+ 'Please report what data you are attempting to work with to ITCom leadership.'
36
+ )
13
37
  end
14
38
  end
15
39
 
@@ -22,8 +46,8 @@ describe Usps::Imis::Mapper do
22
46
 
23
47
  it 'raises for unmapped updates' do
24
48
  expect { api.mapper.update(something: 'anything') }.to raise_error(
25
- Usps::Imis::Error::MapperError,
26
- 'Unrecognized field: "something". ' \
49
+ Usps::Imis::Errors::MapperError,
50
+ %(Mapper does not recognize field: "something".\n) \
27
51
  'Please report what data you are attempting to work with to ITCom leadership.'
28
52
  )
29
53
  end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Usps::Imis::Mocks::BusinessObject do
6
+ let(:mock) { described_class.new(**fields) }
7
+ let(:fields) { { TotMMS: 2, Something: 'Another' } }
8
+
9
+ let(:data) do
10
+ Usps::Imis::Properties.build do |props|
11
+ props.add 'TotMMS', 2
12
+ props.add 'Something', 'Another'
13
+ end
14
+ end
15
+
16
+ describe 'get' do
17
+ it 'returns the correct data' do
18
+ expect(mock.get).to eq(data)
19
+ end
20
+ end
21
+
22
+ describe 'get_field' do
23
+ it 'returns the correct field value' do
24
+ expect(mock.get_field('TotMMS')).to eq(2)
25
+ end
26
+ end
27
+
28
+ describe 'get_fields' do
29
+ it 'returns the correct field values' do
30
+ expect(mock.get_fields('TotMMS', 'Something')).to eq([2, 'Another'])
31
+ end
32
+ end
33
+
34
+ describe 'put_fields' do
35
+ let(:combined_data) do
36
+ Usps::Imis::Properties.build do |props|
37
+ props.add 'TotMMS', 2
38
+ props.add 'Something', 'Another'
39
+ props.add 'SomethingElse', 'interesting'
40
+ end
41
+ end
42
+
43
+ it 'returns the correct data' do
44
+ expect(mock.put_fields(SomethingElse: 'interesting')).to eq(combined_data)
45
+ end
46
+ end
47
+
48
+ describe 'put' do
49
+ it 'returns the correct data' do
50
+ expect(mock.put(data)).to eq(data)
51
+ end
52
+ end
53
+
54
+ describe 'post' do
55
+ it 'returns the correct data' do
56
+ expect(mock.post(data)).to eq(data)
57
+ end
58
+ end
59
+
60
+ describe 'delete' do
61
+ it 'returns the correct data' do
62
+ expect(mock.delete).to eq('')
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,70 @@
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Usps::Imis::Panel::Vsc do
5
+ describe Usps::Imis::Panels::Vsc do
6
6
  let(:vsc) { described_class.new }
7
7
 
8
8
  let(:details) do
@@ -17,22 +17,21 @@ describe Usps::Imis::Panel::Vsc do
17
17
 
18
18
  describe '#get' do
19
19
  it 'loads a specific object' do
20
- expect(vsc.get(1433)).to be_a(Hash)
20
+ expect(vsc.get(1433)).to be_a(Usps::Imis::Data)
21
21
  end
22
22
  end
23
23
 
24
24
  # rubocop:disable RSpec/ExampleLength
25
25
  it 'handles new records correctly', :aggregate_failures do
26
26
  new_record = vsc.create(details)
27
- expect(new_record).to be_a(Hash)
27
+ expect(new_record).to be_a(Usps::Imis::Data)
28
28
 
29
- ordinal = new_record['Identity']['IdentityElements']['$values'][1]
29
+ ordinal = new_record.ordinal
30
30
 
31
31
  update_result = vsc.update(details.merge(count: 43, ordinal:))
32
- updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' }
33
- expect(updated['Value']['$value']).to eq(43)
32
+ expect(update_result['Quantity']).to eq(43)
34
33
 
35
- expect(vsc.destroy(ordinal)).to eq('')
34
+ expect(vsc.destroy(ordinal)).to be(true)
36
35
  end
37
36
  # rubocop:enable RSpec/ExampleLength
38
37
  end
@@ -0,0 +1,19 @@
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/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ SimpleCov.minimum_coverage(line: 100, branch: 100)
7
7
 
8
8
  require 'dotenv/load'
9
9
  require 'usps/imis'
10
+ require 'active_support/string_inquirer'
10
11
 
11
12
  ENV['TESTING'] = 'true'
12
13
 
@@ -30,6 +31,8 @@ RSpec.configure do |config|
30
31
 
31
32
  imis_config.username = ENV.fetch('IMIS_USERNAME', '')
32
33
  imis_config.password = ENV.fetch('IMIS_PASSWORD', '')
34
+
35
+ imis_config.logger = Logger.new(nil)
33
36
  end
34
37
  end
35
38
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Usps::Imis::VERSION
8
8
  s.summary = 'iMIS API Wrapper'
9
9
  s.description = 'A wrapper for the iMIS API.'
10
- s.homepage = 'http://rubygems.org/gems/usps-imis-api'
10
+ s.homepage = 'https://github.com/unitedstatespowersquadrons/imis-api-ruby'
11
11
  s.authors = ['Julian Fiander']
12
12
  s.email = 'jsfiander@gmail.com'
13
13
  s.require_paths = %w[lib]
@@ -15,4 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.metadata['rubygems_mfa_required'] = 'true'
16
16
 
17
17
  s.required_ruby_version = '>= 3.4'
18
+
19
+ s.add_dependency 'activesupport', '~> 8.0'
18
20
  end
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: 1.0.0.pre.rc.4
4
+ version: 1.0.0.pre.rc.7
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: []
@@ -27,33 +41,47 @@ files:
27
41
  - Readme.md
28
42
  - bin/console
29
43
  - bin/setup
30
- - lib/ext/hash.rb
31
44
  - lib/usps/imis.rb
32
45
  - lib/usps/imis/api.rb
33
46
  - lib/usps/imis/business_object.rb
34
47
  - lib/usps/imis/config.rb
35
- - lib/usps/imis/error/api_error.rb
36
- - lib/usps/imis/error/mapper_error.rb
37
- - lib/usps/imis/error/response_error.rb
48
+ - lib/usps/imis/data.rb
49
+ - lib/usps/imis/error.rb
50
+ - lib/usps/imis/errors/api_error.rb
51
+ - lib/usps/imis/errors/config_error.rb
52
+ - lib/usps/imis/errors/locked_id_error.rb
53
+ - lib/usps/imis/errors/mapper_error.rb
54
+ - lib/usps/imis/errors/not_found_error.rb
55
+ - lib/usps/imis/errors/panel_unimplemented_error.rb
56
+ - lib/usps/imis/errors/response_error.rb
57
+ - lib/usps/imis/errors/unexpected_property_type_error.rb
38
58
  - lib/usps/imis/mapper.rb
39
- - lib/usps/imis/panel/base_panel.rb
40
- - lib/usps/imis/panel/education.rb
41
- - lib/usps/imis/panel/vsc.rb
59
+ - lib/usps/imis/mocks.rb
60
+ - lib/usps/imis/mocks/business_object.rb
61
+ - lib/usps/imis/panels.rb
62
+ - lib/usps/imis/panels/base_panel.rb
63
+ - lib/usps/imis/panels/education.rb
64
+ - lib/usps/imis/panels/vsc.rb
65
+ - lib/usps/imis/properties.rb
66
+ - lib/usps/imis/query.rb
42
67
  - lib/usps/imis/requests.rb
43
68
  - lib/usps/imis/version.rb
44
69
  - spec/lib/usps/imis/api_spec.rb
45
70
  - spec/lib/usps/imis/business_object_spec.rb
46
71
  - spec/lib/usps/imis/config_spec.rb
47
- - spec/lib/usps/imis/error/api_error_spec.rb
48
- - spec/lib/usps/imis/error/response_error_spec.rb
72
+ - spec/lib/usps/imis/data_spec.rb
73
+ - spec/lib/usps/imis/error_spec.rb
74
+ - spec/lib/usps/imis/errors/response_error_spec.rb
49
75
  - spec/lib/usps/imis/mapper_spec.rb
50
- - spec/lib/usps/imis/panel/base_panel_spec.rb
51
- - spec/lib/usps/imis/panel/education_spec.rb
52
- - spec/lib/usps/imis/panel/vsc_spec.rb
76
+ - spec/lib/usps/imis/mocks/business_object_spec.rb
77
+ - spec/lib/usps/imis/panels/base_panel_spec.rb
78
+ - spec/lib/usps/imis/panels/education_spec.rb
79
+ - spec/lib/usps/imis/panels/vsc_spec.rb
80
+ - spec/lib/usps/imis/properties_spec.rb
53
81
  - spec/lib/usps/imis_spec.rb
54
82
  - spec/spec_helper.rb
55
83
  - usps-imis-api.gemspec
56
- homepage: http://rubygems.org/gems/usps-imis-api
84
+ homepage: https://github.com/unitedstatespowersquadrons/imis-api-ruby
57
85
  licenses: []
58
86
  metadata:
59
87
  rubygems_mfa_required: 'true'
data/lib/ext/hash.rb DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Import a simplified version of to_query from Rails if not already defined
4
- class Hash
5
- def to_query
6
- map do |key, value|
7
- "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
8
- end.sort * '&'
9
- end
10
- end