ngp_van 0.5.0 → 0.6.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: 56d7e5c4dead43ca39fae5067a833f1e0b02fbe3d0368063070a97b6ca1506dc
4
- data.tar.gz: b0199579935ae12dc660c011300e97629deccd9732ec3c83661b7b4e5435e668
3
+ metadata.gz: ccb2039be63263fbefef7442a15d89a5a282955065e7f511b277f6568fcf93ec
4
+ data.tar.gz: e50582b396dd4820e85edb297a384887f720742bea7803c9fd8468d47391751f
5
5
  SHA512:
6
- metadata.gz: 0eb470d707c3bca33acb265209723bdc840993164ae2cb34fde4faf78d6e04799ee0f0f1c9be70754bb40121d3a1d69be11b217deb634df8dd5ab3bd2e3a1217
7
- data.tar.gz: '0859eacce369cb8361feaa8455dfec4e9d51ba23a4cb214509f097e2fc9b879eb19f2423d506a690205f0f4f88b583ac498ea4001fb08468c48a65412067386d'
6
+ metadata.gz: d6879c125fe459db80cd6b349484b1440bb00b5de20939b54f63cd407f7a5d33f199dc7e5eb7baa4e513f6162e7dd81dbe9f93c2721cbba2f600e5d513d92fd9
7
+ data.tar.gz: 1a6f0f9a61b96f852cffdc2ed8c745e4538a6b64618bae4bb6dcda69f0ab01d9534189a721ac452f2398b274dbb1ab843c2f847dff2161f1c773f20df40c8f4b
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -6,6 +6,7 @@ require 'ngp_van/response'
6
6
  require 'ngp_van/client/activist_codes'
7
7
  require 'ngp_van/client/canvass_responses'
8
8
  require 'ngp_van/client/codes'
9
+ require 'ngp_van/client/demographics'
9
10
  require 'ngp_van/client/district_fields'
10
11
  require 'ngp_van/client/echoes'
11
12
  require 'ngp_van/client/events'
@@ -37,6 +38,7 @@ module NgpVan
37
38
  include NgpVan::Client::ActivistCodes
38
39
  include NgpVan::Client::CanvassResponses
39
40
  include NgpVan::Client::Codes
41
+ include NgpVan::Client::Demographics
40
42
  include NgpVan::Client::DistrictFields
41
43
  include NgpVan::Client::Echoes
42
44
  include NgpVan::Client::Events
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NgpVan
4
+ class Client
5
+ module Demographics
6
+ def reported_races(params: {})
7
+ get(path: 'reportedRaces', params: params)
8
+ end
9
+
10
+ def reported_ethnicities(params: {})
11
+ get(path: 'reportedEthnicities', params: params)
12
+ end
13
+
14
+ def reported_language_preferences(params: {})
15
+ get(path: 'reportedLanguagePreferences', params: params)
16
+ end
17
+
18
+ def reported_sexual_orientations(params: {})
19
+ get(path: 'reportedSexualOrientations', params: params)
20
+ end
21
+
22
+ def reported_genders(params: {})
23
+ get(path: 'reportedGenders', params: params)
24
+ end
25
+
26
+ def pronouns(params: {})
27
+ get(path: 'pronouns', params: params)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -7,7 +7,7 @@ module NgpVan
7
7
 
8
8
  # Current minor release.
9
9
  # @return [Integer]
