nationbuilder-rb 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,42 +2,46 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://organizeralexandreschmitt.nationbuilder.com/api/v1/people?access_token=03c22256c06ed11f6bee83673addf26e02a86caa1a5127f4e0815be7223fe4a3
5
+ uri: https://testnation.nationbuilder.com/api/v1/people
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"person":{"email":"bob@example.com","last_name":"Smith","first_name":"Bob"},"access_token":"03c22256c06ed11f6bee83673addf26e02a86caa1a5127f4e0815be7223fe4a3"}'
8
+ string: '{"person":{"email":"bob@example.com","last_name":"Smith","first_name":"Bob"}}'
9
9
  headers:
10
10
  User-Agent:
11
- - HTTPClient/1.0 (2.7.0.1, ruby 2.1.6 (2015-04-13))
11
+ - HTTPClient/1.0 (2.7.0.1, ruby 2.5.1 (2018-03-29))
12
12
  Accept:
13
13
  - application/json
14
14
  Date:
15
- - Wed, 23 Nov 2016 19:16:54 GMT
15
+ - Tue, 30 Oct 2018 20:24:01 GMT
16
16
  Content-Type:
17
17
  - application/json
18
+ Authorization:
19
+ - Bearer 03c22256c06ed11f6bee83673addf26e02a86caa1a5127f4e0815be7223fe4a3
18
20
  response:
19
21
  status:
20
22
  code: 201
21
23
  message: Created
22
24
  headers:
23
- Server:
24
- - Apache/2.4.7 (Ubuntu)
25
25
  Content-Type:
26
26
  - application/json; charset=utf-8
27
27
  Etag:
28
- - W/"b6d45f34158428614bbb946bfc528007"
28
+ - W/"3b355ff221654ef5686b1b9a5242d03b"
29
29
  Nation-Ratelimit-Limit:
30
30
  - '999999'
31
31
  Nation-Ratelimit-Remaining:
32
32
  - '999999'
33
33
  Nation-Ratelimit-Reset:
34
- - '1479945600'
34
+ - '1540944000'
35
+ Server:
36
+ - Apache/2.4.7 (Ubuntu)
35
37
  Status:
36
38
  - 201 Created
37
39
  X-Content-Type-Options:
38
40
  - nosniff
39
41
  X-Frame-Options:
40
- - SAMEORIGIN
42
+ - ALLOWALL
43
+ X-Middleware-Start:
44
+ - t=1540931041929836
41
45
  X-Powered-By:
42
46
  - Phusion Passenger Enterprise 5.0.28
43
47
  X-Pulse-Approved:
@@ -47,33 +51,33 @@ http_interactions:
47
51
  X-Ratelimit-Limit:
48
52
  - 10s
49
53
  X-Ratelimit-Remaining:
50
- - '97'
54
+ - '99'
51
55
  X-Ratelimit-Reset:
52
- - '1479928618'
56
+ - '1540931051'
53
57
  X-Request-Id:
54
- - c86e279e-27c3-4271-8f3a-9a6873e44c4f
58
+ - 4f07a8e2-bc5f-4bc5-8adc-369d194d188c
55
59
  X-Runtime:
56
- - '0.632973'
57
- X-Xss-Protection:
58
- - 1; mode=block
60
+ - '0.266915'
61
+ X-Served-By:
62
+ - api13
59
63
  Content-Length:
60
- - '5448'
64
+ - '5073'
61
65
  Expires:
62
- - Wed, 23 Nov 2016 19:16:55 GMT
66
+ - Tue, 30 Oct 2018 20:24:02 GMT
63
67
  Cache-Control:
64
68
  - max-age=0, no-cache, no-store
65
69
  Pragma:
66
70
  - no-cache
67
71
  Date:
68
- - Wed, 23 Nov 2016 19:16:55 GMT
72
+ - Tue, 30 Oct 2018 20:24:02 GMT
69
73
  Connection:
70
74
  - keep-alive
71
- Set-Cookie:
72
- - _cookies_enabled=1479928615; path=/
75
+ Use-Proxy:
76
+ - 'True'
73
77
  body:
74
78
  encoding: UTF-8
