usps-imis-api 0.8.0 → 0.8.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/Gemfile.lock +1 -1
- data/Readme.md +4 -4
- data/lib/usps/imis/api.rb +2 -2
- data/lib/usps/imis/business_object.rb +1 -1
- data/lib/usps/imis/data.rb +2 -2
- data/lib/usps/imis/panels/base_panel.rb +2 -2
- data/lib/usps/imis/panels/education.rb +1 -1
- data/lib/usps/imis/panels/vsc.rb +1 -1
- data/lib/usps/imis/version.rb +1 -1
- data/spec/lib/usps/imis/api_spec.rb +3 -3
- data/spec/lib/usps/imis/data_spec.rb +2 -2
- data/spec/lib/usps/imis/mapper_spec.rb +1 -1
- data/spec/lib/usps/imis/panels/education_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea2c1c51fb9d73e9aa4dc60f4be57c72443f9d2f4e16fcd8e572af8e1b7c58e6
|
|
4
|
+
data.tar.gz: ffd74ed752fe1cfc9f0c0eaeb166e1d13bf75cf40d0b07bafaa9ce1de5b09c49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3fad87c5d7fa1c3bfa8c0140304b39e7df21d5e9abdc5234a183a1175409c5f42fe8e65f8e53975b127f15004a65aa988d533ce68ed56d3867d470f28353b2b
|
|
7
|
+
data.tar.gz: 872e0e9a73136a6166a5c585c8286d106e3d81758e2eccdbc8f8a1b1fc2d845883680e54323ffbd5902f599cbcc685be611ff1edf62c917d5e42b5ec92ba79ef
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
|
@@ -120,7 +120,7 @@ To fetch a specific field from member data, run e.g.:
|
|
|
120
120
|
tot_mms = api.on('ABC_ASC_Individual_Demog').get_field('TotMMS')
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
You can also access fields directly on the Business Object like a Hash:
|
|
123
|
+
You can also access fields directly on the Business Object or Panel like a Hash:
|
|
124
124
|
|
|
125
125
|
```ruby
|
|
126
126
|
tot_mms = api.on('ABC_ASC_Individual_Demog')['TotMMS']
|
|
@@ -229,9 +229,9 @@ vsc.get(1417)
|
|
|
229
229
|
|
|
230
230
|
# All of these options are identical
|
|
231
231
|
#
|
|
232
|
-
vsc.get(1417, 'Quantity')
|
|
232
|
+
vsc.get(1417, 'Quantity').first
|
|
233
233
|
vsc.get(1417)['Quantity']
|
|
234
|
-
vsc
|
|
234
|
+
vsc[1417, 'Quantity']
|
|
235
235
|
vsc.get(1417).raw['Properties']['$values'].find { it['Name'] == 'Quantity' }['Value']['$value']
|
|
236
236
|
vsc.get_field(1417, 'Quantity')
|
|
237
237
|
|
|
@@ -244,7 +244,7 @@ created = vsc.create(certificate: 'E136924', year: 2024, count: 42)
|
|
|
244
244
|
ordinal = created.ordinal
|
|
245
245
|
ordinal = created['Ordinal']
|
|
246
246
|
ordinal = created.raw['Properties']['$values'].find { it['Name'] == 'Ordinal' }['Value']['$value']
|
|
247
|
-
ordinal = created.raw['Identity']['IdentityElements']['$values'][1] # Value is duplicated here
|
|
247
|
+
ordinal = created.raw['Identity']['IdentityElements']['$values'][1].to_i # Value is duplicated here
|
|
248
248
|
|
|
249
249
|
vsc.update(certificate: 'E136924', year: 2024, count: 43, ordinal: ordinal)
|
|
250
250
|
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -54,7 +54,7 @@ module Usps
|
|
|
54
54
|
def imis_id=(id)
|
|
55
55
|
raise Errors::LockedIdError if lock_imis_id
|
|
56
56
|
|
|
57
|
-
@imis_id = id&.to_i
|
|
57
|
+
@imis_id = id&.to_i
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
# Convert a member's certificate number into an iMIS ID number
|
|
@@ -68,7 +68,7 @@ module Usps
|
|
|
68
68
|
|
|
69
69
|
begin
|
|
70
70
|
result = query(Imis.configuration.imis_id_query_name, { certificate: })
|
|
71
|
-
@imis_id = result['Items']['$values'][0]['ID']
|
|
71
|
+
@imis_id = result['Items']['$values'][0]['ID'].to_i
|
|
72
72
|
rescue StandardError
|
|
73
73
|
raise Errors::NotFoundError, 'Member not found'
|
|
74
74
|
end
|
|
@@ -120,7 +120,7 @@ module Usps
|
|
|
120
120
|
return CGI.escape(id) unless id.nil?
|
|
121
121
|
return CGI.escape("~#{api.imis_id}|#{ordinal}") if ordinal
|
|
122
122
|
|
|
123
|
-
api.imis_id
|
|
123
|
+
api.imis_id.to_s
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
# Manually assemble the matching data structure, with fields in the correct order
|
data/lib/usps/imis/data.rb
CHANGED
|
@@ -18,12 +18,12 @@ module Usps
|
|
|
18
18
|
|
|
19
19
|
# Access the iMIS ID property
|
|
20
20
|
#
|
|
21
|
-
def imis_id = self['ID']
|
|
21
|
+
def imis_id = self['ID'].to_i
|
|
22
22
|
alias id imis_id
|
|
23
23
|
|
|
24
24
|
# Access the Ordinal identifier property (if present)
|
|
25
25
|
#
|
|
26
|
-
def ordinal = self['Ordinal']
|
|
26
|
+
def ordinal = self['Ordinal']&.to_i
|
|
27
27
|
|
|
28
28
|
# Access an individual property value by name
|
|
29
29
|
#
|
|
@@ -113,7 +113,7 @@ module Usps
|
|
|
113
113
|
'EntityTypeName' => business_object,
|
|
114
114
|
'IdentityElements' => {
|
|
115
115
|
'$type' => identity_type,
|
|
116
|
-
'$values' => [api.imis_id, ordinal&.to_s].compact
|
|
116
|
+
'$values' => [api.imis_id.to_s, ordinal&.to_s].compact
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
end
|
|
@@ -124,7 +124,7 @@ module Usps
|
|
|
124
124
|
'EntityTypeName' => 'Party',
|
|
125
125
|
'IdentityElements' => {
|
|
126
126
|
'$type' => identity_type,
|
|
127
|
-
'$values' => [api.imis_id]
|
|
127
|
+
'$values' => [api.imis_id.to_s]
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
end
|
|
@@ -14,7 +14,7 @@ module Usps
|
|
|
14
14
|
|
|
15
15
|
def payload(data)
|
|
16
16
|
build_payload(data) do |props|
|
|
17
|
-
props.add 'ID', api.imis_id
|
|
17
|
+
props.add 'ID', api.imis_id.to_s
|
|
18
18
|
props.add 'Ordinal', data[:ordinal] if data[:ordinal]
|
|
19
19
|
props.add 'ABC_EDUC_THRU_DATE', data[:thru_date] || '0001-01-01T00:00:00'
|
|
20
20
|
props.add 'ABC_ECertificate', data[:certificate]
|
data/lib/usps/imis/panels/vsc.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Usps
|
|
|
14
14
|
|
|
15
15
|
def payload(data)
|
|
16
16
|
build_payload(data) do |props|
|
|
17
|
-
props.add 'ID', api.imis_id
|
|
17
|
+
props.add 'ID', api.imis_id.to_s
|
|
18
18
|
props.add 'Ordinal', data[:ordinal] if data[:ordinal]
|
|
19
19
|
props.add 'Source_System', 'Manual ITCom Entry'
|
|
20
20
|
props.add 'ABC_ECertificate', data[:certificate]
|
data/lib/usps/imis/version.rb
CHANGED
|
@@ -17,13 +17,13 @@ describe Usps::Imis::Api do
|
|
|
17
17
|
it 'stores the initial imis_id' do
|
|
18
18
|
api = described_class.new(imis_id: 42)
|
|
19
19
|
|
|
20
|
-
expect(api.imis_id).to eq(
|
|
20
|
+
expect(api.imis_id).to eq(42)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe '#imis_id_for' do
|
|
25
25
|
it 'gets the iMIS ID' do
|
|
26
|
-
expect(api.imis_id_for('E231625')).to eq(
|
|
26
|
+
expect(api.imis_id_for('E231625')).to eq(31092)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
context 'with a query error' do
|
|
@@ -133,7 +133,7 @@ describe Usps::Imis::Api do
|
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
expect(result).to be_a(Hash)
|
|
136
|
-
expect(api.imis_id).to eq(
|
|
136
|
+
expect(api.imis_id).to eq(31092)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it 'nests on and with', :aggregate_failures do
|
|
@@ -24,7 +24,7 @@ describe Usps::Imis::Data do
|
|
|
24
24
|
|
|
25
25
|
describe '#inspect' do
|
|
26
26
|
it 'generates the correct inspect string' do
|
|
27
|
-
expect(data.inspect).to eq('#<Usps::Imis::Data entity_type_name="ABC_ASC_Individual_Demog" imis_id=
|
|
27
|
+
expect(data.inspect).to eq('#<Usps::Imis::Data entity_type_name="ABC_ASC_Individual_Demog" imis_id=31092>')
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
context 'with data from a Panel' do
|
|
@@ -44,7 +44,7 @@ describe Usps::Imis::Data do
|
|
|
44
44
|
|
|
45
45
|
it 'generates the correct inspect string with an ordinal' do
|
|
46
46
|
expect(data.inspect).to eq(
|
|
47
|
-
'#<Usps::Imis::Data entity_type_name="ABC_ASC_Individual_Demog" imis_id=
|
|
47
|
+
'#<Usps::Imis::Data entity_type_name="ABC_ASC_Individual_Demog" imis_id=31092 ordinal=99>'
|
|
48
48
|
)
|
|
49
49
|
end
|
|
50
50
|
end
|