usps-imis-api 0.3.1.pre.6 → 0.3.1.pre.8
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/lib/usps/imis/panel/base_panel.rb +41 -0
- data/lib/usps/imis/panel/education.rb +111 -0
- data/lib/usps/imis/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5448a27ff10181a75b5deb4d6a25bf7ad8349360a1ddea7fa64cc79b64925c
|
4
|
+
data.tar.gz: 59f78c0058d9f6dae4e39e58b4a2305229ad95eec9bff4c52ef77309034db1ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a98a3af09accbcb029f0ebe37c6b83aa008890b611efb0177359276c3e019e44552b127e08354153f103a9da62504435fdd828868e17e7d75e0eeafaf79b9e1
|
7
|
+
data.tar.gz: 7e0ae652d4ee8dbc0c2adb6fee5a5383510769c2a14bddbb8d577eeda95fc7eef197e5259b5ad27b0bd932494ef37dff8e96abf7544b50b5fe1edec6088d681a
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Usps
|
4
|
+
module Imis
|
5
|
+
module Panel
|
6
|
+
class BasePanel
|
7
|
+
attr_reader :api
|
8
|
+
|
9
|
+
def initialize(api = nil)
|
10
|
+
@api = api || Api.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(ordinal)
|
14
|
+
api.get(business_object, url_id: "~#{api.imis_id}|#{ordinal}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(data)
|
18
|
+
api.post(business_object, payload(data), url_id: '')
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(data)
|
22
|
+
api.put(business_object, payload(data), url_id: "~#{api.imis_id}|#{data[:ordinal]}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy(ordinal)
|
26
|
+
api.delete(business_object, url_id: "~#{api.imis_id}|#{ordinal}")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def business_object
|
32
|
+
raise "#{self.class.name} must implement #business_object"
|
33
|
+
end
|
34
|
+
|
35
|
+
def payload(_data)
|
36
|
+
raise "#{self.class.name} must implement #payload(data)"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Usps
|
4
|
+
module Imis
|
5
|
+
module Panel
|
6
|
+
class Education < BasePanel
|
7
|
+
private
|
8
|
+
|
9
|
+
def business_object
|
10
|
+
'ABC_ASC_Educ'
|
11
|
+
end
|
12
|
+
|
13
|
+
# rubocop:disable Metrics/MethodLength
|
14
|
+
def payload(data)
|
15
|
+
identity_type =
|
16
|
+
'System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib'
|
17
|
+
|
18
|
+
{
|
19
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts',
|
20
|
+
'EntityTypeName' => 'ABC_ASC_EDUC',
|
21
|
+
'PrimaryParentEntityTypeName' => 'Party',
|
22
|
+
'Identity' => {
|
23
|
+
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
24
|
+
'EntityTypeName' => 'ABC_ASC_EDUC',
|
25
|
+
'IdentityElements' => {
|
26
|
+
'$type' => identity_type,
|
27
|
+
'$values' => [api.imis_id, data[:ordinal]&.to_s].compact
|
28
|
+
}
|
29
|
+
},
|
30
|
+
'PrimaryParentIdentity' => {
|
31
|
+
'$type' => 'Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts',
|
32
|
+
'EntityTypeName' => 'Party',
|
33
|
+
'IdentityElements' => {
|
34
|
+
'$type' => identity_type,
|
35
|
+
'$values' => [api.imis_id]
|
36
|
+
}
|
37
|
+
},
|
38
|
+
'Properties' => {
|
39
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts',
|
40
|
+
'$values' => [
|
41
|
+
{
|
42
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
43
|
+
'Name' => 'ID',
|
44
|
+
'Value' => api.imis_id
|
45
|
+
},
|
46
|
+
(
|
47
|
+
if data[:ordinal]
|
48
|
+
{
|
49
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
50
|
+
'Name' => 'Ordinal',
|
51
|
+
'Value' => {
|
52
|
+
'$type' => 'System.Int32',
|
53
|
+
'$value' => data[:ordinal]
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
),
|
58
|
+
{
|
59
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
60
|
+
"Name" => "ABC_EDUC_THRU_DATE",
|
61
|
+
"Value" => (data[:thru_date] || "0001-01-01T00:00:00")
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
65
|
+
"Name" => "ABC_ECertificate",
|
66
|
+
"Value" => data[:certificate]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
70
|
+
"Name" => "ABC_Educ_Description",
|
71
|
+
"Value" => data[:description]
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
75
|
+
"Name" => "ABC_Educ_Effective_Date",
|
76
|
+
"Value" => data[:effective_date]
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
80
|
+
"Name" => "ABC_Educ_Source_System",
|
81
|
+
"Value" => data[:source]
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
85
|
+
"Name" => "ABC_Educ_Transaction_Date",
|
86
|
+
"Value" => Time.zone.now.strftime('%Y-%m-%dT%H:%I:%S')
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
90
|
+
"Name" => "ABC_Other_Code",
|
91
|
+
"Value" => date[:code]
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
95
|
+
"Name" => "ABC_Product_Code",
|
96
|
+
"Value" => date[:type_code]
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"$type" => "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
|
100
|
+
"Name" => "ABC_TYPE",
|
101
|
+
"Value" => (data[:abc_type_code] || "EDUC")
|
102
|
+
}
|
103
|
+
].compact
|
104
|
+
}
|
105
|
+
}
|
106
|
+
end
|
107
|
+
# rubocop:enable Metrics/MethodLength
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/usps/imis/version.rb
CHANGED
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.1.pre.
|
4
|
+
version: 0.3.1.pre.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
@@ -33,6 +33,8 @@ files:
|
|
33
33
|
- lib/usps/imis/error/api.rb
|
34
34
|
- lib/usps/imis/error/mapper.rb
|
35
35
|
- lib/usps/imis/mapper.rb
|
36
|
+
- lib/usps/imis/panel/base_panel.rb
|
37
|
+
- lib/usps/imis/panel/education.rb
|
36
38
|
- lib/usps/imis/panel/vsc.rb
|
37
39
|
- lib/usps/imis/version.rb
|
38
40
|
- spec/lib/usps/imis/api_spec.rb
|