75
- string: '{"person":{"birthdate":null,"city_district":null,"civicrm_id":null,"county_district":null,"county_file_id":null,"created_at":"2016-11-23T19:16:55Z","datatrust_id":null,"do_not_call":false,"do_not_contact":false,"dw_id":null,"email":"bob@example.com","email_opt_in":true,"employer":null,"external_id":null,"federal_district":null,"fire_district":null,"first_name":"Bob","has_facebook":false,"id":278882,"is_twitter_follower":false,"is_volunteer":false,"judicial_district":null,"labour_region":null,"last_name":"Smith","linkedin_id":null,"mobile":null,"mobile_opt_in":true,"nbec_guid":null,"ngp_id":null,"note":null,"occupation":null,"party":null,"pf_strat_id":null,"phone":null,"precinct_id":null,"primary_address":null,"profile_image_url_ssl":"https://d3n8a8pro7vhmx.cloudfront.net/assets/icons/buddy.png","recruiter_id":null,"rnc_id":null,"rnc_regid":null,"salesforce_id":null,"school_district":null,"school_sub_district":null,"sex":null,"signup_type":0,"state_file_id":null,"state_lower_district":null,"state_upper_district":null,"support_level":null,"supranational_district":null,"tags":[],"twitter_id":null,"twitter_name":null,"updated_at":"2016-11-23T19:16:55Z","van_id":null,"village_district":null,"ward":null,"work_phone_number":null,"active_customer_expires_at":null,"active_customer_started_at":null,"author":null,"author_id":null,"auto_import_id":null,"availability":null,"ballots":[],"banned_at":null,"billing_address":null,"bio":null,"call_status_id":null,"call_status_name":null,"capital_amount_in_cents":0,"children_count":0,"church":null,"city_sub_district":null,"closed_invoices_amount_in_cents":null,"closed_invoices_count":null,"contact_status_id":null,"contact_status_name":null,"could_vote_status":false,"demo":null,"donations_amount_in_cents":0,"donations_amount_this_cycle_in_cents":0,"donations_count":0,"donations_count_this_cycle":0,"donations_pledged_amount_in_cents":0,"donations_raised_amount_in_cents":0,"donations_raised_amount_this_cycle_in_cents":0,"donations_raised_count":0,"donations_raised_count_this_cycle":0,"donations_to_raise_amount_in_cents":0,"email1":"bob@example.com","email1_is_bad":false,"email2":null,"email2_is_bad":false,"email3":null,"email3_is_bad":false,"email4":null,"email4_is_bad":false,"emails":[{"email_address":"bob@example.com","email_number":1,"is_bad":false,"is_primary":true}],"ethnicity":null,"facebook_address":null,"facebook_profile_url":null,"facebook_updated_at":null,"facebook_username":null,"fax_number":null,"federal_donotcall":false,"first_donated_at":null,"first_fundraised_at":null,"first_invoice_at":null,"first_prospect_at":null,"first_recruited_at":null,"first_supporter_at":"2016-11-23T19:16:55Z","first_volunteer_at":null,"full_name":"Bob
76
- Smith","home_address":null,"import_id":null,"inferred_party":null,"inferred_support_level":null,"invoice_payments_amount_in_cents":0,"invoice_payments_referred_amount_in_cents":0,"invoices_amount_in_cents":null,"invoices_count":null,"is_absentee_voter":null,"is_active_voter":null,"is_deceased":false,"is_donor":false,"is_dropped_from_file":null,"is_early_voter":null,"is_fundraiser":false,"is_ignore_donation_limits":false,"is_leaderboardable":true,"is_mobile_bad":false,"is_permanent_absentee_voter":null,"is_possible_duplicate":false,"is_profile_private":false,"is_profile_searchable":true,"is_prospect":false,"is_supporter":true,"is_survey_question_private":false,"language":null,"last_call_id":null,"last_contacted_at":null,"last_contacted_by":null,"last_donated_at":null,"last_fundraised_at":null,"last_invoice_at":null,"last_rule_violation_at":null,"legal_name":null,"locale":null,"mailing_address":null,"marital_status":null,"media_market_name":null,"meetup_id":null,"meetup_address":null,"membership_expires_at":null,"membership_level_name":null,"membership_started_at":null,"middle_name":null,"mobile_normalized":null,"nbec_precinct_code":null,"nbec_precinct":null,"note_updated_at":null,"outstanding_invoices_amount_in_cents":null,"outstanding_invoices_count":null,"overdue_invoices_count":0,"page_slug":null,"parent":null,"parent_id":null,"party_member":null,"phone_normalized":null,"phone_time":null,"precinct_code":null,"precinct_name":null,"prefix":null,"previous_party":null,"primary_email_id":1,"priority_level":null,"priority_level_changed_at":null,"profile_content":null,"profile_content_html":null,"profile_headline":null,"received_capital_amount_in_cents":0,"recruiter":null,"recruits_count":0,"registered_address":null,"registered_at":null,"religion":null,"rule_violations_count":0,"signup_sources":[],"spent_capital_amount_in_cents":0,"submitted_address":null,"subnations":[],"suffix":null,"support_level_changed_at":null,"support_probability_score":null,"township":null,"turnout_probability_score":null,"twitter_address":null,"twitter_description":null,"twitter_followers_count":null,"twitter_friends_count":null,"twitter_location":null,"twitter_login":null,"twitter_updated_at":null,"twitter_website":null,"unsubscribed_at":null,"user_submitted_address":null,"username":null,"voter_updated_at":null,"warnings_count":0,"website":null,"work_address":null,"bag_preference":null,"do_you_drive_a_fork_lift":null,"have_you_been_involved_in_an_election_campaign_before_":null,"sub_branch":null,"sams_custom_field":null,"mrow":null,"headshot_url":null,"university":null,"membership_number":null,"number":null,"check":null,"industry_name":null,"yes":null,"next_election":null,"filing_window":null},"precinct":null}'
79
+ string: '{"person":{"birthdate":null,"city_district":null,"civicrm_id":null,"county_district":null,"county_file_id":null,"created_at":"2018-10-30T20:24:02Z","datatrust_id":null,"do_not_call":false,"do_not_contact":false,"dw_id":null,"email":"bob@example.com","email_opt_in":true,"employer":null,"external_id":null,"federal_district":null,"fire_district":null,"first_name":"Bob","has_facebook":false,"id":352990,"is_twitter_follower":false,"is_volunteer":false,"judicial_district":null,"labour_region":null,"last_name":"Smith","linkedin_id":null,"mobile":null,"mobile_opt_in":true,"middle_name":"","nbec_guid":null,"ngp_id":null,"note":null,"occupation":null,"party":null,"pf_strat_id":null,"phone":null,"precinct_id":null,"primary_address":null,"profile_image_url_ssl":"https://d3n8a8pro7vhmx.cloudfront.net/assets/notifier/profile-avatar.png","recruiter_id":null,"rnc_id":null,"rnc_regid":null,"salesforce_id":null,"school_district":null,"school_sub_district":null,"sex":null,"signup_type":0,"state_file_id":null,"state_lower_district":null,"state_upper_district":null,"support_level":null,"supranational_district":null,"tags":[],"twitter_id":null,"twitter_name":null,"updated_at":"2018-10-30T20:24:02Z","van_id":null,"village_district":null,"ward":null,"work_phone_number":null,"active_customer_expires_at":null,"active_customer_started_at":null,"author":null,"author_id":null,"auto_import_id":null,"availability":null,"ballots":[],"banned_at":null,"billing_address":null,"bio":null,"call_status_id":null,"call_status_name":null,"capital_amount_in_cents":0,"children_count":0,"church":null,"city_sub_district":null,"closed_invoices_amount_in_cents":0,"closed_invoices_count":null,"contact_status_id":null,"contact_status_name":null,"could_vote_status":false,"demo":null,"donations_amount_in_cents":0,"donations_amount_this_cycle_in_cents":0,"donations_count":0,"donations_count_this_cycle":0,"donations_pledged_amount_in_cents":0,"donations_raised_amount_in_cents":0,"donations_raised_amount_this_cycle_in_cents":0,"donations_raised_count":0,"donations_raised_count_this_cycle":0,"donations_to_raise_amount_in_cents":0,"email1":"bob@example.com","email1_is_bad":false,"email2":null,"email2_is_bad":false,"email3":null,"email3_is_bad":false,"email4":null,"email4_is_bad":false,"emails":[{"email_address":"bob@example.com","email_number":1,"is_bad":false,"is_primary":true}],"ethnicity":null,"facebook_address":null,"facebook_profile_url":null,"facebook_updated_at":null,"facebook_username":null,"fax_number":null,"federal_donotcall":false,"first_donated_at":null,"first_fundraised_at":null,"first_invoice_at":null,"first_prospect_at":null,"first_recruited_at":null,"first_supporter_at":"2018-10-30T20:24:02Z","first_volunteer_at":null,"full_name":"Bob
80
+ Smith","home_address":null,"identity_mappings":[],"import_id":null,"inferred_party":null,"inferred_support_level":null,"invoice_payments_amount_in_cents":0,"invoice_payments_referred_amount_in_cents":0,"invoices_amount_in_cents":0,"invoices_count":null,"is_absentee_voter":null,"is_active_voter":null,"is_deceased":false,"is_donor":false,"is_dropped_from_file":null,"is_early_voter":null,"is_fundraiser":false,"is_ignore_donation_limits":false,"is_leaderboardable":true,"is_mobile_bad":false,"is_permanent_absentee_voter":null,"is_possible_duplicate":false,"is_profile_private":false,"is_profile_searchable":true,"is_prospect":false,"is_supporter":true,"is_survey_question_private":false,"language":null,"last_call_id":null,"last_contacted_at":null,"last_contacted_by":null,"last_donated_at":null,"last_fundraised_at":null,"last_invoice_at":null,"last_rule_violation_at":null,"legal_name":null,"locale":null,"mailing_address":null,"marital_status":null,"media_market_name":null,"meetup_id":null,"meetup_address":null,"mobile_normalized":null,"nbec_precinct_code":null,"nbec_precinct":null,"note_updated_at":null,"outstanding_invoices_amount_in_cents":0,"outstanding_invoices_count":null,"overdue_invoices_count":0,"page_slug":null,"parent":null,"parent_id":null,"party_member":null,"phone_normalized":null,"phone_time":null,"precinct_code":null,"precinct_name":null,"prefix":null,"previous_party":null,"primary_email_id":1,"priority_level":null,"priority_level_changed_at":null,"profile_content":null,"profile_content_html":null,"profile_headline":null,"received_capital_amount_in_cents":0,"recruiter":null,"recruits_count":0,"registered_address":null,"registered_at":null,"religion":null,"rule_violations_count":0,"signup_sources":[],"spent_capital_amount_in_cents":0,"submitted_address":null,"subnations":[],"suffix":null,"support_level_changed_at":null,"support_probability_score":null,"township":null,"turnout_probability_score":null,"twitter_address":null,"twitter_description":null,"twitter_followers_count":null,"twitter_friends_count":null,"twitter_location":null,"twitter_login":null,"twitter_updated_at":null,"twitter_website":null,"unsubscribed_at":null,"user_submitted_address":null,"username":null,"voter_updated_at":null,"warnings_count":0,"website":null,"work_address":null,"graduation_year":null},"precinct":null}'
77
81
  http_version:
