usps-imis-api 0.6.15 → 0.6.16
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 +29 -8
- data/lib/usps/imis/api.rb +1 -10
- data/lib/usps/imis/mapper.rb +1 -1
- data/lib/usps/imis/version.rb +1 -1
- data/spec/lib/usps/imis/api_spec.rb +3 -3
- 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: 9d68eb23f00014bc9cb6173f716084f8eff9cedfc48e70507c07a35fe8e7b207
|
|
4
|
+
data.tar.gz: fda5c7882bc758d9cfdd2889e734ff8c0d319f456e39bf1965f030765ec82a0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb42f257b1e4e6c6383dd9b1f37d68e9c89f358f98bfccb09c53190573da28b0259fabe27e12f50c5420daa8f009661e928463c19a48e854abd86b8dd34021f1
|
|
7
|
+
data.tar.gz: a4fb539ef056e6936e1546b303ef8b20bf52a822185063d8b6eabc042eb5b3f2b2fceb5d0cff5959c40ce524175a137dd1821783af7eea495803342c1d065cff
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
|
@@ -77,7 +77,13 @@ You can also manually set the current ID, if you already have it for a given mem
|
|
|
77
77
|
api.imis_id = imis_id
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
###
|
|
80
|
+
### Business Object and Panel Actions
|
|
81
|
+
|
|
82
|
+
Business Objects and Panels support the following actions.
|
|
83
|
+
|
|
84
|
+
Panels require passing in the ordinal identifier as an argument, except for `POST`.
|
|
85
|
+
|
|
86
|
+
#### GET
|
|
81
87
|
|
|
82
88
|
To fetch member data, run e.g.:
|
|
83
89
|
|
|
@@ -87,7 +93,9 @@ api.imis_id = 31092
|
|
|
87
93
|
data = api.on('ABC_ASC_Individual_Demog').get
|
|
88
94
|
```
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
Alias: `read`
|
|
97
|
+
|
|
98
|
+
#### GET Field
|
|
91
99
|
|
|
92
100
|
To fetch a specific field from member data, run e.g.:
|
|
93
101
|
|
|
@@ -97,7 +105,9 @@ api.imis_id = 31092
|
|
|
97
105
|
tot_mms = api.on('ABC_ASC_Individual_Demog').get_field('TotMMS')
|
|
98
106
|
```
|
|
99
107
|
|
|
100
|
-
|
|
108
|
+
Alias: `fetch`
|
|
109
|
+
|
|
110
|
+
#### PUT Fields
|
|
101
111
|
|
|
102
112
|
To update member data, run e.g.:
|
|
103
113
|
|
|
@@ -111,7 +121,9 @@ update = api.on('ABC_ASC_Individual_Demog').put_fields(data)
|
|
|
111
121
|
This method fetches the current data structure, and filters it down to just what you want to
|
|
112
122
|
update, to reduce the likelihood of update collisions or type validation failures.
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
Alias: `patch`
|
|
125
|
+
|
|
126
|
+
#### PUT
|
|
115
127
|
|
|
116
128
|
To update member data, run e.g.:
|
|
117
129
|
|
|
@@ -121,9 +133,13 @@ api.imis_id = 31092
|
|
|
121
133
|
update = api.on('ABC_ASC_Individual_Demog').put(complete_imis_object)
|
|
122
134
|
```
|
|
123
135
|
|
|
124
|
-
This method requires a complete iMIS data structure.
|
|
136
|
+
This method requires a complete iMIS data structure. However, any properties not included will be
|
|
137
|
+
left unmodified (meaning this also effectively handles `PATCH`, though iMIS does not accept that
|
|
138
|
+
HTTP verb).
|
|
139
|
+
|
|
140
|
+
Alias: `update`
|
|
125
141
|
|
|
126
|
-
|
|
142
|
+
#### POST
|
|
127
143
|
|
|
128
144
|
To create new member data, run e.g.:
|
|
129
145
|
|
|
@@ -133,7 +149,9 @@ created = api.on('ABC_ASC_Individual_Demog').post(complete_imis_object)
|
|
|
133
149
|
|
|
134
150
|
This method requires a complete iMIS data structure.
|
|
135
151
|
|
|
136
|
-
|
|
152
|
+
Alias: `create`
|
|
153
|
+
|
|
154
|
+
#### DELETE
|
|
137
155
|
|
|
138
156
|
To remove member data, run e.g.:
|
|
139
157
|
|
|
@@ -145,6 +163,8 @@ api.on('ABC_ASC_Individual_Demog').delete
|
|
|
145
163
|
|
|
146
164
|
This returns a blank string on success.
|
|
147
165
|
|
|
166
|
+
Alias: `destroy`
|
|
167
|
+
|
|
148
168
|
### QUERY
|
|
149
169
|
|
|
150
170
|
Run an IQA Query
|
|
@@ -187,7 +207,8 @@ vsc.api.imis_id = 6374
|
|
|
187
207
|
vsc.get(1417)
|
|
188
208
|
|
|
189
209
|
created = vsc.create(certificate: 'E136924', year: 2024, count: 42)
|
|
190
|
-
ordinal = created['Properties']['$values'][
|
|
210
|
+
ordinal = created['Properties']['$values'].find { it['Name'] == 'Ordinal' }['Value']['$value']
|
|
211
|
+
# ordinal = created['Identity']['IdentityElements']['$values'][1] # Alternative
|
|
191
212
|
|
|
192
213
|
vsc.update(certificate: 'E136924', year: 2024, count: 43, ordinal: ordinal)
|
|
193
214
|
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -132,15 +132,6 @@ module Usps
|
|
|
132
132
|
results
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
# An instance of +BusinessObject+, using this instance as its parent +Api+
|
|
136
|
-
#
|
|
137
|
-
# @param business_object_name [String] Name of the business object
|
|
138
|
-
# @param ordinal [Integer] Ordinal to build override ID param of the URL (e.g. used for Panels)
|
|
139
|
-
#
|
|
140
|
-
def business_object(business_object_name, ordinal: nil)
|
|
141
|
-
BusinessObject.new(self, business_object_name, ordinal:)
|
|
142
|
-
end
|
|
143
|
-
|
|
144
135
|
# Run requests as DSL, with specific +BusinessObject+ only maintained for this scope
|
|
145
136
|
#
|
|
146
137
|
# If no block is given, this returns the specified +BusinessObject+.
|
|
@@ -149,7 +140,7 @@ module Usps
|
|
|
149
140
|
# @param ordinal [Integer] Ordinal to build override ID param of the URL (e.g. used for Panels)
|
|
150
141
|
#
|
|
151
142
|
def on(business_object_name, ordinal: nil, &)
|
|
152
|
-
object =
|
|
143
|
+
object = BusinessObject.new(self, business_object_name, ordinal:)
|
|
153
144
|
return object unless block_given?
|
|
154
145
|
|
|
155
146
|
object.instance_eval(&)
|
data/lib/usps/imis/mapper.rb
CHANGED
data/lib/usps/imis/version.rb
CHANGED
|
@@ -56,7 +56,7 @@ describe Usps::Imis::Api do
|
|
|
56
56
|
before { api.imis_id = 31092 }
|
|
57
57
|
|
|
58
58
|
it 'sends an update' do
|
|
59
|
-
expect(api.
|
|
59
|
+
expect(api.on('ABC_ASC_Individual_Demog').put_fields('TotMMS' => 15)).to(
|
|
60
60
|
be_a(Hash)
|
|
61
61
|
)
|
|
62
62
|
end
|
|
@@ -78,7 +78,7 @@ describe Usps::Imis::Api do
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it 'wraps the error' do
|
|
81
|
-
expect { api.
|
|
81
|
+
expect { api.on('ABC_ASC_Individual_Demog').put_fields('TotMMS' => 15) }.to(
|
|
82
82
|
raise_error(Usps::Imis::Error::ApiError, warning_text)
|
|
83
83
|
)
|
|
84
84
|
end
|
|
@@ -88,7 +88,7 @@ describe Usps::Imis::Api do
|
|
|
88
88
|
describe '#with' do
|
|
89
89
|
it 'sends an update from put' do
|
|
90
90
|
expect(
|
|
91
|
-
api.with(31092) {
|
|
91
|
+
api.with(31092) { on('ABC_ASC_Individual_Demog').put_fields('TotMMS' => 15) }
|
|
92
92
|
).to be_a(Hash)
|
|
93
93
|
end
|
|
94
94
|
|