10
- MINOR = 5
10
+ MINOR = 6
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
@@ -0,0 +1,164 @@
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 Demographics do
9
+ let(:client) { NgpVan::Client.new }
10
+
11
+ let(:params) do
12
+ {
13
+ '$top' => 2
14
+ }
15
+ end
16
+
17
+ before do
18
+ stub_request(:get, url)
19
+ .with(query: params)
20
+ .to_return(
21
+ body: response
22
+ )
23
+ end
24
+
25
+ describe '#reported_races' do
26
+ let(:response) { fixture('reported_races.json') }
27
+ let(:url) { build_url(client: client, path: 'reportedRaces') }
28
+
29
+ it 'requests the correct resource' do
30
+ client.reported_races(params: params)
31
+ expect(
32
+ a_request(:get, url)
33
+ .with(query: params)
34
+ ).to have_been_made
35
+ end
36
+
37
+ it 'returns an array of items' do
38
+ reported_races = client.reported_races(params: params)
39
+ expect(reported_races['items']).to be_a(Array)
40
+ end
41
+
42
+ it 'returns the requested data' do
43
+ reported_races = client.reported_races(params: params)
44
+ expect(reported_races['items'].first['reportedRaceId']).to eq(2)
45
+ end
46
+ end
47
+
48
+ describe '#reported_ethnicities' do
49
+ let(:response) { fixture('reported_ethnicities.json') }
50
+ let(:url) { build_url(client: client, path: 'reportedEthnicities') }
51
+
52
+ it 'requests the correct resource' do
53
+ client.reported_ethnicities(params: params)
54
+ expect(
55
+ a_request(:get, url)
56
+ .with(query: params)
57
+ ).to have_been_made
58
+ end
59
+
60
+ it 'returns an array of items' do
61
+ reported_ethnicities = client.reported_ethnicities(params: params)
62
+ expect(reported_ethnicities['items']).to be_a(Array)
63
+ end
64
+
65
+ it 'returns the requested data' do
66
+ reported_ethnicities = client.reported_ethnicities(params: params)
67
+ expect(reported_ethnicities['items'].first['reportedEthnicityId']).to eq(2)
68
+ end
69
+ end
70
+
71
+ describe '#reported_language_preferences' do
72
+ let(:response) { fixture('reported_language_preferences.json') }
73
+ let(:url) { build_url(client: client, path: 'reportedLanguagePreferences') }
74
+
75
+ it 'requests the correct resource' do
76
+ client.reported_language_preferences(params: params)
77
+ expect(
78
+ a_request(:get, url)
79
+ .with(query: params)
80
+ ).to have_been_made
81
+ end
82
+
83
+ it 'returns an array of items' do
84
+ languages = client.reported_language_preferences(params: params)
85
+ expect(languages['items']).to be_a(Array)
86
+ end
87
+
88
+ it 'returns the requested data' do
89
+ languages = client.reported_language_preferences(params: params)
90
+ expect(languages['items'].first['reportedLanguagePreferenceId']).to eq(2)
91
+ end
92
+ end
93
+
94
+ describe '#reported_sexual_orientations' do
95
+ let(:response) { fixture('reported_sexual_orientations.json') }
96
+ let(:url) { build_url(client: client, path: 'reportedSexualOrientations') }
97
+
98
+ it 'requests the correct resource' do
99
+ client.reported_sexual_orientations(params: params)
100
+ expect(
101
+ a_request(:get, url)
102
+ .with(query: params)
103
+ ).to have_been_made
104
+ end
105
+
106
+ it 'returns an array of items' do
107
+ reported_sexual_orientations = client.reported_sexual_orientations(params: params)
108
+ expect(reported_sexual_orientations['items']).to be_a(Array)
109
+ end
110
+
111
+ it 'returns the requested data' do
112
+ reported_sexual_orientations = client.reported_sexual_orientations(params: params)
113
+ expect(reported_sexual_orientations['items'].first['reportedSexualOrientationId']).to eq(2)
114
+ end
115
+ end
116
+
117
+ describe '#reported_genders' do
118
+ let(:response) { fixture('reported_genders.json') }
119
+ let(:url) { build_url(client: client, path: 'reportedGenders') }
120
+
121
+ it 'requests the correct resource' do
122
+ client.reported_genders(params: params)
123
+ expect(
124
+ a_request(:get, url)
125
+ .with(query: params)
126
+ ).to have_been_made
127
+ end
128
+
129
+ it 'returns an array of items' do
130
+ reported_genders = client.reported_genders(params: params)
131
+ expect(reported_genders['items']).to be_a(Array)
132
+ end
133
+
134
+ it 'returns the requested data' do
135
+ reported_genders = client.reported_genders(params: params)
136
+ expect(reported_genders['items'].first['reportedGenderId']).to eq(19)
137
+ end
138
+ end
139
+
140
+ describe '#pronouns' do
141
+ let(:response) { fixture('pronouns.json') }
142
+ let(:url) { build_url(client: client, path: 'pronouns') }
143
+
144
+ it 'requests the correct resource' do
145
+ client.pronouns(params: params)
146
+ expect(
147
+ a_request(:get, url)
148
+ .with(query: params)
149
+ ).to have_been_made
150
+ end
151
+
152
+ it 'returns an array of items' do
153
+ pronouns = client.pronouns(params: params)
154
+ expect(pronouns['items']).to be_a(Array)
155
+ end
156
+
157
+ it 'returns the requested data' do
158
+ pronouns = client.pronouns(params: params)
159
+ expect(pronouns['items'].first['preferredPronounId']).to eq(6)
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "preferredPronounId": 6,
5
+ "preferredPronounName": "E/Em/Eirs"
6
+ },
7
+ {
8
+ "preferredPronounId": 7,
9
+ "preferredPronounName": "Ey/Em/Eirs"
10
+ },
11
+ {
12
+ "preferredPronounId": 2,
13
+ "preferredPronounName": "He/Him/His"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/pronouns?$top=3&$skip=4",
17
+ "count": 14
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "reportedEthnicityId": 2,
5
+ "reportedEthnicityName": "Arab"
6
+ },
7
+ {
8
+ "reportedEthnicityId": 3,
9
+ "reportedEthnicityName": "Asian Indian"
10
+ },
11
+ {
12
+ "reportedEthnicityId": 4,
13
+ "reportedEthnicityName": "Bangladeshi"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/reportedEthnicities?$top=3&$skip=4",
17
+ "count": 20
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "reportedGenderId": 19,
5
+ "reportedGenderName": "Androgyne"
6
+ },
7
+ {
8
+ "reportedGenderId": 1,
9
+ "reportedGenderName": "Androgynous"
10
+ },
11
+ {
12
+ "reportedGenderId": 20,
13
+ "reportedGenderName": "Bigender"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/reportedGenders?$top=3&$skip=4",
17
+ "count": 49
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "reportedLanguagePreferenceId": 2,
5
+ "reportedLanguagePreferenceName": "Cantonese"
6
+ },
7
+ {
8
+ "reportedLanguagePreferenceId": 3,
9
+ "reportedLanguagePreferenceName": "English"
10
+ },
11
+ {
12
+ "reportedLanguagePreferenceId": 4,
13
+ "reportedLanguagePreferenceName": "French"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/reportedLanguagePreferences?$top=3&$skip=4",
17
+ "count": 20
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "reportedRaceId": 2,
5
+ "reportedRaceName": "Black or African American"
6
+ },
7
+ {
8
+ "reportedRaceId": 3,
9
+ "reportedRaceName": "Caucasian or White"
10
+ },
11
+ {
12
+ "reportedRaceId": 4,
13
+ "reportedRaceName": "Native American"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/reportedRaces?$top=3&$skip=4",
17
+ "count": 7
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "items": [
3
+ {
4
+ "reportedSexualOrientationId": 2,
5
+ "reportedSexualOrientationName": "Androsexual"
6
+ },
7
+ {
8
+ "reportedSexualOrientationId": 3,
9
+ "reportedSexualOrientationName": "Asexual"
10
+ },
11
+ {
12
+ "reportedSexualOrientationId": 4,
13
+ "reportedSexualOrientationName": "Autosexual"
14
+ }
15
+ ],
16
+ "nextPageLink": "https://api.securevan.com/v4/reportedSexualOrientations?$top=3&$skip=4",
17
+ "count": 22
18
+ }
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.5.0
4
+ version: 0.6.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-28 00:00:00.000000000 Z
39
+ date: 2019-02-27 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
@@ -91,6 +91,7 @@ files:
91
91
  - lib/ngp_van/client/activist_codes.rb
