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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d71f733048ca34857ca8914e8591e44f5671d678e5644a67f877dac272712a0c
4
- data.tar.gz: b960d8a2202168321cd1e9605bb5299c3fc21356ca299faf34b5799e44a8a53b
3
+ metadata.gz: 829f39c81242bde99b954d06710ba008290415eb765340be960bad36bd471e0c
4
+ data.tar.gz: f15146f633cd77744521b14bcd6d196cf05518f6455528a2b2362a4726debfd8
5
5
  SHA512:
6
- metadata.gz: 128b52d227155ebc4e4807354e0668c0929221c05738efade63afb428dd88b331c7c8611d159fdbbeba6b379ea36724e6defc1c8fa8e1fe510fde4401a5a5545
7
- data.tar.gz: 546813a0c7a339e2a958f539feafa46c280e825cc2d8dc2d066998e8980627ead2757bf4a3e5d448be9d003c0972c96c0065d986ac665038742652de85396fa8
6
+ metadata.gz: 87c7576a9be599cabc7968a5df6484d421b80e933c5dfb3719974584f2ad563b12e2b3294deaa73bd716e5b8ca270e99a95072673440a4b139b6bd358446d826
7
+ data.tar.gz: b844cc08b4c36ec3702a0e97ce4dd6ec000c2926b1440113624f0071e67689b6ef70e44833051a29091e77ea6cdefedce026f6cf4138f4bc76043b2f00559e72
data/.rubocop.yml CHANGED
@@ -45,9 +45,9 @@ Metrics/MethodLength:
45
45
  Max: 15
46
46
  Metrics/ClassLength:
47
47
  Enabled: true
48
- Max: 125
48
+ Max: 150
49
49
  Metrics/ModuleLength:
50
- Max: 125
50
+ Max: 150
51
51
  Metrics/ParameterLists:
52
52
  Enabled: true
53
53
  Metrics/CyclomaticComplexity:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-imis-api (0.3.3.pre.pre.1)
4
+ usps-imis-api (0.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.3.3-pre.1'
5
+ VERSION = '0.3.3'
6
6
  end
7
7
  end
@@ -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['Properties']['$values'][1]['Value']['$value']
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['Properties']['$values'][1]['Value']['$value']
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.pre.pre.1
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