ngp_van 0.7.0 → 0.8.0
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ngp_van/client/people.rb +10 -0
- data/lib/ngp_van/client/supporter_groups.rb +5 -0
- data/lib/ngp_van/version.rb +1 -1
- data/spec/ngp_van/client/people_spec.rb +49 -0
- data/spec/ngp_van/client/supporter_groups_spec.rb +13 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d6017a32a285df035dcc439b88cddeceeb42a1c238abc5426014879a328408
|
4
|
+
data.tar.gz: 7a08dd59fdfee2aa739a4f7df0231c786c1df4be92ff3528d6ae158cf65b7382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a4b6001605aa8b70e3030dc330db72354794b87f715134c113579398f4344675c167f9431cf5b33c523039fd973eedc82f001cd91a9b38d103cf7f5ae7baae
|
7
|
+
data.tar.gz: 549d9df0fabaf1d14f3a78c1b602428e53397d3a2e22d961116252c22c283cf6a6e65bd72e043facfb4bc2e84ae4d779fe1c0bff19f9fb4305cfa058ff578ba9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -30,6 +30,16 @@ module NgpVan
|
|
30
30
|
verify_ids(id, type)
|
31
31
|
post(path: "people/#{type}:#{id}/canvassResponses", body: body)
|
32
32
|
end
|
33
|
+
|
34
|
+
def apply_code_to_person(id:, body: {})
|
35
|
+
verify_id(id)
|
36
|
+
post(path: "people/#{id}/codes", body: body)
|
37
|
+
end
|
38
|
+
|
39
|
+
def delete_code_from_person(id:, codeId:)
|
40
|
+
verify_ids(id, codeId)
|
41
|
+
delete(path: "people/#{id}/codes/#{codeId}")
|
42
|
+
end
|
33
43
|
end
|
34
44
|
end
|
35
45
|
end
|
@@ -16,6 +16,11 @@ module NgpVan
|
|
16
16
|
get(path: 'supporterGroups', params: params)
|
17
17
|
end
|
18
18
|
|
19
|
+
def delete_supporter_group(id:, params: {})
|
20
|
+
verify_id(id)
|
21
|
+
delete(path: "supporterGroups/#{id}", params: params)
|
22
|
+
end
|
23
|
+
|
19
24
|
def add_person_to_supporter_group(supporter_group_id:, id:)
|
20
25
|
verify_ids(id, supporter_group_id)
|
21
26
|
put(path: "supporterGroups/#{supporter_group_id}/people/#{id}")
|
data/lib/ngp_van/version.rb
CHANGED
@@ -222,6 +222,55 @@ module NgpVan
|
|
222
222
|
).to eq('')
|
223
223
|
end
|
224
224
|
end
|
225
|
+
|
226
|
+
describe '#apply_code_to_person' do
|
227
|
+
let(:url) { build_url(client: client, path: 'people/123123/codes') }
|
228
|
+
let(:request_body) { {'codeId' => 123456} }
|
229
|
+
|
230
|
+
before do
|
231
|
+
stub_request(:post, url)
|
232
|
+
.with(body: request_body.to_json)
|
233
|
+
.to_return(status: 204)
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'sends the correct request' do
|
237
|
+
client.apply_code_to_person(id: 123123, body: request_body)
|
238
|
+
expect(
|
239
|
+
a_request(:post, url)
|
240
|
+
.with(
|
241
|
+
body: request_body
|
242
|
+
)
|
243
|
+
).to have_been_made
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'returns the empty response body' do
|
247
|
+
expect(
|
248
|
+
client.apply_code_to_person(id: 123123, body: request_body)
|
249
|
+
).to eq('')
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
describe '#delete_code_from_person' do
|
254
|
+
let(:url) { build_url(client: client, path: 'people/215501/codes/123') }
|
255
|
+
|
256
|
+
before do
|
257
|
+
stub_request(:delete, url)
|
258
|
+
.to_return(status: 204)
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'requests the correct resource' do
|
262
|
+
client.delete_code_from_person(id: 215_501, codeId: 123)
|
263
|
+
expect(
|
264
|
+
a_request(:delete, url)
|
265
|
+
).to have_been_made
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'returns an empty response body' do
|
269
|
+
expect(
|
270
|
+
client.delete_code_from_person(id: 215_501, codeId: 123)
|
271
|
+
).to eq('')
|
272
|
+
end
|
273
|
+
end
|
225
274
|
end
|
226
275
|
end
|
227
276
|
end
|
@@ -66,6 +66,19 @@ module NgpVan
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
describe '#delete_supporter_group' do
|
70
|
+
let(:url) { build_url(client: client, path: 'supporterGroups/1122') }
|
71
|
+
|
72
|
+
before do
|
73
|
+
stub_request(:delete, url).to_return(status: 204, body: '')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'performs the request' do
|
77
|
+
client.delete_supporter_group(id: 1122)
|
78
|
+
expect(a_request(:delete, url)).to have_been_made
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
69
82
|
describe '#supporter_groups' do
|
70
83
|
let(:params) do
|
71
84
|
{
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ngp_van
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Styles
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
uZ9aI1c3Tt/pkw9HxXwDo1m/+BQOZkAhEZu6LQQgBPAX8hlUyDw54SoJtfnFp0FI
|
37
37
|
Hje6PutFGypAA8f9kmLl8X2Eu74D8PI9ywc=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2019-
|
39
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
metadata.gz.sig
CHANGED
Binary file
|