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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -0
  4. data/README.md +117 -0
  5. data/lib/ngp_van.rb +47 -0
  6. data/lib/ngp_van/client.rb +41 -0
  7. data/lib/ngp_van/client/activist_codes.rb +15 -0
  8. data/lib/ngp_van/client/canvass_responses.rb +19 -0
  9. data/lib/ngp_van/client/codes.rb +31 -0
  10. data/lib/ngp_van/client/district_fields.rb +15 -0
  11. data/lib/ngp_van/client/event_types.rb +15 -0
  12. data/lib/ngp_van/client/events.rb +31 -0
  13. data/lib/ngp_van/client/locations.rb +27 -0
  14. data/lib/ngp_van/client/minivan_exports.rb +15 -0
  15. data/lib/ngp_van/client/notes.rb +19 -0
  16. data/lib/ngp_van/client/people.rb +31 -0
  17. data/lib/ngp_van/client/printed_lists.rb +15 -0
  18. data/lib/ngp_van/client/signups.rb +31 -0
  19. data/lib/ngp_van/client/survey_questions.rb +15 -0
  20. data/lib/ngp_van/client/users.rb +19 -0
  21. data/lib/ngp_van/configuration.rb +74 -0
  22. data/lib/ngp_van/connection.rb +32 -0
  23. data/lib/ngp_van/default.rb +41 -0
  24. data/lib/ngp_van/error.rb +124 -0
  25. data/lib/ngp_van/request.rb +39 -0
  26. data/lib/ngp_van/response.rb +15 -0
  27. data/lib/ngp_van/response/raise_error.rb +17 -0
  28. data/lib/ngp_van/version.rb +19 -0
  29. data/spec/ngp_van/client/activist_codes_spec.rb +88 -0
  30. data/spec/ngp_van/client/canvass_responses_spec.rb +126 -0
  31. data/spec/ngp_van/client/codes_spec.rb +197 -0
  32. data/spec/ngp_van/client/district_fields_spec.rb +79 -0
  33. data/spec/ngp_van/client/event_types_spec.rb +69 -0
  34. data/spec/ngp_van/client/events_spec.rb +205 -0
  35. data/spec/ngp_van/client/locations_spec.rb +172 -0
  36. data/spec/ngp_van/client/minivan_exports_spec.rb +82 -0
  37. data/spec/ngp_van/client/notes_spec.rb +107 -0
  38. data/spec/ngp_van/client/people_spec.rb +227 -0
  39. data/spec/ngp_van/client/printed_lists_spec.rb +91 -0
  40. data/spec/ngp_van/client/signups_spec.rb +209 -0
  41. data/spec/ngp_van/client/survey_questions_spec.rb +83 -0
  42. data/spec/ngp_van/client/users_spec.rb +122 -0
  43. data/spec/ngp_van/configuration_spec.rb +116 -0
  44. data/spec/ngp_van/request_spec.rb +137 -0
  45. data/spec/ngp_van_spec.rb +29 -0
  46. data/spec/spec_helper.rb +11 -0
  47. data/spec/support/fixtures/activist_code.json +10 -0
  48. data/spec/support/fixtures/activist_codes.json +36 -0
  49. data/spec/support/fixtures/canvass_response.json +25 -0
  50. data/spec/support/fixtures/canvass_responses_contact_types.json +10 -0
  51. data/spec/support/fixtures/canvass_responses_input_types.json +26 -0
  52. data/spec/support/fixtures/canvass_responses_result_codes.json +26 -0
  53. data/spec/support/fixtures/code.json +18 -0
  54. data/spec/support/fixtures/code_supported_entities.json +5 -0
  55. data/spec/support/fixtures/codes.json +55 -0
  56. data/spec/support/fixtures/create_code.json +16 -0
  57. data/spec/support/fixtures/create_event.json +62 -0
  58. data/spec/support/fixtures/create_event_shift.json +5 -0
  59. data/spec/support/fixtures/create_location.json +9 -0
  60. data/spec/support/fixtures/create_signup.json +32 -0
  61. data/spec/support/fixtures/create_user_district_field_values.json +7 -0
  62. data/spec/support/fixtures/district_field.json +28 -0
  63. data/spec/support/fixtures/district_fields.json +22 -0
  64. data/spec/support/fixtures/event.json +139 -0
  65. data/spec/support/fixtures/event_type.json +75 -0
  66. data/spec/support/fixtures/event_types.json +77 -0
  67. data/spec/support/fixtures/events.json +86 -0
  68. data/spec/support/fixtures/location.json +19 -0
  69. data/spec/support/fixtures/locations.json +25 -0
  70. data/spec/support/fixtures/match_candidate.json +61 -0
  71. data/spec/support/fixtures/match_response.json +4 -0
  72. data/spec/support/fixtures/minivan_export.json +66 -0
  73. data/spec/support/fixtures/minivan_exports.json +72 -0
  74. data/spec/support/fixtures/note_categories.json +17 -0
  75. data/spec/support/fixtures/note_category.json +8 -0
  76. data/spec/support/fixtures/note_category_types.json +6 -0
  77. data/spec/support/fixtures/person.json +61 -0
  78. data/spec/support/fixtures/printed_list.json +52 -0
  79. data/spec/support/fixtures/printed_lists.json +58 -0
  80. data/spec/support/fixtures/signup.json +55 -0
  81. data/spec/support/fixtures/signup_statuses.json +26 -0
  82. data/spec/support/fixtures/signups.json +112 -0
  83. data/spec/support/fixtures/survey_question.json +36 -0
  84. data/spec/support/fixtures/survey_questions.json +85 -0
  85. data/spec/support/fixtures/update_code.json +22 -0
  86. data/spec/support/fixtures/update_event.json +61 -0
  87. data/spec/support/fixtures/update_signup.json +35 -0
  88. data/spec/support/fixtures/update_user_district_field_values.json +6 -0
  89. data/spec/support/fixtures/user_district_field_values.json +7 -0
  90. data/spec/support/path_helpers.rb +9 -0
  91. data/spec/support/rspec.rb +51 -0
  92. data/spec/support/url_helpers.rb +5 -0
  93. data/spec/support/webmock.rb +5 -0
  94. metadata +269 -0
  95. metadata.gz.sig +0 -0
