usps-imis-api 0.6.3 → 0.6.4
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 +3 -3
- data/lib/usps/imis/panel/base_panel.rb +37 -0
- data/lib/usps/imis/panel/education.rb +13 -86
- data/lib/usps/imis/panel/vsc.rb +12 -84
- data/lib/usps/imis/requests.rb +2 -0
- 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: ec6fd6190ca25775a69fca08cc8d16ba0177b6e34cd3643da1d07143720d607d
|
|
4
|
+
data.tar.gz: e73a5bf6dbc6f1d0daeab108bcd5a9ea86e925348562e25c76347a8e4c8a6b08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6eb831bd549f3f9b95d4cb731974c2232f2defa762014f2471f9fb88de6386f350c1e2b09a3398e29b2c103c079666df5eca835a7c57f716c2263d794f0c7176
|
|
7
|
+
data.tar.gz: c84a91ef84235ea7f472824626ef59d946b35e04fee52c34375cd1e002c52ed4a75b08d76a3bc40576a349cd6960fec1a6a4124465e1e1061d2c40cb832d9147
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
|
@@ -236,13 +236,13 @@ end
|
|
|
236
236
|
api.with(31092) do
|
|
237
237
|
# These requests are identical:
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
on('ABC_ASC_Individual_Demog') do
|
|
240
240
|
get['Properties']['$values'].find { |hash| hash['Name'] == 'TotMMS' }['Value']['$value']
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
on('ABC_ASC_Individual_Demog') { get_field('TotMMS') }
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
on('ABC_ASC_Individual_Demog').get_field('TotMMS')
|
|
246
246
|
end
|
|
247
247
|
|
|
248
248
|
# This request fetches the same data, but leaves the iMIS ID selected
|
|
@@ -59,6 +59,43 @@ module Usps
|
|
|
59
59
|
def payload(_data)
|
|
60
60
|
raise Error::ApiError, "#{self.class.name} must implement #payload(data)"
|
|
61
61
|
end
|
|
62
|
+
|
|
63
|
+
# rubocop:disable Metrics/MethodLength
|
|
64
|
+
def payload_header(data)
|
|
65
|
+
identity_type =
|
|
66
|
+
'System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib'
|
|
67
|
+
|
|
68
|
+
{
|
|
69
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts',
|
|
70
|
+
'EntityTypeName' => business_object,
|
|
71
|
+
'PrimaryParentEntityTypeName' => 'Party',
|
|
72
|
+
'Identity' => {
|
|
73
|
+
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
74
|
+
'EntityTypeName' => business_object,
|
|
75
|
+
'IdentityElements' => {
|
|
76
|
+
'$type' => identity_type,
|
|
77
|
+
'$values' => [api.imis_id, data[:ordinal]&.to_s].compact
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
'PrimaryParentIdentity' => {
|
|
81
|
+
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
82
|
+
'EntityTypeName' => 'Party',
|
|
83
|
+
'IdentityElements' => {
|
|
84
|
+
'$type' => identity_type,
|
|
85
|
+
'$values' => [api.imis_id]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
end
|
|
90
|
+
# rubocop:enable Metrics/MethodLength
|
|
91
|
+
|
|
92
|
+
def property(name, value)
|
|
93
|
+
{
|
|
94
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
95
|
+
'Name' => name,
|
|
96
|
+
'Value' => value
|
|
97
|
+
}
|
|
98
|
+
end
|
|
62
99
|
end
|
|
63
100
|
end
|
|
64
101
|
end
|
|
@@ -14,97 +14,24 @@ module Usps
|
|
|
14
14
|
|
|
15
15
|
# rubocop:disable Metrics/MethodLength
|
|
16
16
|
def payload(data)
|
|
17
|
-
|
|
18
|
-
'System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib'
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts',
|
|
22
|
-
'EntityTypeName' => 'ABC_ASC_EDUC',
|
|
23
|
-
'PrimaryParentEntityTypeName' => 'Party',
|
|
24
|
-
'Identity' => {
|
|
25
|
-
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
26
|
-
'EntityTypeName' => 'ABC_ASC_EDUC',
|
|
27
|
-
'IdentityElements' => {
|
|
28
|
-
'$type' => identity_type,
|
|
29
|
-
'$values' => [api.imis_id, data[:ordinal]&.to_s].compact
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
'PrimaryParentIdentity' => {
|
|
33
|
-
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
34
|
-
'EntityTypeName' => 'Party',
|
|
35
|
-
'IdentityElements' => {
|
|
36
|
-
'$type' => identity_type,
|
|
37
|
-
'$values' => [api.imis_id]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
17
|
+
payload_header(data).merge(
|
|
40
18
|
'Properties' => {
|
|
41
19
|
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts',
|
|
42
20
|
'$values' => [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'$type' => 'System.Int32',
|
|
55
|
-
'$value' => data[:ordinal]
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
end
|
|
59
|
-
),
|
|
60
|
-
{
|
|
61
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
62
|
-
'Name' => 'ABC_EDUC_THRU_DATE',
|
|
63
|
-
'Value' => data[:thru_date] || '0001-01-01T00:00:00'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
67
|
-
'Name' => 'ABC_ECertificate',
|
|
68
|
-
'Value' => data[:certificate]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
72
|
-
'Name' => 'ABC_Educ_Description',
|
|
73
|
-
'Value' => data[:description]
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
77
|
-
'Name' => 'ABC_Educ_Effective_Date',
|
|
78
|
-
'Value' => data[:effective_date]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
82
|
-
'Name' => 'ABC_Educ_Source_System',
|
|
83
|
-
'Value' => data[:source]
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
87
|
-
'Name' => 'ABC_Educ_Transaction_Date',
|
|
88
|
-
'Value' => Time.now.strftime('%Y-%m-%dT%H:%I:%S')
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
92
|
-
'Name' => 'ABC_Other_Code',
|
|
93
|
-
'Value' => data[:code]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
97
|
-
'Name' => 'ABC_Product_Code',
|
|
98
|
-
'Value' => data[:type_code]
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
102
|
-
'Name' => 'ABC_TYPE',
|
|
103
|
-
'Value' => data[:abc_type_code] || 'EDUC'
|
|
104
|
-
}
|
|
21
|
+
property('ID', api.imis_id),
|
|
22
|
+
(property('Ordinal', { '$type' => 'System.Int32', '$value' => data[:ordinal] }) if data[:ordinal]),
|
|
23
|
+
property('ABC_EDUC_THRU_DATE', data[:thru_date] || '0001-01-01T00:00:00'),
|
|
24
|
+
property('ABC_ECertificate', data[:certificate]),
|
|
25
|
+
property('ABC_Educ_Description', data[:description]),
|
|
26
|
+
property('ABC_Educ_Effective_Date', data[:effective_date]),
|
|
27
|
+
property('ABC_Educ_Source_System', data[:source]),
|
|
28
|
+
property('ABC_Educ_Transaction_Date', Time.now.strftime('%Y-%m-%dT%H:%I:%S')),
|
|
29
|
+
property('ABC_Other_Code', data[:code]),
|
|
30
|
+
property('ABC_Product_Code', data[:type_code]),
|
|
31
|
+
property('ABC_TYPE', data[:abc_type_code] || 'EDUC')
|
|
105
32
|
].compact
|
|
106
33
|
}
|
|
107
|
-
|
|
34
|
+
)
|
|
108
35
|
end
|
|
109
36
|
# rubocop:enable Metrics/MethodLength
|
|
110
37
|
end
|
data/lib/usps/imis/panel/vsc.rb
CHANGED
|
@@ -14,95 +14,23 @@ module Usps
|
|
|
14
14
|
|
|
15
15
|
# rubocop:disable Metrics/MethodLength
|
|
16
16
|
def payload(data)
|
|
17
|
-
|
|
18
|
-
'System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib'
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts',
|
|
22
|
-
'EntityTypeName' => 'ABC_ASC_Vessel_Safety_Checks',
|
|
23
|
-
'PrimaryParentEntityTypeName' => 'Party',
|
|
24
|
-
'Identity' => {
|
|
25
|
-
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
26
|
-
'EntityTypeName' => 'ABC_ASC_Vessel_Safety_Checks',
|
|
27
|
-
'IdentityElements' => {
|
|
28
|
-
'$type' => identity_type,
|
|
29
|
-
'$values' => [api.imis_id, data[:ordinal]&.to_s].compact
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
'PrimaryParentIdentity' => {
|
|
33
|
-
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
|
34
|
-
'EntityTypeName' => 'Party',
|
|
35
|
-
'IdentityElements' => {
|
|
36
|
-
'$type' => identity_type,
|
|
37
|
-
'$values' => [api.imis_id]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
17
|
+
payload_header(data).merge(
|
|
40
18
|
'Properties' => {
|
|
41
19
|
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts',
|
|
42
20
|
'$values' => [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
'Value' => {
|
|
54
|
-
'$type' => 'System.Int32',
|
|
55
|
-
'$value' => data[:ordinal]
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
end
|
|
59
|
-
),
|
|
60
|
-
{
|
|
61
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
62
|
-
'Name' => 'Source_System',
|
|
63
|
-
'Value' => 'Manual ITCom Entry'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
67
|
-
'Name' => 'ABC_ECertificate',
|
|
68
|
-
'Value' => data[:certificate]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
72
|
-
'Name' => 'Activity_Type',
|
|
73
|
-
'Value' => 'VSC'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
77
|
-
'Name' => 'Description',
|
|
78
|
-
'Value' => 'Vessel Safety Checks'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
82
|
-
'Name' => 'Effective_Date',
|
|
83
|
-
'Value' => "#{data[:year]}-12-01T00:00:00"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
87
|
-
'Name' => 'Quantity',
|
|
88
|
-
'Value' => {
|
|
89
|
-
'$type' => 'System.Int32',
|
|
90
|
-
'$value' => data[:count]
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
95
|
-
'Name' => 'Thru_Date',
|
|
96
|
-
'Value' => "#{data[:year]}-12-31T00:00:00"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
100
|
-
'Name' => 'Transaction_Date',
|
|
101
|
-
'Value' => Time.now.strftime('%Y-%m-%dT%H:%M:%S')
|
|
102
|
-
}
|
|
21
|
+
property('ID', api.imis_id),
|
|
22
|
+
(property('Ordinal', { '$type' => 'System.Int32', '$value' => data[:ordinal] }) if data[:ordinal]),
|
|
23
|
+
property('Source_System', 'Manual ITCom Entry'),
|
|
24
|
+
property('ABC_ECertificate', data[:certificate]),
|
|
25
|
+
property('Activity_Type', 'VSC'),
|
|
26
|
+
property('Description', 'Vessel Safety Checks'),
|
|
27
|
+
property('Effective_Date', "#{data[:year]}-12-01T00:00:00"),
|
|
28
|
+
property('Quantity', { '$type' => 'System.Int32', '$value' => data[:count] }),
|
|
29
|
+
property('Thru_Date', "#{data[:year]}-12-31T00:00:00"),
|
|
30
|
+
property('Transaction_Date', Time.now.strftime('%Y-%m-%dT%H:%M:%S'))
|
|
103
31
|
].compact
|
|
104
32
|
}
|
|
105
|
-
|
|
33
|
+
)
|
|
106
34
|
end
|
|
107
35
|
# rubocop:enable Metrics/MethodLength
|
|
108
36
|
end
|
data/lib/usps/imis/requests.rb
CHANGED
data/lib/usps/imis/version.rb
CHANGED