nationbuilder-rb 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8648d21e88265f0cf6a71cddf2b9afd78fccd32b
4
- data.tar.gz: a32b6405c3998adc8ab51467aa84fab65acd675a
3
+ metadata.gz: c727153fa9f23c77b2ecbfd29b3132a7ff83d010
4
+ data.tar.gz: 086d1340d0fd37974591d4159ff7b16942a2438c
5
5
  SHA512:
6
- metadata.gz: bf6c54ac14c62d25ecc992eb53c3db859b4ae909c3176f1557e3255c28427d257f1128db27d0327173668438ac334ab76c81ef7dc3b4973071cc9d2fc8ee5e60
7
- data.tar.gz: 739964b86179782bb0155d7a93cdd23791938626e65f87b5394ddac67b55584911484a51c5ef8370879dee9af3e33562680210fc8500d36c59d3b779ad0ee93a
6
+ metadata.gz: 25301164f512c894f0622c3b811be4f0bda7380939fc49474dd16727278de98f6f216206d1cf82f54cd2611ac20077c1ff3ce570f71fd6b9f40c137f553891a1
7
+ data.tar.gz: 0a180b930c0356d1d48981fb3e909d3787ddcad360c9beb12b70fc05317276b15f41e4f5413c0d147172717630f471c0d11ccda4fb15411ef4fd94f29460ec06
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.3
2
+ - [#10] Support fire_webhooks parameter in client
3
+
1
4
  # 1.2.3
2
5
  - Return true for non-JSON responses
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.3.0
@@ -56,6 +56,9 @@ class NationBuilder::Client
56
56
  request_args[:query].merge!(body)
57
57
  else
58
58
  body[:access_token] = @api_key
59
+ if !body[:fire_webhooks].nil?
60
+ request_args[:query][:fire_webhooks] = body[:fire_webhooks]
61
+ end
59
62
  request_args[:body] = JSON(body)
60
63
  end
61
64
 
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nationbuilder-rb 1.2.3 ruby lib
5
+ # stub: nationbuilder-rb 1.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nationbuilder-rb"
9
- s.version = "1.2.3"
9
+ s.version = "1.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["David Huie"]
14
- s.date = "2015-02-18"
14
+ s.date = "2015-02-23"
15
15
  s.description = "A Ruby client to the NationBuilder API"
16
16
  s.email = "david@nationbuilder.com"
17
17
  s.executables = ["nbdoc"]
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
49
49
  "spec/fixtures/paginated_get_page3.yml",
50
50
  "spec/fixtures/parametered_get.yml",
51
51
  "spec/fixtures/parametered_post.yml",
52
+ "spec/fixtures/parametered_post_with_fire_webhooks_false.yml",
52
53
  "spec/nationbuilder_client_spec.rb",
53
54
  "spec/nationbuilder_paginator_spec.rb",
54
55
  "spec/spec_helper.rb"
@@ -0,0 +1,81 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://organizeralexandreschmitt.nationbuilder.com/api/v1/people?access_token=53920a524356034a065515a37650df2bd295971975d5742b9daa50eb8c7404d5&fire_webhooks=false
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{\"person\":{\"email\":\"bob@example.com\",\"last_name\":\"Smith\",\"first_name\":\"Bob\"},\"access_token\":\"53921a524356034a065515a37650df2bd295971975d5742b9daa50eb8c7404d5\",\"fire_webhooks\":\"false\"}"
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.4.0, ruby 2.1.0 (2013-12-25))
12
+ Accept:
13
+ - application/json
14
+ Date:
15
+ - Thu, 05 Feb 2015 05:54:32 GMT
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: Conflict
22
+ headers:
23
+ Server:
24
+ - cloudflare-nginx
25
+ Date:
26
+ - Thu, 05 Feb 2015 05:54:33 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Set-Cookie:
34
+ - __cfduid=d948b90f065447c7e715937cb22519f821423115672; expires=Fri, 05-Feb-16
35
+ 05:54:32 GMT; path=/; domain=.nationbuilder.com; HttpOnly
36
+ Cache-Control:
37
+ - no-cache
38
+ Nation-Ratelimit-Limit:
39
+ - '125000'
40
+ Nation-Ratelimit-Remaining:
41
+ - '124958'
42
+ Nation-Ratelimit-Reset:
43
+ - '1423180800'
44
+ Status:
45
+ - 409 Conflict
46
+ Vary:
47
+ - Accept-Encoding
48
+ X-Powered-By:
49
+ - Phusion Passenger 4.0.53
50
+ X-Pulse-Approved:
51
+ - 'true'
52
+ X-Rack-Cache:
53
+ - invalidate, pass
54
+ X-Ratelimit-Limit:
55
+ - 10s
56
+ X-Ratelimit-Remaining:
57
+ - '99'
58
+ X-Ratelimit-Reset:
59
+ - '1423115683'
60
+ X-Request-Id:
61
+ - 9be6fa50e0f42b4c780fc054bd79721f
62
+ X-Runtime:
63
+ - '0.102341'
64
+ X-Ua-Compatible:
65
+ - IE=Edge,chrome=1
66
+ Via:
67
+ - 1.1 nationbuilder.com
68
+ Cf-Ray:
69
+ - 1b3cda9bf5c21431-LAX
70
+ body:
71
+ encoding: UTF-8
72
+ string: "{\"person\":{\"birthdate\":null,\"city_district\":\"14\",\"civicrm_id\":null,\"county_district\":\"1\",\"county_file_id\":null,\"created_at\":\"2014-04-24T10:27:34-07:00\",\"datatrust_id\":null,\"do_not_call\":false,\"do_not_contact\":false,\"dw_id\":null,\"email\":\"bob@example.com\",\"email_opt_in\":true,\"employer\":\"\",\"external_id\":null,\"federal_district\":\"34\",\"fire_district\":null,\"first_name\":\"Bob\",\"has_facebook\":false,\"id\":79264,\"is_twitter_follower\":false,\"is_volunteer\":false,\"judicial_district\":null,\"labour_region\":null,\"last_name\":\"Smith\",\"linkedin_id\":null,\"mobile\":\"\",\"mobile_opt_in\":true,\"nbec_guid\":null,\"ngp_id\":null,\"note\":null,\"occupation\":\"\",\"party\":\"\",\"pf_strat_id\":null,\"phone\":\"213-555-1234\",\"precinct_id\":null,\"primary_address\":{\"address1\":\"1234
73
+ S Hill St\",\"address2\":\"\",\"address3\":\"\",\"city\":\"Los Angeles\",\"state\":\"CA\",\"country_code\":\"US\",\"zip\":\"90015\",\"lat\":\"34.0383462\",\"lng\":\"-118.2614889\"},\"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\":\"19647330000000\",\"school_sub_district\":\"2\",\"sex\":\"\",\"signup_type\":0,\"state_file_id\":null,\"state_lower_district\":\"53\",\"state_upper_district\":\"30\",\"support_level\":null,\"supranational_district\":null,\"tags\":[\"website_volunteer\",\"Youth_Outreach\",\"sample
74
+ import\"],\"twitter_id\":null,\"twitter_name\":null,\"updated_at\":\"2015-02-04T21:54:25-08:00\",\"van_id\":null,\"village_district\":null,\"work_phone_number\":\"\",\"active_customer_expires_at\":null,\"active_customer_started_at\":null,\"author\":null,\"author_id\":null,\"auto_import_id\":null,\"availability\":\"M-F\",\"banned_at\":null,\"billing_address\":{\"address1\":\"1234
75
+ S Hill St\",\"address2\":\"\",\"address3\":\"\",\"city\":\"Los Angeles\",\"state\":\"CA\",\"country_code\":\"US\",\"zip\":\"90015\",\"lat\":\"34.0383462\",\"lng\":\"-118.2614889\"},\"bio\":null,\"call_status_id\":null,\"call_status_name\":null,\"capital_amount_in_cents\":16700,\"children_count\":0,\"church\":\"\",\"city_sub_district\":\"DOWNTOWN
76
+ LOS ANGELES\",\"closed_invoices_amount_in_cents\":null,\"closed_invoices_count\":null,\"contact_status_id\":null,\"contact_status_name\":null,\"could_vote_status\":null,\"demo\":\"\",\"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,\"ethnicity\":\"\",\"facebook_address\":null,\"facebook_profile_url\":null,\"facebook_updated_at\":null,\"facebook_username\":null,\"fax_number\":\"\",\"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\":\"2014-04-24T10:27:34-07:00\",\"first_volunteer_at\":\"2014-09-02T13:10:28-07:00\",\"full_name\":\"Bob
77
+ Smith\",\"home_address\":null,\"import_id\":null,\"inferred_party\":\"\",\"inferred_support_level\":null,\"invoice_payments_amount_in_cents\":null,\"invoice_payments_referred_amount_in_cents\":null,\"invoices_amount_in_cents\":null,\"invoices_count\":null,\"is_deceased\":false,\"is_donor\":false,\"is_fundraiser\":false,\"is_ignore_donation_limits\":false,\"is_leaderboardable\":true,\"is_mobile_bad\":false,\"is_possible_duplicate\":false,\"is_profile_private\":false,\"is_profile_searchable\":true,\"is_prospect\":false,\"is_supporter\":true,\"is_survey_question_private\":false,\"language\":\"\",\"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\":\"\",\"mailing_address\":null,\"marital_status\":\"\",\"media_market_name\":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,\"note_updated_at\":null,\"outstanding_invoices_amount_in_cents\":null,\"outstanding_invoices_count\":null,\"overdue_invoices_count\":null,\"page_slug\":\"ticket_page\",\"parent\":null,\"parent_id\":null,\"party_member\":false,\"phone_normalized\":\"2135551234\",\"phone_time\":\"\",\"precinct_code\":null,\"precinct_name\":null,\"prefix\":null,\"previous_party\":\"\",\"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\":17700,\"recruiter\":null,\"recruits_count\":0,\"registered_address\":null,\"registered_at\":null,\"religion\":\"\",\"rule_violations_count\":0,\"spent_capital_amount_in_cents\":1000,\"submitted_address\":\"\",\"subnations\":[],\"suffix\":null,\"support_level_changed_at\":null,\"support_probability_score\":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\":{\"address1\":\"488
78
+ S Hill St\",\"address2\":null,\"address3\":null,\"city\":\"Los Angeles\",\"state\":\"CA\",\"country_code\":\"US\",\"zip\":\"90013\",\"lat\":\"34.0490467\",\"lng\":\"-118.2515224\"},\"username\":\"randomeveguy\",\"warnings_count\":0,\"website\":null,\"work_address\":null,\"bag_preference\":null,\"do_you_drive_a_fork_lift\":null,\"have_you_ever_been_contacted_by_a_union_representative_before_\":null,\"have_you_been_involved_in_an_election_campaign_before_\":null,\"sub_branch\":null,\"sams_custom_field\":null,\"mrow\":null,\"received_an_email\":null,\"brett_petition_mc\":null,\"headshot_url\":null,\"university\":null,\"membership_number\":null},\"precinct\":null}"
79
+ http_version:
80
+ recorded_at: Thu, 05 Feb 2015 05:54:33 GMT
81
+ recorded_with: VCR 2.9.2
@@ -70,6 +70,43 @@ describe NationBuilder::Client do
70
70
  expect(response['person']['first_name']).to eq('Bob')
71
71
  end
72
72
 
73
+ context 'fire_webhooks' do
74
+
75
+ it 'should disable webhooks' do
76
+ params = {
77
+ fire_webhooks: false,
78
+ person: {
79
+ email: 'bob@example.com',
80
+ last_name: 'Smith',
81
+ first_name: 'Bob'
82
+ }
83
+ }
84
+
85
+ expect(client).to receive(:perform_request_with_retries) do |_, _, request_args|
86
+ expect(request_args[:query][:fire_webhooks]).to be_falsey
87
+ end
88
+
89
+ client.call(:people, :create, params)
90
+ end
91
+
92
+ it 'should not be included if not specified' do
93
+ params = {
94
+ person: {
95
+ email: 'bob@example.com',
96
+ last_name: 'Smith',
97
+ first_name: 'Bob'
98
+ }
99
+ }
100
+
101
+ expect(client).to receive(:perform_request_with_retries) do |_, _, request_args|
102
+ expect(request_args[:query].include?(:fire_webhooks)).to be_falsey
103
+ end
104
+
105
+ client.call(:people, :create, params)
106
+ end
107
+
108
+ end
109
+
73
110
  it 'should handle a DELETE' do
74
111
  params = {
75
112
  id: 21234
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nationbuilder-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Huie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -132,6 +132,7 @@ files:
132
132
  - spec/fixtures/paginated_get_page3.yml
133
133
  - spec/fixtures/parametered_get.yml
134
134
  - spec/fixtures/parametered_post.yml
135
+ - spec/fixtures/parametered_post_with_fire_webhooks_false.yml
135
136
  - spec/nationbuilder_client_spec.rb
136
137
  - spec/nationbuilder_paginator_spec.rb
137
138
  - spec/spec_helper.rb