92
92
  - lib/ngp_van/client/canvass_responses.rb
93
93
  - lib/ngp_van/client/codes.rb
94
+ - lib/ngp_van/client/demographics.rb
94
95
  - lib/ngp_van/client/district_fields.rb
95
96
  - lib/ngp_van/client/echoes.rb
96
97
  - lib/ngp_van/client/event_types.rb
@@ -115,6 +116,7 @@ files:
115
116
  - spec/ngp_van/client/activist_codes_spec.rb
116
117
  - spec/ngp_van/client/canvass_responses_spec.rb
117
118
  - spec/ngp_van/client/codes_spec.rb
119
+ - spec/ngp_van/client/demographics_spec.rb
118
120
  - spec/ngp_van/client/district_fields_spec.rb
119
121
  - spec/ngp_van/client/event_types_spec.rb
120
122
  - spec/ngp_van/client/events_spec.rb
@@ -166,6 +168,12 @@ files:
166
168
  - spec/support/fixtures/person.json
167
169
  - spec/support/fixtures/printed_list.json
168
170
  - spec/support/fixtures/printed_lists.json
171
+ - spec/support/fixtures/pronouns.json
172
+ - spec/support/fixtures/reported_ethnicities.json
173
+ - spec/support/fixtures/reported_genders.json
174
+ - spec/support/fixtures/reported_language_preferences.json
175
+ - spec/support/fixtures/reported_races.json
176
+ - spec/support/fixtures/reported_sexual_orientations.json
169
177
  - spec/support/fixtures/signup.json
170
178
  - spec/support/fixtures/signup_statuses.json
171
179
  - spec/support/fixtures/signups.json
@@ -201,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
209
  - !ruby/object:Gem::Version
202
210
  version: '0'
203
211
  requirements: []
204
- rubyforge_project:
205
- rubygems_version: 2.7.6
212
+ rubygems_version: 3.0.2
206
213
  signing_key:
207
214
  specification_version: 4
208
215
  summary: Ruby wrapper for the NGP VAN API
metadata.gz.sig CHANGED
Binary file