ngp_van 0.4.0 → 0.5.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.rb +2 -0
- data/lib/ngp_van/client/supporter_groups.rb +27 -0
- data/lib/ngp_van/version.rb +1 -1
- data/spec/ngp_van/client/supporter_groups_spec.rb +133 -0
- data/spec/support/fixtures/create_supporter_group.json +4 -0
- data/spec/support/fixtures/supporter_group.json +5 -0
- data/spec/support/fixtures/supporter_groups.json +16 -0
- metadata +7 -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: 56d7e5c4dead43ca39fae5067a833f1e0b02fbe3d0368063070a97b6ca1506dc
|
4
|
+
data.tar.gz: b0199579935ae12dc660c011300e97629deccd9732ec3c83661b7b4e5435e668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eb470d707c3bca33acb265209723bdc840993164ae2cb34fde4faf78d6e04799ee0f0f1c9be70754bb40121d3a1d69be11b217deb634df8dd5ab3bd2e3a1217
|
7
|
+
data.tar.gz: '0859eacce369cb8361feaa8455dfec4e9d51ba23a4cb214509f097e2fc9b879eb19f2423d506a690205f0f4f88b583ac498ea4001fb08468c48a65412067386d'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ngp_van/client.rb
CHANGED
@@ -17,6 +17,7 @@ require 'ngp_van/client/printed_lists'
|
|
17
17
|
require 'ngp_van/client/minivan_exports'
|
18
18
|
require 'ngp_van/client/signups'
|
19
19
|
require 'ngp_van/client/survey_questions'
|
20
|
+
require 'ngp_van/client/supporter_groups'
|
20
21
|
require 'ngp_van/client/users'
|
21
22
|
|
22
23
|
module NgpVan
|
@@ -46,6 +47,7 @@ module NgpVan
|
|
46
47
|
include NgpVan::Client::PrintedLists
|
47
48
|
include NgpVan::Client::MinivanExports
|
48
49
|
include NgpVan::Client::Signups
|
50
|
+
include NgpVan::Client::SupporterGroups
|
49
51
|
include NgpVan::Client::SurveyQuestions
|
50
52
|
include NgpVan::Client::Users
|
51
53
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module SupporterGroups
|
6
|
+
def create_supporter_group(body: {})
|
7
|
+
post(path: 'supporterGroups', body: body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def supporter_group(id:, params: {})
|
11
|
+
get(path: "supporterGroups/#{id}", params: params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def supporter_groups(params: {})
|
15
|
+
get(path: 'supporterGroups', params: params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_person_to_supporter_group(supporter_group_id:, id:)
|
19
|
+
put(path: "supporterGroups/#{supporter_group_id}/people/#{id}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def remove_person_from_supporter_group(supporter_group_id:, id:)
|
23
|
+
delete(path: "supporterGroups/#{supporter_group_id}/people/#{id}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/ngp_van/version.rb
CHANGED
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module NgpVan
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
7
|
+
class Client
|
8
|
+
RSpec.describe SupporterGroups do
|
9
|
+
let(:client) { NgpVan::Client.new }
|
10
|
+
|
11
|
+
describe '#create_supporter_group' do
|
12
|
+
let(:body) do
|
13
|
+
JSON.parse(fixture('create_supporter_group.json').read)
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:url) { build_url(client: client, path: 'supporterGroups') }
|
17
|
+
|
18
|
+
before do
|
19
|
+
stub_request(:post, url)
|
20
|
+
.with(body: JSON.generate(body))
|
21
|
+
.to_return(
|
22
|
+
body: '1122',
|
23
|
+
status: 201,
|
24
|
+
headers: {
|
25
|
+
'Location' => build_url(client: client, path: '/supporterGroups/1122')
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'requests the correct resource' do
|
31
|
+
client.create_supporter_group(body: body)
|
32
|
+
expect(
|
33
|
+
a_request(:post, url)
|
34
|
+
.with(
|
35
|
+
body: body
|
36
|
+
)
|
37
|
+
).to have_been_made
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns the created id' do
|
41
|
+
expect(client.create_supporter_group(body: body)).to eq(1122)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#supporter_group' do
|
46
|
+
let(:response) { fixture('supporter_group.json') }
|
47
|
+
let(:url) { build_url(client: client, path: 'supporterGroups/1122') }
|
48
|
+
|
49
|
+
before do
|
50
|
+
stub_request(:get, url).to_return(body: response)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'requests the correct resource' do
|
54
|
+
client.supporter_group(id: 1122)
|
55
|
+
expect(a_request(:get, url)).to have_been_made
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns a event object' do
|
59
|
+
supporter_group = client.supporter_group(id: 1122)
|
60
|
+
expect(supporter_group).to be_a(Hash)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'returns the requested supporter group' do
|
64
|
+
supporter_group = client.supporter_group(id: 1122)
|
65
|
+
expect(supporter_group['id']).to eq(1122)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#supporter_groups' do
|
70
|
+
let(:params) do
|
71
|
+
{
|
72
|
+
'$top' => 2
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
let(:response) { fixture('supporter_groups.json') }
|
77
|
+
let(:url) { build_url(client: client, path: 'supporterGroups') }
|
78
|
+
|
79
|
+
before do
|
80
|
+
stub_request(:get, url)
|
81
|
+
.with(query: params)
|
82
|
+
.to_return(
|
83
|
+
body: response
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'requests the correct resource' do
|
88
|
+
client.supporter_groups(params: params)
|
89
|
+
expect(
|
90
|
+
a_request(:get, url)
|
91
|
+
.with(query: params)
|
92
|
+
).to have_been_made
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'returns an array of items' do
|
96
|
+
supporter_groups = client.supporter_groups(params: params)
|
97
|
+
expect(supporter_groups['items']).to be_a(Array)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'returns the requested supporter groups' do
|
101
|
+
supporter_groups = client.supporter_groups(params: params)
|
102
|
+
expect(supporter_groups['items'].first['id']).to eq(1122)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#add_person_to_supporter_group' do
|
107
|
+
let(:url) { build_url(client: client, path: 'supporterGroups/1122/people/3344') }
|
108
|
+
|
109
|
+
before do
|
110
|
+
stub_request(:put, url).to_return(status: 204)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'requests the correct resource' do
|
114
|
+
client.add_person_to_supporter_group(supporter_group_id: 1122, id: 3344)
|
115
|
+
expect(a_request(:put, url)).to have_been_made
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#remove_person_from_supporter_group' do
|
120
|
+
let(:url) { build_url(client: client, path: 'supporterGroups/1122/people/3344') }
|
121
|
+
|
122
|
+
before do
|
123
|
+
stub_request(:delete, url).to_return(status: 204)
|
124
|
+
|
125
|
+
it 'requests the correct resource' do
|
126
|
+
client.add_person_to_supporter_group(supporter_group_id: 1122, id: 3344)
|
127
|
+
expect(a_request(:delete, url)).to have_been_made
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"items": [
|
3
|
+
{
|
4
|
+
"id": 1122,
|
5
|
+
"name": "North End Volunteers",
|
6
|
+
"description": "Volunteers from the North End that help out frequently"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"id": 1123,
|
10
|
+
"name": "South End Volunteers",
|
11
|
+
"description": "Volunteers from the South End that help out not so frequently"
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"nextPageLink": "https://api.securevan.com:443/v4/supporterGroups?$top=2&$skip=2",
|
15
|
+
"count": 5
|
16
|
+
}
|
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.5.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: 2018-11-
|
39
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/ngp_van/client/people.rb
|
102
102
|
- lib/ngp_van/client/printed_lists.rb
|
103
103
|
- lib/ngp_van/client/signups.rb
|
104
|
+
- lib/ngp_van/client/supporter_groups.rb
|
104
105
|
- lib/ngp_van/client/survey_questions.rb
|
105
106
|
- lib/ngp_van/client/users.rb
|
106
107
|
- lib/ngp_van/configuration.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- spec/ngp_van/client/people_spec.rb
|
124
125
|
- spec/ngp_van/client/printed_lists_spec.rb
|
125
126
|
- spec/ngp_van/client/signups_spec.rb
|
127
|
+
- spec/ngp_van/client/supporter_groups_spec.rb
|
126
128
|
- spec/ngp_van/client/survey_questions_spec.rb
|
127
129
|
- spec/ngp_van/client/users_spec.rb
|
128
130
|
- spec/ngp_van/client_spec.rb
|
@@ -144,6 +146,7 @@ files:
|
|
144
146
|
- spec/support/fixtures/create_event_shift.json
|
145
147
|
- spec/support/fixtures/create_location.json
|
146
148
|
- spec/support/fixtures/create_signup.json
|
149
|
+
- spec/support/fixtures/create_supporter_group.json
|
147
150
|
- spec/support/fixtures/create_user_district_field_values.json
|
148
151
|
- spec/support/fixtures/district_field.json
|
149
152
|
- spec/support/fixtures/district_fields.json
|
@@ -166,6 +169,8 @@ files:
|
|
166
169
|
- spec/support/fixtures/signup.json
|
167
170
|
- spec/support/fixtures/signup_statuses.json
|
168
171
|
- spec/support/fixtures/signups.json
|
172
|
+
- spec/support/fixtures/supporter_group.json
|
173
|
+
- spec/support/fixtures/supporter_groups.json
|
169
174
|
- spec/support/fixtures/survey_question.json
|
170
175
|
- spec/support/fixtures/survey_questions.json
|
171
176
|
- spec/support/fixtures/update_code.json
|
metadata.gz.sig
CHANGED
Binary file
|