ngp_van 0.1.1
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -0
- data/README.md +117 -0
- data/lib/ngp_van.rb +47 -0
- data/lib/ngp_van/client.rb +41 -0
- data/lib/ngp_van/client/activist_codes.rb +15 -0
- data/lib/ngp_van/client/canvass_responses.rb +19 -0
- data/lib/ngp_van/client/codes.rb +31 -0
- data/lib/ngp_van/client/district_fields.rb +15 -0
- data/lib/ngp_van/client/event_types.rb +15 -0
- data/lib/ngp_van/client/events.rb +31 -0
- data/lib/ngp_van/client/locations.rb +27 -0
- data/lib/ngp_van/client/minivan_exports.rb +15 -0
- data/lib/ngp_van/client/notes.rb +19 -0
- data/lib/ngp_van/client/people.rb +31 -0
- data/lib/ngp_van/client/printed_lists.rb +15 -0
- data/lib/ngp_van/client/signups.rb +31 -0
- data/lib/ngp_van/client/survey_questions.rb +15 -0
- data/lib/ngp_van/client/users.rb +19 -0
- data/lib/ngp_van/configuration.rb +74 -0
- data/lib/ngp_van/connection.rb +32 -0
- data/lib/ngp_van/default.rb +41 -0
- data/lib/ngp_van/error.rb +124 -0
- data/lib/ngp_van/request.rb +39 -0
- data/lib/ngp_van/response.rb +15 -0
- data/lib/ngp_van/response/raise_error.rb +17 -0
- data/lib/ngp_van/version.rb +19 -0
- data/spec/ngp_van/client/activist_codes_spec.rb +88 -0
- data/spec/ngp_van/client/canvass_responses_spec.rb +126 -0
- data/spec/ngp_van/client/codes_spec.rb +197 -0
- data/spec/ngp_van/client/district_fields_spec.rb +79 -0
- data/spec/ngp_van/client/event_types_spec.rb +69 -0
- data/spec/ngp_van/client/events_spec.rb +205 -0
- data/spec/ngp_van/client/locations_spec.rb +172 -0
- data/spec/ngp_van/client/minivan_exports_spec.rb +82 -0
- data/spec/ngp_van/client/notes_spec.rb +107 -0
- data/spec/ngp_van/client/people_spec.rb +227 -0
- data/spec/ngp_van/client/printed_lists_spec.rb +91 -0
- data/spec/ngp_van/client/signups_spec.rb +209 -0
- data/spec/ngp_van/client/survey_questions_spec.rb +83 -0
- data/spec/ngp_van/client/users_spec.rb +122 -0
- data/spec/ngp_van/configuration_spec.rb +116 -0
- data/spec/ngp_van/request_spec.rb +137 -0
- data/spec/ngp_van_spec.rb +29 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/fixtures/activist_code.json +10 -0
- data/spec/support/fixtures/activist_codes.json +36 -0
- data/spec/support/fixtures/canvass_response.json +25 -0
- data/spec/support/fixtures/canvass_responses_contact_types.json +10 -0
- data/spec/support/fixtures/canvass_responses_input_types.json +26 -0
- data/spec/support/fixtures/canvass_responses_result_codes.json +26 -0
- data/spec/support/fixtures/code.json +18 -0
- data/spec/support/fixtures/code_supported_entities.json +5 -0
- data/spec/support/fixtures/codes.json +55 -0
- data/spec/support/fixtures/create_code.json +16 -0
- data/spec/support/fixtures/create_event.json +62 -0
- data/spec/support/fixtures/create_event_shift.json +5 -0
- data/spec/support/fixtures/create_location.json +9 -0
- data/spec/support/fixtures/create_signup.json +32 -0
- data/spec/support/fixtures/create_user_district_field_values.json +7 -0
- data/spec/support/fixtures/district_field.json +28 -0
- data/spec/support/fixtures/district_fields.json +22 -0
- data/spec/support/fixtures/event.json +139 -0
- data/spec/support/fixtures/event_type.json +75 -0
- data/spec/support/fixtures/event_types.json +77 -0
- data/spec/support/fixtures/events.json +86 -0
- data/spec/support/fixtures/location.json +19 -0
- data/spec/support/fixtures/locations.json +25 -0
- data/spec/support/fixtures/match_candidate.json +61 -0
- data/spec/support/fixtures/match_response.json +4 -0
- data/spec/support/fixtures/minivan_export.json +66 -0
- data/spec/support/fixtures/minivan_exports.json +72 -0
- data/spec/support/fixtures/note_categories.json +17 -0
- data/spec/support/fixtures/note_category.json +8 -0
- data/spec/support/fixtures/note_category_types.json +6 -0
- data/spec/support/fixtures/person.json +61 -0
- data/spec/support/fixtures/printed_list.json +52 -0
- data/spec/support/fixtures/printed_lists.json +58 -0
- data/spec/support/fixtures/signup.json +55 -0
- data/spec/support/fixtures/signup_statuses.json +26 -0
- data/spec/support/fixtures/signups.json +112 -0
- data/spec/support/fixtures/survey_question.json +36 -0
- data/spec/support/fixtures/survey_questions.json +85 -0
- data/spec/support/fixtures/update_code.json +22 -0
- data/spec/support/fixtures/update_event.json +61 -0
- data/spec/support/fixtures/update_signup.json +35 -0
- data/spec/support/fixtures/update_user_district_field_values.json +6 -0
- data/spec/support/fixtures/user_district_field_values.json +7 -0
- data/spec/support/path_helpers.rb +9 -0
- data/spec/support/rspec.rb +51 -0
- data/spec/support/url_helpers.rb +5 -0
- data/spec/support/webmock.rb +5 -0
- metadata +269 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe NgpVan do
|
6
|
+
it 'has a version number' do
|
7
|
+
expect(NgpVan::VERSION).to_not be nil
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.client' do
|
11
|
+
it 'creates a new NgpVan::Client' do
|
12
|
+
expect(NgpVan.client).to be_instance_of(NgpVan::Client)
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when @client has been previously assigned' do
|
16
|
+
it 'returns the @client' do
|
17
|
+
client = NgpVan.client
|
18
|
+
expect(NgpVan.client).to eq(client)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'delegates methods to the client' do
|
24
|
+
client = double(people: true)
|
25
|
+
allow(NgpVan).to receive(:client).and_return(client)
|
26
|
+
expect(client).to receive(:people)
|
27
|
+
NgpVan.people
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'codeclimate-test-reporter'
|
4
|
+
CodeClimate::TestReporter.start
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
7
|
+
|
8
|
+
require 'ngp_van'
|
9
|
+
require 'faker'
|
10
|
+
|
11
|
+
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"activistCodeId": 3202,
|
3
|
+
"type": "Visibility",
|
4
|
+
"name": "Yard Sign",
|
5
|
+
"mediumName": "Yard sign",
|
6
|
+
"shortName": "YS",
|
7
|
+
"description": "Voter requested yard sign",
|
8
|
+
"scriptQuestion": "Would you be interested in having a yard sign in support of Democratic candidates?",
|
9
|
+
"status": "Active"
|
10
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"items": [
|
3
|
+
{
|
4
|
+
"activistCodeId": 3214,
|
5
|
+
"type": "Volunteer",
|
6
|
+
"name": "Precinct Captain",
|
7
|
+
"mediumName": "P Capt",
|
8
|
+
"shortName": "PC",
|
9
|
+
"description": "Precinct Captain",
|
10
|
+
"scriptQuestion": "Would you be willing to be a Precinct Captain?",
|
11
|
+
"status": "Active"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"activistCodeId": 8009,
|
15
|
+
"type": "Volunteer",
|
16
|
+
"name": "Stand Out",
|
17
|
+
"mediumName": "Stand Out",
|
18
|
+
"shortName": "SO",
|
19
|
+
"description": null,
|
20
|
+
"scriptQuestion": null,
|
21
|
+
"status": "Archived"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"activistCodeId": 36222,
|
25
|
+
"type": "Volunteer",
|
26
|
+
"name": "Supporter",
|
27
|
+
"mediumName": "Supporter",
|
28
|
+
"shortName": "Sup",
|
29
|
+
"description": null,
|
30
|
+
"scriptQuestion": null,
|
31
|
+
"status": "Active"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"nextPageLink": null,
|
35
|
+
"count": 3
|
36
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"canvassContext": {
|
3
|
+
"contactTypeId": 2,
|
4
|
+
"inputTypeId": 14,
|
5
|
+
"dateCanvassed": "2012-04-09T00:00:00-04:00"
|
6
|
+
},
|
7
|
+
"resultCodeId": null,
|
8
|
+
"responses": [
|
9
|
+
{
|
10
|
+
"activistCodeId": 18917,
|
11
|
+
"action": "Apply",
|
12
|
+
"type": "ActivistCode"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"volunteerActivityId": 3425,
|
16
|
+
"action": "Apply",
|
17
|
+
"type": "VolunteerActivity"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"surveyQuestionId": 109149,
|
21
|
+
"surveyResponseId": 465468,
|
22
|
+
"type": "SurveyResponse"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"inputTypeId": 11,
|
4
|
+
"name": "API"
|
5
|
+
},
|
6
|
+
{
|
7
|
+
"inputTypeId": 4,
|
8
|
+
"name": "Bulk"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"inputTypeId": 2,
|
12
|
+
"name": "Manual"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"inputTypeId": 14,
|
16
|
+
"name": "Mobile"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"inputTypeId": 10,
|
20
|
+
"name": "VPB"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"inputTypeId": 23,
|
24
|
+
"name": "Website"
|
25
|
+
}
|
26
|
+
]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"resultCodeId": 18,
|
4
|
+
"name": "Busy",
|
5
|
+
"mediumName": "Busy",
|
6
|
+
"shortName": "BZ"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"resultCodeId": 25,
|
10
|
+
"name": "Disconnected",
|
11
|
+
"mediumName": "Disc",
|
12
|
+
"shortName": "WX"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"resultCodeId": 19,
|
16
|
+
"name": "Left Message",
|
17
|
+
"mediumName": "LM",
|
18
|
+
"shortName": "LM"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"resultCodeId": 20,
|
22
|
+
"name": "Wrong Number",
|
23
|
+
"mediumName": "Wr#",
|
24
|
+
"shortName": "WN"
|
25
|
+
}
|
26
|
+
]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"codeId": 20515,
|
3
|
+
"parentCodeId": 20513,
|
4
|
+
"name": "Labor",
|
5
|
+
"dateCreated": "2015-04-05T12:59:00Z",
|
6
|
+
"supportedEntities": [
|
7
|
+
{
|
8
|
+
"name": "Events",
|
9
|
+
"isSearchable": true,
|
10
|
+
"isApplicable": true
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "Locations",
|
14
|
+
"isSearchable": true,
|
15
|
+
"isApplicable": false
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"items": [
|
3
|
+
{
|
4
|
+
"codeId": 20514,
|
5
|
+
"parentCodeId": 20513,
|
6
|
+
"name": "LGBT",
|
7
|
+
"dateCreated": "2015-04-05T12:59:00Z",
|
8
|
+
"supportedEntities": [
|
9
|
+
{
|
10
|
+
"name": "Events",
|
11
|
+
"isSearchable": true,
|
12
|
+
"isApplicable": true
|
13
|
+
}
|
14
|
+
]
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"codeId": 20515,
|
18
|
+
"parentCodeId": 20513,
|
19
|
+
"name": "Labor",
|
20
|
+
"dateCreated": "2015-04-05T12:59:00Z",
|
21
|
+
"supportedEntities": [
|
22
|
+
{
|
23
|
+
"name": "Organizations",
|
24
|
+
"isSearchable": true,
|
25
|
+
"isApplicable": false
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"name": "Events",
|
29
|
+
"isSearchable": true,
|
30
|
+
"isApplicable": true
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"name": "Locations",
|
34
|
+
"isSearchable": true,
|
35
|
+
"isApplicable": false
|
36
|
+
}
|
37
|
+
]
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"codeId": 20516,
|
41
|
+
"parentCodeId": 20513,
|
42
|
+
"name": "Seniors",
|
43
|
+
"dateCreated": "2015-04-05T13:00:00Z",
|
44
|
+
"supportedEntities": [
|
45
|
+
{
|
46
|
+
"name": "Events",
|
47
|
+
"isSearchable": true,
|
48
|
+
"isApplicable": true
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
52
|
+
],
|
53
|
+
"nextPageLink": "https://api.securevan.com:443/v4/codes?parentCodeId=20513&$expand=supportedEntities&$top=3&$skip=3",
|
54
|
+
"count": 5
|
55
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"name": "Neighbors Calling Neighbors",
|
3
|
+
"shortName": "NeighborCall",
|
4
|
+
"description": "Come help get the word out about our great campaign.",
|
5
|
+
"startDate": "2015-06-02T15:00:00-04:00",
|
6
|
+
"endDate": "2015-06-02T20:00:00-04:00",
|
7
|
+
"eventType": {
|
8
|
+
"eventTypeId": 143856
|
9
|
+
},
|
10
|
+
"isOnlyEditableByCreatingUser": false,
|
11
|
+
"locations": [
|
12
|
+
{
|
13
|
+
"locationId": 273
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"codes": [
|
17
|
+
{
|
18
|
+
"codeId": 20516
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"codeId": 20518
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"notes": [
|
25
|
+
{
|
26
|
+
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit...",
|
27
|
+
"isViewRestricted": true
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"shifts": [
|
31
|
+
{
|
32
|
+
"name": "Setup",
|
33
|
+
"startTime": "2015-06-01T15:00:00-04:00",
|
34
|
+
"endTime": "2015-06-01T16:00:00-04:00"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"name": "Early Shift",
|
38
|
+
"startTime": "2015-06-01T16:00:00-04:00",
|
39
|
+
"endTime": "2015-06-01T18:00:00-04:00"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"name": "Late Shift",
|
43
|
+
"startTime": "2015-06-01T18:00:00-04:00",
|
44
|
+
"endTime": "2015-06-01T20:00:00-04:00"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
"roles": [
|
48
|
+
{
|
49
|
+
"roleId": 111687,
|
50
|
+
"name": "Host",
|
51
|
+
"isEventLead": true
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"roleId": 111689,
|
55
|
+
"name": "Phone Banker",
|
56
|
+
"isEventLead": false,
|
57
|
+
"min": 5,
|
58
|
+
"goal": 20
|
59
|
+
}
|
60
|
+
],
|
61
|
+
"districtFieldValue": "003"
|
62
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"person": {
|
3
|
+
"vanId": 100476252
|
4
|
+
},
|
5
|
+
"event": {
|
6
|
+
"eventId": 1370
|
7
|
+
},
|
8
|
+
"shift": {
|
9
|
+
"eventShiftId": 2162
|
10
|
+
},
|
11
|
+
"role": {
|
12
|
+
"roleId": 111687
|
13
|
+
},
|
14
|
+
"status": {
|
15
|
+
"statusId": 4
|
16
|
+
},
|
17
|
+
"location": {
|
18
|
+
"locationId": 272
|
19
|
+
},
|
20
|
+
"printedLists": [{
|
21
|
+
"number": "16531169-91998"
|
22
|
+
}, {
|
23
|
+
"number": "16531169-91999"
|
24
|
+
}],
|
25
|
+
"minivanExports": [{
|
26
|
+
"minivanExportId": 2186,
|
27
|
+
"databaseMode": 0
|
28
|
+
}, {
|
29
|
+
"minivanExportId": 2187,
|
30
|
+
"databaseMode": 1
|
31
|
+
}]
|
32
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"districtFieldId": 999,
|
3
|
+
"name": "State House",
|
4
|
+
"parentFieldId": 888,
|
5
|
+
"isCustomDistrict": false,
|
6
|
+
"districtFieldValues": [
|
7
|
+
{
|
8
|
+
"id": "10",
|
9
|
+
"name": "Jackson County District 10",
|
10
|
+
"parentId": "1234"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"id": "11",
|
14
|
+
"name": "Jackson County District 11",
|
15
|
+
"parentId": "1234"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"id": "12",
|
19
|
+
"name": "Jackson County District 12",
|
20
|
+
"parentId": "1234"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"id": "20",
|
24
|
+
"name": "Jefferson County District 20",
|
25
|
+
"parentId": "2345"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"districts": [
|
3
|
+
{
|
4
|
+
"districtFieldId": 888,
|
5
|
+
"name": "State Senate",
|
6
|
+
"parentFieldId": null,
|
7
|
+
"isCustomDistrict": false
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"districtFieldId": 889,
|
11
|
+
"name": "State House",
|
12
|
+
"parentFieldId": 888,
|
13
|
+
"isCustomDistrict": false
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"districtFieldId": 900,
|
17
|
+
"name": "Minnesota Regions",
|
18
|
+
"parentFieldId": null,
|
19
|
+
"isCustomDistrict": true
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|