usps-imis-api 0.3.3.pre.pre.1 → 0.3.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 +4 -4
- data/.rubocop.yml +2 -2
- data/Gemfile.lock +1 -1
- data/lib/usps/imis/error/api.rb +10 -0
- data/lib/usps/imis/mapper.rb +2 -1
- data/lib/usps/imis/version.rb +1 -1
- data/spec/lib/usps/imis/error/api_spec.rb +20 -0
- data/spec/lib/usps/imis/panel/education_spec.rb +1 -1
- data/spec/lib/usps/imis/panel/vsc_spec.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 829f39c81242bde99b954d06710ba008290415eb765340be960bad36bd471e0c
|
4
|
+
data.tar.gz: f15146f633cd77744521b14bcd6d196cf05518f6455528a2b2362a4726debfd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87c7576a9be599cabc7968a5df6484d421b80e933c5dfb3719974584f2ad563b12e2b3294deaa73bd716e5b8ca270e99a95072673440a4b139b6bd358446d826
|
7
|
+
data.tar.gz: b844cc08b4c36ec3702a0e97ce4dd6ec000c2926b1440113624f0071e67689b6ef70e44833051a29091e77ea6cdefedce026f6cf4138f4bc76043b2f00559e72
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/usps/imis/error/api.rb
CHANGED
@@ -15,12 +15,22 @@ module Usps
|
|
15
15
|
super(message)
|
16
16
|
@metadata = metadata
|
17
17
|
@response = response
|
18
|
+
|
19
|
+
warn inspect if ENV.fetch('IMIS_ERROR_LOG_TO_STDERR', 'false') == 'true'
|
18
20
|
end
|
19
21
|
|
20
22
|
def bugsnag_meta_data
|
21
23
|
{ api: { status: status, body: body }.merge!(metadata) }
|
22
24
|
end
|
23
25
|
|
26
|
+
def inspect
|
27
|
+
[
|
28
|
+
"#{self.class.name}: [#{status.to_s.upcase}] #{message}",
|
29
|
+
(metadata.inspect if metadata != {}),
|
30
|
+
body
|
31
|
+
].compact.join("\n")
|
32
|
+
end
|
33
|
+
|
24
34
|
private
|
25
35
|
|
26
36
|
def status
|
data/lib/usps/imis/mapper.rb
CHANGED
@@ -14,8 +14,9 @@ module Usps
|
|
14
14
|
|
15
15
|
attr_reader :api
|
16
16
|
|
17
|
-
def initialize(api = nil)
|
17
|
+
def initialize(api = nil, imis_id: nil)
|
18
18
|
@api = api || Api.new
|
19
|
+
api.imis_id = imis_id if imis_id
|
19
20
|
end
|
20
21
|
|
21
22
|
# Update a member's data on multiple affected business objects by arbitrary field names
|
data/lib/usps/imis/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
ApiResponseStub = Struct.new(:code, :body)
|
6
|
+
|
7
|
+
describe Usps::Imis::Error::Api do
|
8
|
+
let(:warning_text) do
|
9
|
+
<<~WARNING.chomp
|
10
|
+
Usps::Imis::Error::Api: [INTERNAL_SERVER_ERROR] The iMIS API returned an error.
|
11
|
+
Body of the API response error
|
12
|
+
WARNING
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'handles an API response correctly' do
|
16
|
+
response = ApiResponseStub.new('500', 'Body of the API response error')
|
17
|
+
|
18
|
+
expect(described_class.from(response).inspect).to eq(warning_text)
|
19
|
+
end
|
20
|
+
end
|
@@ -30,7 +30,7 @@ describe Usps::Imis::Panel::Education do
|
|
30
30
|
new_record = education.create(details)
|
31
31
|
expect(new_record).to be_a(Hash)
|
32
32
|
|
33
|
-
ordinal = new_record['
|
33
|
+
ordinal = new_record['Identity']['IdentityElements']['$values'][1]
|
34
34
|
|
35
35
|
update_result =
|
36
36
|
education.update(details.merge(source: 'Online Exams System - Modified', ordinal: ordinal))
|
@@ -26,7 +26,7 @@ describe Usps::Imis::Panel::Vsc do
|
|
26
26
|
new_record = vsc.create(details)
|
27
27
|
expect(new_record).to be_a(Hash)
|
28
28
|
|
29
|
-
ordinal = new_record['
|
29
|
+
ordinal = new_record['Identity']['IdentityElements']['$values'][1]
|
30
30
|
|
31
31
|
update_result = vsc.update(details.merge(count: 43, ordinal: ordinal))
|
32
32
|
updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' }
|
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.3.3
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/usps/imis/panel/vsc.rb
|
39
39
|
- lib/usps/imis/version.rb
|
40
40
|
- spec/lib/usps/imis/api_spec.rb
|
41
|
+
- spec/lib/usps/imis/error/api_spec.rb
|
41
42
|
- spec/lib/usps/imis/mapper_spec.rb
|
42
43
|
- spec/lib/usps/imis/panel/education_spec.rb
|
43
44
|
- spec/lib/usps/imis/panel/vsc_spec.rb
|