usps-imis-api 0.10.1 → 0.10.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/Readme.md +1 -1
- data/lib/usps/imis/business_object.rb +1 -7
- data/lib/usps/imis/panels/base_panel.rb +2 -1
- data/lib/usps/imis/properties.rb +14 -14
- data/lib/usps/imis/version.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: 9a699891bdb0679741aafb3754e7939bfcd7f854b51e6cab76c25f6d9fc69995
|
|
4
|
+
data.tar.gz: 97ff09a0b7d9c1981b9170c96e3885e57f82465e08fa8a8be4c1b20cf7c8f822
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49f73bb0e65581cb15cb8004170ed22963e025693e8fb62f33a09b6c2afa5ca548a9a37354867679a9562205ff752a18b812bcca085b1b575c3c5bc48ec45564
|
|
7
|
+
data.tar.gz: 5f455a1a8a0231e08d6b83297ebcfcfea0c423dc6396ae4e1ec312d6da52e111b6a25babc978f232631242ac86da14499cfc2d6ac246c90779e41be6049b3fb7
|
data/Readme.md
CHANGED
|
@@ -287,7 +287,7 @@ ordinal = created.raw['Identity']['IdentityElements']['$values'][1].to_i # Value
|
|
|
287
287
|
vsc.update(certificate: 'E136924', year: 2024, count: 43, ordinal: ordinal)
|
|
288
288
|
|
|
289
289
|
vsc.put_fields(ordinal, 'Quantity' => 44)
|
|
290
|
-
vsc['Quantity'] = 44
|
|
290
|
+
vsc[ordinal, 'Quantity'] = 44
|
|
291
291
|
|
|
292
292
|
vsc.destroy(ordinal)
|
|
293
293
|
```
|
|
@@ -157,13 +157,7 @@ module Usps
|
|
|
157
157
|
# Skip unmodified fields
|
|
158
158
|
next unless fields.keys.include?(value['Name'])
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
new_value = fields[value['Name']]
|
|
162
|
-
if new_value.is_a?(String)
|
|
163
|
-
value['Value'] = new_value
|
|
164
|
-
else
|
|
165
|
-
value['Value']['$value'] = new_value
|
|
166
|
-
end
|
|
160
|
+
value['Value'] = Properties.wrap(fields[value['Name']])
|
|
167
161
|
|
|
168
162
|
# Add the completed field with the updated value
|
|
169
163
|
updated['Properties']['$values'] << value
|
|
@@ -51,12 +51,13 @@ module Usps
|
|
|
51
51
|
|
|
52
52
|
# Update a single named field on a business object for the current member
|
|
53
53
|
#
|
|
54
|
+
# @param ordinal [Integer] The ordinal identifier for the desired object
|
|
54
55
|
# @param field [String] Name of the field
|
|
55
56
|
# @param value Value of the field
|
|
56
57
|
#
|
|
57
58
|
# @return [Usps::Imis::Data] Response data from the API
|
|
58
59
|
#
|
|
59
|
-
def put_field(field, value) = api.on(business_object, ordinal:).put_field(field, value)
|
|
60
|
+
def put_field(ordinal, field, value) = api.on(business_object, ordinal:).put_field(field, value)
|
|
60
61
|
alias []= put_field
|
|
61
62
|
|
|
62
63
|
# Update only specific fields on a Panel for the current member
|
data/lib/usps/imis/properties.rb
CHANGED
|
@@ -9,6 +9,19 @@ module Usps
|
|
|
9
9
|
#
|
|
10
10
|
def self.build(&) = new.build(&)
|
|
11
11
|
|
|
12
|
+
# Wrap value in the API-internal type structure
|
|
13
|
+
#
|
|
14
|
+
def self.wrap(value)
|
|
15
|
+
case value
|
|
16
|
+
when String then value
|
|
17
|
+
when Time, DateTime then value.strftime('%Y-%m-%dT%H:%I:%S')
|
|
18
|
+
when Integer then { '$type' => 'System.Int32', '$value' => value }
|
|
19
|
+
when true, false then { '$type' => 'System.Boolean', '$value' => value }
|
|
20
|
+
else
|
|
21
|
+
raise Errors::UnexpectedPropertyTypeError.from(value)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
12
25
|
# Build the data for the Properties field
|
|
13
26
|
#
|
|
14
27
|
def build
|
|
@@ -29,22 +42,9 @@ module Usps
|
|
|
29
42
|
@properties << {
|
|
30
43
|
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
31
44
|
'Name' => name,
|
|
32
|
-
'Value' => wrap(value)
|
|
45
|
+
'Value' => self.class.wrap(value)
|
|
33
46
|
}
|
|
34
47
|
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def wrap(value)
|
|
39
|
-
case value
|
|
40
|
-
when String then value
|
|
41
|
-
when Time, DateTime then value.strftime('%Y-%m-%dT%H:%I:%S')
|
|
42
|
-
when Integer then { '$type' => 'System.Int32', '$value' => value }
|
|
43
|
-
when true, false then { '$type' => 'System.Boolean', '$value' => value }
|
|
44
|
-
else
|
|
45
|
-
raise Errors::UnexpectedPropertyTypeError.from(value)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
data/lib/usps/imis/version.rb
CHANGED