78
- recorded_at: Wed, 23 Nov 2016 19:16:55 GMT
82
+ recorded_at: Tue, 30 Oct 2018 20:24:02 GMT
79
83
  recorded_with: VCR 2.9.3
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe NationBuilder::Client do
4
4
 
5
5
  let(:client) do
6
- NationBuilder::Client.new('organizeralexandreschmitt',
6
+ NationBuilder::Client.new('testnation',
7
7
  '03c22256c06ed11f6bee83673addf26e02a86caa1a5127f4e0815be7223fe4a3',
8
8
  retries: 1
9
9
  )
@@ -54,7 +54,7 @@ describe NationBuilder::Client do
54
54
  describe '#base_url' do
55
55
 
56
56
  it 'should contain the nation slug' do
57
- expect(client.base_url).to eq('https://organizeralexandreschmitt.nationbuilder.com')
57
+ expect(client.base_url).to eq('https://testnation.nationbuilder.com')
58
58
  end
59
59
  end
60
60
 
@@ -62,11 +62,9 @@ describe NationBuilder::Client do
62
62
 
63
63
  it 'should handle a parametered GET' do
64
64
  VCR.use_cassette('parametered_get') do
65
- response = client.call(:basic_pages, :index, site_slug: 'organizeralexandreschmitt', limit: 11)
65
+ response = client.call(:people, :search, first_name: "Alex", custom_values: { graduation_year: "2008" }, limit: 2)
66
66
  expect(client.response.status).to eq(200)
67
- response['results'].each do |result|
68
- expect(result['site_slug']).to eq('organizeralexandreschmitt')
69
- end
67
+ expect(response['results'].count).to eq(2)
70
68
  end
71
69
  end
72
70
 
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  describe NationBuilder::Paginator do
4
4
 
5
5
  let(:client) do
6
- NationBuilder::Client.new('organizeralexandreschmitt',
6
+ NationBuilder::Client.new('testnation',
7
7
  '03c22256c06ed11f6bee83673addf26e02a86caa1a5127f4e0815be7223fe4a3')
8
8
  end
9
9
  let(:response) do
10
- VCR.use_cassette('parametered_get') do
11
- client.call(:basic_pages, :index, site_slug: 'organizeralexandreschmitt', limit: 11)
10
+ VCR.use_cassette('paginated_get') do
11
+ client.call(:basic_pages, :index, site_slug: 'testsite', limit: 11)
12
12
  end
13
13
  end
14
14
 
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe NationBuilder::Utils::QueryParams do
4
+ describe ".encode" do
5
+ context "nested hash" do
6
+ it "formats to proper url params hash" do
7
+ expect(
8
+ described_class.encode({ first: { second: { third: "value" } } })
9
+ ).to eq({ "first[second][third]" => "value" })
10
+ end
11
+ end
12
+
13
+ context "array" do
14
+ it "formats to proper url params hash" do
15
+ expect(described_class.encode(["tag"])).to eq({ "[]" => "tag" })
16
+ end
17
+ end
18
+
19
+ context "nil" do
20
+ it "formats to proper url params hash" do
21
+ expect(described_class.encode(nil)).to eq({})
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nationbuilder-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Huie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-22 00:00:00.000000000 Z
12
+ date: 2018-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
@@ -31,72 +31,72 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.4'
34
+ version: '12.3'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '10.4'
41
+ version: '12.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '3.2'
48
+ version: '3.8'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '3.2'
55
+ version: '3.8'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: simplecov
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.8'
62
+ version: '0.16'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.8'
69
+ version: '0.16'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: vcr
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '2.9'
76
+ version: '4.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '2.9'
83
+ version: '4.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: webmock
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '1.18'
90
+ version: '3.4'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.18'
97
+ version: '3.4'
98
98
  description: A Ruby client to the NationBuilder API
99
- email: schmitt@nationbuilder.com
99
+ email: api@nationbuilder.com
100
100
  executables:
101
101
  - nbdoc
102
102
  extensions: []
@@ -156,9 +156,12 @@ files:
156
156
  - lib/nationbuilder/parameter.rb
157
157
  - lib/nationbuilder/spec_parser.rb
158
158
  - lib/nationbuilder/url.rb
159
+ - lib/nationbuilder/utils.rb
159
160
  - lib/nationbuilder/version.rb
160
161
  - nationbuilder-rb.gemspec
161
162
  - spec/fixtures/delete.yml
163
+ - spec/fixtures/errored_get.yml
164
+ - spec/fixtures/paginated_get.yml
162
165
  - spec/fixtures/paginated_get_page2.yml
163
166
  - spec/fixtures/paginated_get_page2_with_limit.yml
164
167
  - spec/fixtures/paginated_get_page3.yml
@@ -166,6 +169,7 @@ files:
166
169
  - spec/fixtures/parametered_post.yml
167
170
  - spec/lib/nationbuilder/client_spec.rb
168
171
  - spec/lib/nationbuilder/paginator_spec.rb
172
+ - spec/lib/nationbuilder/utils_spec.rb
169
173
  - spec/spec_helper.rb
170
174
  - update_subtree.sh
171
175
  homepage: http://github.com/nationbuilder/nationbuilder-rb
@@ -188,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
192
  version: '0'
189
193
  requirements: []
190
194
  rubyforge_project:
191
- rubygems_version: 2.6.12
195
+ rubygems_version: 2.7.7
192
196
  signing_key:
193
197
  specification_version: 4
194
198
  summary: A Ruby client to the NationBuilder API