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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e359a5f0de2f78b1f404d7262d0adfb63f24ac87
|
4
|
+
data.tar.gz: 8edf31e879a2a1ee69e6fc75b50777614e102db4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0497e399cb50d0ef22fe6b9d9c6adfa599decf5f7a36120f5bc004978a4b922906859403d7c196e285b4b46cac59732e6fa340cbacab389f750d17736ac6156d
|
7
|
+
data.tar.gz: 19dd59a120151cfd9ac3eec9c1de5e67edb851a55249b74fc018f62a25ba80b7fce089ee0943239e82bddeeeb327cea36f2c3e4436e0e6d9a2b82b0714f15ca2
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
���l��������"���zWC�e&�Τ���1�����B��A��;�iW��~u�g�;7�ת��&Lnu��+t"�����:"��zb8IT�z�(d�����e;����Yhd�̛����*A���`)eM�XV��^uC�}�����06[dm�0�E�8�4�r%�qP��`*�饄42't�f)��D�.����K�da�][H�`����Wv�O>�qҗ�S�lR�x}�U�/��Y`�w�ܣHF
|
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# The NGP VAN Ruby Gem
|
2
|
+
|
3
|
+
[](https://circleci.com/gh/christopherstyles/ngp_van) [](https://codeclimate.com/github/christopherstyles/ngp_van/coverage) [](https://codeclimate.com/github/christopherstyles/ngp_van) [](http://inch-ci.org/github/christopherstyles/ngp_van)
|
4
|
+
|
5
|
+
An unofficial Ruby wrapper for the [NGP VAN](http://developers.everyaction.com/) RESTful API.
|
6
|
+
|
7
|
+
## Quick start
|
8
|
+
|
9
|
+
Install via Rubygems:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem install ngp_van
|
13
|
+
```
|
14
|
+
|
15
|
+
Or add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'ngp_van'
|
19
|
+
```
|
20
|
+
|
21
|
+
`ngp_van` is cryptographically signed. To be sure the gem you install hasn’t been tampered with, add my public key as a trusted certificate:
|
22
|
+
|
23
|
+
gem cert --add <(curl -Ls https://raw.github.com/christopherstyles/ngp_van/master/certs/christopherstyles.pem)
|
24
|
+
|
25
|
+
Then install with:
|
26
|
+
|
27
|
+
gem install ngp_van -P MediumSecurity
|
28
|
+
|
29
|
+
or if using bundler:
|
30
|
+
|
31
|
+
bundle install --trust-policy MediumSecurity
|
32
|
+
|
33
|
+
The `MediumSecurity` trust profile will verify signed gems, but allow the installation of unsigned dependencies.
|
34
|
+
|
35
|
+
This is necessary because not all of `ngp_van`s dependencies are signed, so we cannot use `HighSecurity`.
|
36
|
+
|
37
|
+
## Configuration
|
38
|
+
|
39
|
+
NGP VAN can be configured using a block:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
NgpVan.configure do |config|
|
43
|
+
config.application_name = 'MyCampaignApp'
|
44
|
+
|
45
|
+
# See http://developers.everyaction.com/van-api#van-authentication
|
46
|
+
config.api_key = 'de286a1a-f2e7-421a-91b8-f8cc8201558f|1'
|
47
|
+
|
48
|
+
# Defaults to "https://api.securevan.com/v4/"
|
49
|
+
config.api_endpoint = 'https://intlapi.securevan.com/v4'
|
50
|
+
|
51
|
+
# Defaults to "NGP VAN Ruby Gem #{NgpVan::VERSION}"
|
52
|
+
config.user_agent = 'CustomUserAgent'
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
Options can also be set on the configuration object:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
% NgpVan.configuration.api_key = 'de286a1a-f2e7-421a-91b8-f8cc8201558f|1'
|
60
|
+
# => "de286a1a-f2e7-421a-91b8-f8cc8201558f|1"
|
61
|
+
```
|
62
|
+
|
63
|
+
## Making requests
|
64
|
+
|
65
|
+
API Methods can be called as module methods or as instance methods on the client.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
NgpVan.district_fields
|
69
|
+
# => [
|
70
|
+
# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...},
|
71
|
+
# {"districtFieldId"=>4, "name"=>"County", "parentFieldId"=>1...}
|
72
|
+
# ]
|
73
|
+
```
|
74
|
+
|
75
|
+
or
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
client = NpgVan.client
|
79
|
+
client.district_fields
|
80
|
+
# => [
|
81
|
+
# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...},
|
82
|
+
# {"districtFieldId"=>4, "name"=>"County", "parentFieldId"=>1...}
|
83
|
+
# ]
|
84
|
+
```
|
85
|
+
|
86
|
+
## Development
|
87
|
+
|
88
|
+
After checking out the repo, run `rake spec` to run the tests.
|
89
|
+
|
90
|
+
A console task has also been provided to automatically load the NGP VAN environment. Run `bin/console` for an interactive prompt that will allow you to experiment.
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
% bin/console
|
94
|
+
[1] pry(main)> NgpVan::VERSION
|
95
|
+
# => "x.x.x"
|
96
|
+
[2] pry(main)> NgpVan.configuration.application_name = 'MyCampaignApplication'
|
97
|
+
# => "MyCampaignApplication"
|
98
|
+
[3] pry(main)> NgpVan.configuration.api_key = 'de286a1a-f2e7-421a-91b8-f8cc8201558f|1'
|
99
|
+
# => "de286a1a-f2e7-421a-91b8-f8cc8201558f|1"
|
100
|
+
[4] pry(main)> NgpVan.district_fields
|
101
|
+
# => [
|
102
|
+
# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...,
|
103
|
+
# {"districtFieldId"=>2, "name"=>"County", "parentFieldId"=>1...
|
104
|
+
# ]
|
105
|
+
```
|
106
|
+
|
107
|
+
## Contributing
|
108
|
+
|
109
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/christopherstyles/ngp_van/issues.
|
110
|
+
|
111
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
112
|
+
|
113
|
+
|
114
|
+
## License
|
115
|
+
|
116
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
117
|
+
|
data/lib/ngp_van.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ngp_van/client'
|
4
|
+
require 'ngp_van/configuration'
|
5
|
+
require 'ngp_van/version'
|
6
|
+
|
7
|
+
module NgpVan
|
8
|
+
class << self
|
9
|
+
# The NgpVan configuration object.
|
10
|
+
# @return [NgpVan::Configuration]
|
11
|
+
attr_reader :configuration
|
12
|
+
|
13
|
+
def client
|
14
|
+
@client ||= NgpVan::Client.new
|
15
|
+
end
|
16
|
+
|
17
|
+
# Delegate methods called on NgpVan to the client.
|
18
|
+
def method_missing(method_name, *args, &block)
|
19
|
+
return super unless client.respond_to?(method_name)
|
20
|
+
client.send(method_name, *args, &block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# The current configuration.
|
25
|
+
# @return [NgpVan::Configuration]
|
26
|
+
def self.configuration
|
27
|
+
@configuration ||= Configuration.new
|
28
|
+
end
|
29
|
+
|
30
|
+
# Set new configuration
|
31
|
+
# @param config [NgpVan::Configuration]
|
32
|
+
def self.configuration=(config)
|
33
|
+
@configuration = config
|
34
|
+
end
|
35
|
+
|
36
|
+
# Modify the current configuration
|
37
|
+
# @yieldparam [NgpVan::Configuration] config The current NgpVan config
|
38
|
+
# ```
|
39
|
+
# NgpVan.configure do |config|
|
40
|
+
# config.application_name = 'CroninAndSons'
|
41
|
+
# config.api_key = 'af263f2a-86fd-443b-a1b6-f5b7bce8db30|1'
|
42
|
+
# end
|
43
|
+
# ```
|
44
|
+
def self.configure
|
45
|
+
yield configuration
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ngp_van/connection'
|
4
|
+
require 'ngp_van/request'
|
5
|
+
require 'ngp_van/response'
|
6
|
+
require 'ngp_van/client/activist_codes'
|
7
|
+
require 'ngp_van/client/canvass_responses'
|
8
|
+
require 'ngp_van/client/codes'
|
9
|
+
require 'ngp_van/client/district_fields'
|
10
|
+
require 'ngp_van/client/events'
|
11
|
+
require 'ngp_van/client/event_types'
|
12
|
+
require 'ngp_van/client/locations'
|
13
|
+
require 'ngp_van/client/notes'
|
14
|
+
require 'ngp_van/client/people'
|
15
|
+
require 'ngp_van/client/printed_lists'
|
16
|
+
require 'ngp_van/client/minivan_exports'
|
17
|
+
require 'ngp_van/client/signups'
|
18
|
+
require 'ngp_van/client/survey_questions'
|
19
|
+
require 'ngp_van/client/users'
|
20
|
+
|
21
|
+
module NgpVan
|
22
|
+
class Client
|
23
|
+
include NgpVan::Connection
|
24
|
+
include NgpVan::Request
|
25
|
+
include NgpVan::Response
|
26
|
+
include NgpVan::Client::ActivistCodes
|
27
|
+
include NgpVan::Client::CanvassResponses
|
28
|
+
include NgpVan::Client::Codes
|
29
|
+
include NgpVan::Client::DistrictFields
|
30
|
+
include NgpVan::Client::Events
|
31
|
+
include NgpVan::Client::EventTypes
|
32
|
+
include NgpVan::Client::Locations
|
33
|
+
include NgpVan::Client::Notes
|
34
|
+
include NgpVan::Client::People
|
35
|
+
include NgpVan::Client::PrintedLists
|
36
|
+
include NgpVan::Client::MinivanExports
|
37
|
+
include NgpVan::Client::Signups
|
38
|
+
include NgpVan::Client::SurveyQuestions
|
39
|
+
include NgpVan::Client::Users
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module ActivistCodes
|
6
|
+
def activist_codes(params: {})
|
7
|
+
get(path: 'activistCodes', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def activist_code(id:, params: {})
|
11
|
+
get(path: "activistCodes/#{id}", params: params)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module CanvassResponses
|
6
|
+
def canvass_responses_contact_types(params: {})
|
7
|
+
get(path: 'canvassResponses/contactTypes', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def canvass_responses_input_types(params: {})
|
11
|
+
get(path: 'canvassResponses/inputTypes', params: params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def canvass_responses_result_codes(params: {})
|
15
|
+
get(path: 'canvassResponses/resultCodes', params: params)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module Codes
|
6
|
+
def code_supported_entities(params: {})
|
7
|
+
get(path: 'codes/supportedEntities', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def codes(params: {})
|
11
|
+
get(path: 'codes', params: params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def code(id:, params: {})
|
15
|
+
get(path: "codes/#{id}", params: params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_code(body: {})
|
19
|
+
post(path: 'codes', body: body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_code(id:, body: {})
|
23
|
+
put(path: "codes/#{id}", body: body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete_code(id:)
|
27
|
+
delete(path: "codes/#{id}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module DistrictFields
|
6
|
+
def district_fields(params: {})
|
7
|
+
get(path: 'districtFields', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def district_field(id:)
|
11
|
+
get(path: "districtFields/#{id}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module EventTypes
|
6
|
+
def event_types(params: {})
|
7
|
+
get(path: 'events/types', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def event_type(id:, params: {})
|
11
|
+
get(path: "events/types/#{id}", params: params)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module Events
|
6
|
+
def create_event(body: {})
|
7
|
+
post(path: 'events', body: body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_event_shift(id:, body: {})
|
11
|
+
post(path: "events/#{id}/shifts", body: body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def event(id:, params: {})
|
15
|
+
get(path: "events/#{id}", params: params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def events(params: {})
|
19
|
+
get(path: 'events', params: params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_event(id:, body: {})
|
23
|
+
put(path: "events/#{id}", body: body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete_event(id:)
|
27
|
+
delete(path: "events/#{id}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module Locations
|
6
|
+
def locations(params: {})
|
7
|
+
get(path: 'locations', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def location(id:, params: {})
|
11
|
+
get(path: "locations/#{id}", params: params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_or_create_location(body: {})
|
15
|
+
post(path: 'locations/findOrCreate', body: body)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_location(body: {})
|
19
|
+
post(path: 'locations', body: body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_location(id:)
|
23
|
+
delete(path: "locations/#{id}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module MinivanExports
|
6
|
+
def minivan_exports(params: {})
|
7
|
+
get(path: 'minivanExports', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def minivan_export(id:, params: {})
|
11
|
+
get(path: "minivanExports/#{id}", params: params)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module Notes
|
6
|
+
def note_category_types(params: {})
|
7
|
+
get(path: 'notes/categoryTypes', params: params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def note_categories(params: {})
|
11
|
+
get(path: 'notes/categories', params: params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def note_category(id:, params: {})
|
15
|
+
get(path: "notes/categories/#{id}", params: params)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NgpVan
|
4
|
+
class Client
|
5
|
+
module People
|
6
|
+
def find_person(body: {})
|
7
|
+
post(path: 'people/find', body: body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_or_create_person(body: {})
|
11
|
+
post(path: 'people/findOrCreate', body: body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def person(id:, params: {})
|
15
|
+
get(path: "people/#{id}", params: params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def person_by_type(id:, type:, params: {})
|
19
|
+
get(path: "people/#{type}:#{id}", params: params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_canvass_responses_for_person(id:, body: {})
|
23
|
+
post(path: "people/#{id}/canvassResponses", body: body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_canvass_responses_for_person_by_type(id:, type:, body: {})
|
27
|
+
post(path: "people/#{type}:#{id}/canvassResponses", body: body)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|