usps-imis-api 0.6.14 → 0.6.15

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: 05b1b663fab7b4f81c95f105c0c7f667bc2f5b9855b5fd48e5f384ce0adba8dc
4
- data.tar.gz: '02529c44a577d5e239b3bd306cec0f9f91e53413ef3d921c5564352e8dca3d5f'
3
+ metadata.gz: 1ece5a19e925e1ef85b9e54b1d8fe7139c4015b0a1fe7ddcb602e172fbb50cab
4
+ data.tar.gz: 723eb4ccbf3b0c86c3f309c83d32d2b892420c688fd1f8aa2bfedcc47d61d2a9
5
5
  SHA512:
6
- metadata.gz: e81f01c677aa5a22b1c7c5cfeb6e3119cc1f4387dc2076fec0001032879378f5be3cd562c3ccdd689a5e26e7becb4381a891249c175b025014d78638a36dd03e
7
- data.tar.gz: 3e3f53303d8316f814cefffb3473ccb8e91c5fbd5146bc94b1701532c006fbf8b0ab905a156bd880e3fe6a2f1c2c4f79528c591df8b6ad6e26cb8cee7ab88346
6
+ metadata.gz: fbca9aeda6a7a4e7fc6701c2767da349ab49e6b9126b36ea0a6225b4c18b2c7970dc22390ddabfbf571411d76b86ab2b37bbde79f471f4b5a3ceba9d271fdd5c
7
+ data.tar.gz: 3b09c75a050ad32e8077d9bc07772d91bb37a7e4628734c0159cb05a206f7f9128059532e22e90f014f07041f2ac87d0d37c2d7878845069c1220ec221cb4e69
data/.rubocop.yml CHANGED
@@ -37,6 +37,8 @@ Lint/UnusedMethodArgument:
37
37
  Enabled: true
38
38
  Lint/UselessAssignment:
39
39
  Enabled: true
40
+ Lint/ItWithoutArgumentsInBlock:
41
+ Enabled: false
40
42
 
41
43
  Metrics/MethodLength:
42
44
  Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-imis-api (0.6.14)
4
+ usps-imis-api (0.6.15)
5
5
  activesupport (~> 8.0)
6
6
 
7
7
  GEM
data/Readme.md CHANGED
@@ -237,7 +237,7 @@ api.with(31092) do
237
237
  # These requests are identical:
238
238
 
239
239
  on('ABC_ASC_Individual_Demog') do
240
- get['Properties']['$values'].find { |hash| hash['Name'] == 'TotMMS' }['Value']['$value']
240
+ get['Properties']['$values'].find { it['Name'] == 'TotMMS' }['Value']['$value']
241
241
  end
242
242
 
243
243
  on('ABC_ASC_Individual_Demog') { get_field('TotMMS') }
@@ -49,7 +49,7 @@ module Usps
49
49
  #
50
50
  def get_field(name)
51
51
  values = get['Properties']['$values']
52
- value = values.find { |hash| hash['Name'] == name }['Value']
52
+ value = values.find { it['Name'] == name }['Value']
53
53
 
54
54
  value.is_a?(String) ? value : value['$value']
55
55
  end
@@ -69,6 +69,8 @@ module Usps
69
69
 
70
70
  # Update a business object for the current member
71
71
  #
72
+ # Any properties not included will be left unmodified
73
+ #
72
74
  # @param body [Hash] Full raw API object data
73
75
  #
74
76
  # @return [Hash] Response data from the API
@@ -133,22 +135,21 @@ module Usps
133
135
  existing = get
134
136
 
135
137
  JSON.parse(JSON.dump(existing)).tap do |updated|
136
- # Wipe the array on the duped object
137
- #
138
- # The first property is always the iMIS ID again
139
- #
140
- updated['Properties']['$values'] = []
138
+ # Preserve the iMIS ID, as well as the Ordinal (if present)
139
+ updated['Properties']['$values'], properties =
140
+ existing['Properties']['$values'].partition { %w[ID Ordinal].include?(it['Name']) }
141
141
 
