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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6605b07f76aa3dff12a6b31bbe049cc8a54096059c8b4df97542fb15505f9a8f
4
- data.tar.gz: 117da358bf89bbad7d26376aa7290e7b3e6918d023920764a9b723a082f22f46
3
+ metadata.gz: 23d6017a32a285df035dcc439b88cddeceeb42a1c238abc5426014879a328408
4
+ data.tar.gz: 7a08dd59fdfee2aa739a4f7df0231c786c1df4be92ff3528d6ae158cf65b7382
5
5
  SHA512:
6
- metadata.gz: 8a5b21a769638e6f4bc20aa4ceff7fff922ff3772863f689569fb678aa3f119daa7f04fbdd9fd249b62698922b61ffb32e6d46e54cebf4ae2ae111ae73f2e49f
7
- data.tar.gz: 4f9ed158ae0ee2aa141f630d3d5911f9203c9a2a1e311a90f951570546e9a9e5bfccf38ce392189116b255e362399c43c1ba536cb7bc4af3dd1f95d858053e3f
6
+ metadata.gz: b0a4b6001605aa8b70e3030dc330db72354794b87f715134c113579398f4344675c167f9431cf5b33c523039fd973eedc82f001cd91a9b38d103cf7f5ae7baae
7
+ data.tar.gz: 549d9df0fabaf1d14f3a78c1b602428e53397d3a2e22d961116252c22c283cf6a6e65bd72e043facfb4bc2e84ae4d779fe1c0bff19f9fb4305cfa058ff578ba9
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}")
@@ -7,7 +7,7 @@ module NgpVan
7
7
 
8
8
  # Current minor release.
9
9
  # @return [Integer]
10
- MINOR = 7
10
+ MINOR = 8
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
@@ -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.7.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-03-29 00:00:00.000000000 Z
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