@@ -0,0 +1,139 @@
1
+ {
2
+ "eventId": 1370,
3
+ "name": "Neighbors Calling Neighbors",
4
+ "shortName": "NeighborCall",
5
+ "description": "Come help get the word out about our great campaign.",
6
+ "startDate": "2015-06-01T15:00:00-04:00",
7
+ "endDate": "2015-06-01T20:00:00-04:00",
8
+ "eventType": {
9
+ "eventTypeId": 143856,
10
+ "name": "Phone Bank"
11
+ },
12
+ "isOnlyEditableByCreatingUser": false,
13
+ "isPubliclyViewable": null,
14
+ "locations": [
15
+ {
16
+ "locationId": 272,
17
+ "name": "Campaign HQ",
18
+ "displayName": "Campaign HQ, 48 Grove St Somerville, MA 02144-2500 ",
19
+ "address": {
20
+ "addressId": null,
21
+ "addressLine1": "48 Grove St",
22
+ "addressLine2": null,
23
+ "addressLine3": null,
24
+ "city": "Somerville",
25
+ "stateOrProvince": "MA",
26
+ "zipOrPostalCode": "02144",
27
+ "geoLocation": {
28
+ "lon": -71.120121,
29
+ "lat": 42.396363
30
+ },
31
+ "countryCode": "US",
32
+ "preview": "48 Grove St \r\nSomerville, MA 02144-2500 ",
33
+ "type": null,
34
+ "isPreferred": null
35
+ },
36
+ "id": 272,
37
+ "notes": null,
38
+ "codes": null
39
+ },
40
+ {
41
+ "locationId": 273,
42
+ "name": "Northwest Regional Field Office",
43
+ "displayName": "Northwest Regional Field Office, 800 Oak St Salem, MA 02111 ",
44
+ "address": {
45
+ "addressId": null,
46
+ "addressLine1": "800 Oak St",
47
+ "addressLine2": null,
48
+ "addressLine3": null,
49
+ "city": "Salem",
50
+ "stateOrProvince": "MA",
51
+ "zipOrPostalCode": "02111",
52
+ "geoLocation": null,
53
+ "countryCode": "US",
54
+ "preview": "800 Oak St \r\nSalem, MA 02111 ",
55
+ "type": null,
56
+ "isPreferred": null
57
+ },
58
+ "id": 273,
59
+ "notes": null,
60
+ "codes": null
61
+ }
62
+ ],
63
+ "codes": [
64
+ {
65
+ "codeId": 20516,
66
+ "parentCodeId": 20513,
67
+ "name": "Seniors",
68
+ "codePath": "",
69
+ "createdByName": "",
70
+ "dateCreated": "2015-04-05T13:00:00Z",
71
+ "supportedEntities": null
72
+ },
73
+ {
74
+ "codeId": 20518,
75
+ "parentCodeId": 20513,
76
+ "name": "Youth",
77
+ "codePath": "",
78
+ "createdByName": "",
79
+ "dateCreated": "2015-04-05T13:02:00Z",
80
+ "supportedEntities": null
81
+ }
82
+ ],
83
+ "notes": [
84
+ {
85
+ "noteId": 6,
86
+ "text": "Sed ut perspiciatis unde omnis iste natus error sit ... qui dolorem eum fugiat quo voluptas nulla pariatur?",
87
+ "isViewRestricted": true,
88
+ "category": null,
89
+ "createdDate": "2015-04-05T13:21:00Z"
90
+ },
91
+ {
92
+ "noteId": 5,
93
+ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut ... deserunt mollit anim id est laborum.",
94
+ "isViewRestricted": false,
95
+ "category": null,
96
+ "createdDate": "2015-04-05T13:20:00Z"
97
+ }
98
+ ],
99
+ "shifts": [
100
+ {
101
+ "eventShiftId": 2162,
102
+ "name": "Setup",
103
+ "startTime": "2015-06-01T15:00:00-04:00",
104
+ "endTime": "2015-06-01T16:00:00-04:00"
105
+ },
106
+ {
107
+ "eventShiftId": 2163,
108
+ "name": "Early Shift",
109
+ "startTime": "2015-06-01T16:00:00-04:00",
110
+ "endTime": "2015-06-01T18:00:00-04:00"
111
+ },
112
+ {
113
+ "eventShiftId": 2164,
114
+ "name": "Late Shift",
115
+ "startTime": "2015-06-01T18:00:00-04:00",
116
+ "endTime": "2015-06-01T20:00:00-04:00"
117
+ }
118
+ ],
119
+ "roles": [
120
+ {
121
+ "roleId": 111687,
122
+ "name": "Host",
123
+ "isEventLead": true,
124
+ "min": null,
125
+ "max": null,
126
+ "goal": null
127
+ },
128
+ {
129
+ "roleId": 111689,
130
+ "name": "Phone Banker",
131
+ "isEventLead": false,
132
+ "min": 5,
133
+ "max": null,
134
+ "goal": 20
135
+ }
136
+ ],
137
+ "districtFieldValue": "003",
138
+ "createdDate": "2015-04-05T13:18:00Z"
139
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "eventTypeId": 143856,
3
+ "name": "Phone Bank",
4
+ "canHaveMultipleShifts": true,
5
+ "canHaveMultipleLocations": true,
6
+ "canHaveGoals": true,
7
+ "canHaveRoleMaximums": false,
8
+ "canHaveRoleMinimums": true,
9
+ "canBeRepeatable": true,
10
+ "roles": [
11
+ {
12
+ "roleId": 111687,
13
+ "name": "Host",
14
+ "isEventLead": true
15
+ },
16
+ {
17
+ "roleId": 111689,
18
+ "name": "Phone Banker",
19
+ "isEventLead": false
20
+ }
21
+ ],
22
+ "statuses": [
23
+ {
24
+ "statusId": 4,
25
+ "name": "Invited"
26
+ },
27
+ {
28
+ "statusId": 1,
29
+ "name": "Scheduled"
30
+ },
31
+ {
32
+ "statusId": 3,
33
+ "name": "Declined"
34
+ },
35
+ {
36
+ "statusId": 11,
37
+ "name": "Confirmed"
38
+ },
39
+ {
40
+ "statusId": 2,
41
+ "name": "Completed"
42
+ },
43
+ {
44
+ "statusId": 15,
45
+ "name": "Walk In"
46
+ }
47
+ ],
48
+ "color": "#C6AFDA",
49
+ "isAtLeastOneLocationRequired": false,
50
+ "defaultLocation": {
51
+ "locationId": 272,
52
+ "name": "Campaign HQ",
53
+ "displayName": "Campaign HQ, 48 Grove St Somerville, MA 02144-2500 ",
54
+ "address": {
55
+ "addressId": null,
56
+ "addressLine1": "48 Grove St",
57
+ "addressLine2": null,
58
+ "addressLine3": null,
59
+ "city": "Somerville",
60
+ "stateOrProvince": "MA",
61
+ "zipOrPostalCode": "02144",
62
+ "geoLocation": {
63
+ "lon": -71.120121,
64
+ "lat": 42.396363
65
+ },
66
+ "countryCode": "US",
67
+ "preview": "48 Grove St \r\nSomerville, MA 02144-2500 ",
68
+ "type": null,
69
+ "isPreferred": null
70
+ },
71
+ "id": 272,
72
+ "notes": null,
73
+ "codes": null
74
+ }
75
+ }
@@ -0,0 +1,77 @@
1
+ [
2
+ {
3
+ "eventTypeId": 143856,
4
+ "name": "Phone Bank",
5
+ "canHaveMultipleShifts": true,
6
+ "canHaveMultipleLocations": true,
7
+ "canHaveGoals": true,
8
+ "canHaveRoleMaximums": false,
9
+ "canHaveRoleMinimums": true,
10
+ "canBeRepeatable": true,
11
+ "roles": [
12
+ {
13
+ "roleId": 111687,
14
+ "name": "Host",
15
+ "isEventLead": true
16
+ },
17
+ {
18
+ "roleId": 111689,
19
+ "name": "Phone Banker",
20
+ "isEventLead": false
21
+ }
22
+ ],
23
+ "statuses": [
24
+ {
25
+ "statusId": 4,
26
+ "name": "Invited"
27
+ },
28
+ {
29
+ "statusId": 1,
30
+ "name": "Scheduled"
31
+ },
32
+ {
33
+ "statusId": 3,
34
+ "name": "Declined"
35
+ },
36
+ {
37
+ "statusId": 11,
38
+ "name": "Confirmed"
39
+ },
40
+ {
41
+ "statusId": 2,
42
+ "name": "Completed"
43
+ },
44
+ {
45
+ "statusId": 15,
46
+ "name": "Walk In"
47
+ }
48
+ ],
49
+ "color": "#C6AFDA",
50
+ "isAtLeastOneLocationRequired": false,
51
+ "defaultLocation": {
52
+ "locationId": 272,
53
+ "name": "Campaign HQ",
54
+ "displayName": "Campaign HQ, 48 Grove St Somerville, MA 02144-2500 ",
55
+ "address": {
56
+ "addressId": null,
57
+ "addressLine1": "48 Grove St",
58
+ "addressLine2": null,
59
+ "addressLine3": null,
60
+ "city": "Somerville",
61
+ "stateOrProvince": "MA",
62
+ "zipOrPostalCode": "02144",
63
+ "geoLocation": {
64
+ "lon": -71.120121,
65
+ "lat": 42.396363
66
+ },
67
+ "countryCode": "US",
68
+ "preview": "48 Grove St \r\nSomerville, MA 02144-2500 ",
69
+ "type": null,
70
+ "isPreferred": null
71
+ },
72
+ "id": 272,
73
+ "notes": null,
74
+ "codes": null
75
+ }
76
+ }
77
+ ]
@@ -0,0 +1,86 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "eventId": 1370,
5
+ "name": "Neighbors Calling Neighbors",
6
+ "shortName": "NeighborCall",
7
+ "description": "Come help get the word out about our great campaign.",
8
+ "startDate": "2015-06-01T15:00:00-04:00",
9
+ "endDate": "2015-06-01T20:00:00-04:00",
10
+ "eventType": {
11
+ "eventTypeId": 143856,
12
+ "name": "Phone Bank"
13
+ },
14
+ "isOnlyEditableByCreatingUser": false,
15
+ "isPubliclyViewable": null,
16
+ "locations": null,
17
+ "codes": null,
18
+ "notes": null,
19
+ "shifts": [
20
+ {
21
+ "eventShiftId": 2162,
22
+ "name": "Setup",
23
+ "startTime": "2015-06-01T15:00:00-04:00",
24
+ "endTime": "2015-06-01T16:00:00-04:00"
25
+ },
26
+ {
27
+ "eventShiftId": 2163,
28
+ "name": "Early Shift",
29
+ "startTime": "2015-06-01T16:00:00-04:00",
30
+ "endTime": "2015-06-01T18:00:00-04:00"
31
+ },
32
+ {
33
+ "eventShiftId": 2164,
34
+ "name": "Late Shift",
35
+ "startTime": "2015-06-01T18:00:00-04:00",
36
+ "endTime": "2015-06-01T20:00:00-04:00"
37
+ }
38
+ ],
39
+ "roles": null,
40
+ "districtFieldValue": "003",
41
+ "createdDate": "2015-04-05T13:18:00Z"
42
+ },
43
+ {
44
+ "eventId": 1371,
45
+ "name": "Neighbors Calling Neighbors",
46
+ "shortName": "NeighborCall",
47
+ "description": "Come help get the word out about our great campaign.",
48
+ "startDate": "2015-06-02T15:00:00-04:00",
49
+ "endDate": "2015-06-02T20:00:00-04:00",
50
+ "eventType": {
51
+ "eventTypeId": 143856,
52
+ "name": "Phone Bank"
53
+ },
54
+ "isOnlyEditableByCreatingUser": false,
55
+ "isPubliclyViewable": null,
56
+ "locations": null,
57
+ "codes": null,
58
+ "notes": null,
59
+ "shifts": [
60
+ {
61
+ "eventShiftId": 2165,
62
+ "name": "Setup",
63
+ "startTime": "2015-06-01T15:00:00-04:00",
64
+ "endTime": "2015-06-01T16:00:00-04:00"
65
+ },
66
+ {
67
+ "eventShiftId": 2166,
68
+ "name": "Early Shift",
69
+ "startTime": "2015-06-01T16:00:00-04:00",
70
+ "endTime": "2015-06-01T18:00:00-04:00"
71
+ },
72
+ {
73
+ "eventShiftId": 2167,
74
+ "name": "Late Shift",
75
+ "startTime": "2015-06-01T18:00:00-04:00",
76
+ "endTime": "2015-06-01T20:00:00-04:00"
77
+ }
78
+ ],
79
+ "roles": null,
80
+ "districtFieldValue": null,
81
+ "createdDate": "2015-04-05T13:45:00Z"
82
+ }
83
+ ],
84
+ "nextPageLink": "https://api.securevan.com:443/v4/events?startingAfter=2015-05-31&$expand=shifts&$top=2&$skip=2",
85
+ "count": 5
86
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "locationId": 272,
3
+ "name": "Campaign HQ",
4
+ "displayName": "Campaign HQ, 48 Grove St Somerville, MA 02144-2500",
5
+ "address": {
6
+ "addressLine1": "48 Grove St",
7
+ "addressLine2": null,
8
+ "addressLine3": null,
9
+ "city": "Somerville",
10
+ "stateOrProvince": "MA",
11
+ "zipOrPostalCode": "02144",
12
+ "geoLocation": {
13
+ "lon": -71.120121,
14
+ "lat": 42.396363
15
+ },
16
+ "countryCode": "US",
17
+ "preview": "48 Grove St \r\nSomerville, MA 02144-2500"
18
+ }
19
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "locationId": 272,
5
+ "name": "Campaign HQ",
6
+ "displayName": "Campaign HQ, 48 Grove St Somerville, MA 02144-2500",
7
+ "address": {
8
+ "addressLine1": "48 Grove St",
9
+ "addressLine2": null,
10
+ "addressLine3": null,
11
+ "city": "Somerville",
12
+ "stateOrProvince": "MA",
13
+ "zipOrPostalCode": "02144",
14
+ "geoLocation": {
15
+ "lon": -71.120121,
16
+ "lat": 42.396363
17
+ },
18
+ "countryCode": "US",
19
+ "preview": "48 Grove St \r\nSomerville, MA 02144-2500"
20
+ }
21
+ }
22
+ ],
23
+ "nextPageLink": null,
24
+ "count": 1
25
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "vanId": 1234,
3
+ "firstName": "James",
4
+ "middleName": "Worthington",
5
+ "lastName": "Gordon",
6
+ "emails": [
7
+ {
8
+ "email": "jim@gotham.city.us",
9
+ "type": "P",
10
+ "isPreferred": true
11
+ },
12
+ {
13
+ "email": "jim@fake.ngpvan.com",
14
+ "type": "W",
15
+ "isPreferred": false
16
+ }
17
+ ],
18
+ "phones": [
19
+ {
20
+ "phoneNumber": "1-555-888-9999",
21
+ "phoneType": "H",
22
+ "isPreferred": true
23
+ },
24
+ {
25
+ "phoneNumber": "1-555-555-1234",
26
+ "phoneType": "W",
27
+ "ext": 999,
28
+ "isPreferred": false
29
+ }
30
+ ],
31
+ "addresses": [
32
+ {
33
+ "addressLine1": "123 Main St",
34
+ "addressLine2": "Apt 3",
35
+ "addressLine3": "c/o Jane Smith",
36
+ "city": "Gotham City",
37
+ "stateOrProvince": "IL",
38
+ "zipOrPostalCode": "01234",
39
+ "countryCode": "US",
40
+ "type": "H",
41
+ "isPreferred": true
42
+ },
43
+ {
44
+ "addressLine1": "555 Elm St",
45
+ "addressLine2": "Suite 101",
46
+ "addressLine3": "Marketing Department",
47
+ "city": "Springfield",
48
+ "stateOrProvince": "IL",
49
+ "zipOrPostalCode": "01234",
50
+ "countryCode": "US",
51
+ "type": "W",
52
+ "isPreferred": false
53
+ }
54
+ ],
55
+ "identifiers": [
56
+ {
57
+ "type": "bsdid",
58
+ "externalId": "746313"
59
+ }
60
+ ]
61
+ }