142
142
  # Iterate through all existing fields
143
- existing['Properties']['$values'].each do |value|
144
- if fields.keys.include?(value['Name'])
145
- # Strings are not wrapped in the type definition structure
146
- new_value = fields[value['Name']]
147
- if new_value.is_a?(String)
148
- value['Value'] = new_value
149
- else
150
- value['Value']['$value'] = new_value
151
- end
143
+ properties.each do |value|
144
+ # Skip unmodified fields
145
+ next unless fields.keys.include?(value['Name'])
146
+
147
+ # Strings are not wrapped in the type definition structure
148
+ new_value = fields[value['Name']]
149
+ if new_value.is_a?(String)
150
+ value['Value'] = new_value
151
+ else
152
+ value['Value']['$value'] = new_value
152
153
  end
153
154
 
154
155
  # Add the completed field with the updated value
@@ -43,7 +43,7 @@ module Usps
43
43
  # @return [Hash]
44
44
  #
45
45
  def bugsnag_meta_data
46
- base_metadata.tap { |m| m[:api].merge!(metadata) }
46
+ base_metadata.tap { it[:api].merge!(metadata) }
47
47
  end
48
48
 
49
49
  # Auto-formatted exception message, based on the provided API response
@@ -20,7 +20,7 @@ module Usps
20
20
  #
21
21
  def authorize(request)
22
22
  authenticate if token_expiration < Time.now
23
- request.tap { |r| r.add_field('Authorization', "Bearer #{token}") }
23
+ request.tap { it.add_field('Authorization', "Bearer #{token}") }
24
24
  end
25
25
 
26
26
  def submit(uri, request)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.6.14'
5
+ VERSION = '0.6.15'
6
6
  end
7
7
  end
@@ -10,7 +10,7 @@ describe Usps::Imis::BusinessObject do
10
10
  {
11
11
  'Properties' => {
12
12
  '$values' => [
13
- { 'Name' => 'Stub iMIS ID', 'Value' => { '$value' => '31092' } },
13
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
14
14
  { 'Name' => 'Stub Integer', 'Value' => { '$value' => 43 } },
15
15
  { 'Name' => 'Stub String', 'Value' => 'other' }
16
16
  ]
@@ -22,7 +22,7 @@ describe Usps::Imis::BusinessObject do
22
22
  allow(business_object).to receive(:get).and_return({
23
23
  'Properties' => {
24
24
  '$values' => [
25
- { 'Name' => 'Stub iMIS ID', 'Value' => { '$value' => '31092' } },
25
+ { 'Name' => 'ID', 'Value' => { '$value' => '31092' } },
26
26
  { 'Name' => 'Stub Integer', 'Value' => { '$value' => 42 } },
27
27
  { 'Name' => 'Stub String', 'Value' => 'something' }
28
28
  ]
@@ -24,7 +24,7 @@ describe Usps::Imis::Config do
24
24
  subject { config.environment }
25
25
 
26
26
  let(:config) do
27
- described_class.new { |c| c.environment = 'test' }
27
+ described_class.new { it.environment = 'test' }
28
28
  end
29
29
 
30
30
  it { is_expected.to be_test }
@@ -14,7 +14,6 @@ describe Usps::Imis::Panel::Education do
14
14
  source: 'Online Exams System',
15
15
  code: 'MN',
16
16
  type_code: 'CRS'
17
-
18
17
  }
19
18
  end
20
19
 
@@ -29,7 +29,7 @@ describe Usps::Imis::Panel::Vsc do
29
29
  ordinal = new_record['Identity']['IdentityElements']['$values'][1]
30
30
 
31
31
  update_result = vsc.update(details.merge(count: 43, ordinal:))
32
- updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' }
32
+ updated = update_result['Properties']['$values'].find { it['Name'] == 'Quantity' }
33
33
  expect(updated['Value']['$value']).to eq(43)
34
34
 
35
35
  expect(vsc.destroy(ordinal)).to eq('')
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.6.14
4
+ version: 0.6.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander