nationbuilder-rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +82 -0
- data/LICENSE.txt +20 -0
- data/README.md +103 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/bin/nbdoc +14 -0
- data/lib/nationbuilder.rb +24 -0
- data/lib/nationbuilder/api_spec.json +2151 -0
- data/lib/nationbuilder/client.rb +97 -0
- data/lib/nationbuilder/endpoint.rb +24 -0
- data/lib/nationbuilder/method.rb +48 -0
- data/lib/nationbuilder/parameter.rb +9 -0
- data/lib/nationbuilder/spec_parser.rb +28 -0
- data/nationbuilder-rb.gemspec +80 -0
- data/spec/fixtures/delete.yml +65 -0
- data/spec/fixtures/parametered_get.yml +79 -0
- data/spec/fixtures/parametered_post.yml +68 -0
- data/spec/fixtures/parametered_put.yml +69 -0
- data/spec/nationbuilder_client_spec.rb +87 -0
- data/spec/spec_helper.rb +15 -0
- metadata +154 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://dh.nationbuilder.com/api/v1/people/15
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"person":{"first_name":"David"},"access_token":"6e516b5d9a3d21b3cc079bc303c01aae3d59c8d4a7e9e6d2acfc11dada0e054e"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- HTTPClient/1.0 (2.4.0, ruby 2.0.0 (2013-11-22))
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
Date:
|
15
|
+
- Wed, 25 Jun 2014 22:38:48 GMT
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- cloudflare-nginx
|
25
|
+
Date:
|
26
|
+
- Wed, 25 Jun 2014 22:38:51 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Set-Cookie:
|
34
|
+
- __cfduid=d9f6a661a01dd1d52b9fd40de4187f8b81403735928830; expires=Mon, 23-Dec-2019
|
35
|
+
23:50:00 GMT; path=/; domain=.nationbuilder.com; HttpOnly
|
36
|
+
X-Ua-Compatible:
|
37
|
+
- IE=Edge,chrome=1
|
38
|
+
Cache-Control:
|
39
|
+
- max-age=0, private, must-revalidate
|
40
|
+
Nation-Ratelimit-Limit:
|
41
|
+
- '10000'
|
42
|
+
Nation-Ratelimit-Remaining:
|
43
|
+
- '9970'
|
44
|
+
Nation-Ratelimit-Reset:
|
45
|
+
- '1403740800'
|
46
|
+
X-Request-Id:
|
47
|
+
- 392db6e3a23d80b1ed831cdad7923a6b
|
48
|
+
X-Runtime:
|
49
|
+
- '2.373228'
|
50
|
+
X-Rack-Cache:
|
51
|
+
- invalidate, pass
|
52
|
+
X-Powered-By:
|
53
|
+
- Phusion Passenger 4.0.23
|
54
|
+
Status:
|
55
|
+
- 200 OK
|
56
|
+
Vary:
|
57
|
+
- Accept-Encoding
|
58
|
+
Via:
|
59
|
+
- 1.1 nationbuilder.com
|
60
|
+
Cf-Ray:
|
61
|
+
- 1404a85335c70d67-LAX
|
62
|
+
body:
|
63
|
+
encoding: UTF-8
|
64
|
+
string: '{"person":{"birthdate":null,"city_district":null,"civicrm_id":null,"county_district":null,"county_file_id":null,"created_at":"2014-06-25T15:35:22-07:00","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":"David","has_facebook":false,"id":15,"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,"recruiter_id":null,"rnc_id":null,"rnc_regid":null,"salesforce_id":null,"school_district":null,"school_sub_district":null,"sex":null,"state_file_id":null,"state_lower_district":null,"state_upper_district":null,"support_level":null,"supranational_district":null,"tags":[],"twitter_id":"323013939","twitter_name":"Random
|
65
|
+
EVE Guy","updated_at":"2014-06-25T15:38:50-07:00","van_id":null,"village_district":null,"active_customer_expires_at":null,"active_customer_started_at":null,"author":null,"author_id":null,"auto_import_id":null,"availability":null,"banned_at":null,"billing_address":null,"bio":"","call_status_id":null,"call_status_name":null,"capital_amount_in_cents":500,"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":null,"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,"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":"2014-06-25T15:35:22-07:00","first_volunteer_at":null,"full_name":"David
|
66
|
+
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_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":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_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":0,"page_slug":null,"parent":null,"parent_id":null,"party_member":false,"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":500,"recruiter":null,"recruits_count":0,"registered_address":null,"registered_at":null,"religion":null,"rule_violations_count":0,"spent_capital_amount_in_cents":0,"submitted_address":null,"subnations":[],"suffix":null,"support_level_changed_at":null,"support_probability_score":null,"turnout_probability_score":null,"twitter_address":null,"twitter_description":"","twitter_followers_count":10,"twitter_friends_count":21,"twitter_location":"","twitter_login":"RandomEVEGuy","twitter_updated_at":null,"twitter_website":null,"unsubscribed_at":null,"user_submitted_address":null,"username":"randomeveguy","warnings_count":0,"website":null,"work_address":null,"work_phone_number":null},"precinct":null}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Wed, 25 Jun 2014 22:38:51 GMT
|
69
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NationBuilder::Client do
|
4
|
+
|
5
|
+
let(:client) do
|
6
|
+
NationBuilder::Client.new('dh',
|
7
|
+
'6e516b5d9a3d21b3cc079bc303c01aae3d59c8d4a7e9e6d2acfc11dada0e054e')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#endpoints' do
|
11
|
+
|
12
|
+
it 'should contain all defined endpoints' do
|
13
|
+
client.endpoints.should eq([:basic_pages, :blogs, :blog_posts,
|
14
|
+
:calendars, :campaign_data, :contacts,
|
15
|
+
:contact_types, :donations, :events,
|
16
|
+
:imports, :lists, :page_attachments,
|
17
|
+
:people, :people_tags, :sites, :surveys,
|
18
|
+
:survey_responses, :webhooks])
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#base_url' do
|
24
|
+
|
25
|
+
it 'should contain the nation slug' do
|
26
|
+
client.base_url.should eq('https://dh.nationbuilder.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#call' do
|
32
|
+
|
33
|
+
it 'should handle a parametered GET' do
|
34
|
+
VCR.use_cassette('parametered_get') do
|
35
|
+
client.call(:basic_pages, :index, site_slug: 'dh')
|
36
|
+
.should eq({"page"=>1, "total_pages"=>1, "per_page"=>10, "total"=>1, "results"=>[{"slug"=>"about", "path"=>"/about", "status"=>"published", "site_slug"=>"dh", "name"=>"About", "headline"=>"About", "title"=>"About - dh", "excerpt"=>"", "author_id"=>2, "published_at"=>"2013-07-08T11:07:00-07:00", "external_id"=>nil, "tags"=>[], "id"=>1, "content"=>"<div style=\"float: right; margin: 0 0 10px 25px;\"><img class=\"img-circle\" src=\"boats.jpg\" alt=\"\"></div>\r\n<p>This is where you tell everyone what your blog is about. Explain what the intended purpose of your blog is, if there is one. If multiple people will be writing for your blog, you might consider posting photos and bios of the contributors.</p>\r\n<p>Proin libero diam, consequat ut nisl vestibulum, commodo scelerisque lacus. In vehicula, est quis rhoncus tristique, dolor sapien aliquam arcu, ut vulputate quam enim quis augue. Phasellus id nunc vitae lectus dapibus viverra malesuada at nibh. Suspendisse sagittis odio non ipsum feugiat porta.</p>\r\n<p> </p>\r\n<p><strong>To change this content, click \"Edit this page\" in the Supporter Nav on the right,<br>or from your Control Panel navigate to Websites > [about] > Content.</strong></p>"}]})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should handle a parametered POST' do
|
41
|
+
params = {
|
42
|
+
person: {
|
43
|
+
email: "bob@example.com",
|
44
|
+
last_name: "Smith",
|
45
|
+
first_name: "Bob"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
response = VCR.use_cassette('parametered_post') do
|
50
|
+
client.call(:people, :create, params)
|
51
|
+
end
|
52
|
+
|
53
|
+
response
|
54
|
+
.should eq({"person"=>{"birthdate"=>nil, "city_district"=>nil, "civicrm_id"=>nil, "county_district"=>nil, "county_file_id"=>nil, "created_at"=>"2014-06-25T15:35:22-07:00", "do_not_call"=>false, "do_not_contact"=>false, "dw_id"=>nil, "email"=>"bob@example.com", "email_opt_in"=>true, "employer"=>nil, "external_id"=>nil, "federal_district"=>nil, "fire_district"=>nil, "first_name"=>"Bob", "has_facebook"=>false, "id"=>15, "is_twitter_follower"=>false, "is_volunteer"=>false, "judicial_district"=>nil, "labour_region"=>nil, "last_name"=>"Smith", "linkedin_id"=>nil, "mobile"=>nil, "mobile_opt_in"=>true, "nbec_guid"=>nil, "ngp_id"=>nil, "note"=>nil, "occupation"=>nil, "party"=>nil, "pf_strat_id"=>nil, "phone"=>nil, "precinct_id"=>nil, "primary_address"=>nil, "recruiter_id"=>nil, "rnc_id"=>nil, "rnc_regid"=>nil, "salesforce_id"=>nil, "school_district"=>nil, "school_sub_district"=>nil, "sex"=>nil, "state_file_id"=>nil, "state_lower_district"=>nil, "state_upper_district"=>nil, "support_level"=>nil, "supranational_district"=>nil, "tags"=>[], "twitter_id"=>nil, "twitter_name"=>nil, "updated_at"=>"2014-06-25T15:35:22-07:00", "van_id"=>nil, "village_district"=>nil, "active_customer_expires_at"=>nil, "active_customer_started_at"=>nil, "author"=>nil, "author_id"=>nil, "auto_import_id"=>nil, "availability"=>nil, "banned_at"=>nil, "billing_address"=>nil, "bio"=>nil, "call_status_id"=>nil, "call_status_name"=>nil, "capital_amount_in_cents"=>0, "children_count"=>0, "church"=>nil, "city_sub_district"=>nil, "closed_invoices_amount_in_cents"=>nil, "closed_invoices_count"=>nil, "contact_status_id"=>nil, "contact_status_name"=>nil, "could_vote_status"=>nil, "demo"=>nil, "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"=>nil, "email2_is_bad"=>false, "email3"=>nil, "email3_is_bad"=>false, "email4"=>nil, "email4_is_bad"=>false, "ethnicity"=>nil, "facebook_address"=>nil, "facebook_profile_url"=>nil, "facebook_updated_at"=>nil, "facebook_username"=>nil, "fax_number"=>nil, "federal_donotcall"=>false, "first_donated_at"=>nil, "first_fundraised_at"=>nil, "first_invoice_at"=>nil, "first_prospect_at"=>nil, "first_recruited_at"=>nil, "first_supporter_at"=>"2014-06-25T15:35:22-07:00", "first_volunteer_at"=>nil, "full_name"=>"Bob Smith", "home_address"=>nil, "import_id"=>nil, "inferred_party"=>nil, "inferred_support_level"=>nil, "invoice_payments_amount_in_cents"=>0, "invoice_payments_referred_amount_in_cents"=>0, "invoices_amount_in_cents"=>nil, "invoices_count"=>nil, "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"=>nil, "last_call_id"=>nil, "last_contacted_at"=>nil, "last_contacted_by"=>nil, "last_donated_at"=>nil, "last_fundraised_at"=>nil, "last_invoice_at"=>nil, "last_rule_violation_at"=>nil, "legal_name"=>nil, "locale"=>nil, "mailing_address"=>nil, "marital_status"=>nil, "media_market_name"=>nil, "meetup_address"=>nil, "membership_expires_at"=>nil, "membership_level_name"=>nil, "membership_started_at"=>nil, "middle_name"=>nil, "mobile_normalized"=>nil, "nbec_precinct_code"=>nil, "note_updated_at"=>nil, "outstanding_invoices_amount_in_cents"=>nil, "outstanding_invoices_count"=>nil, "overdue_invoices_count"=>0, "page_slug"=>nil, "parent"=>nil, "parent_id"=>nil, "party_member"=>false, "phone_normalized"=>nil, "phone_time"=>nil, "precinct_code"=>nil, "precinct_name"=>nil, "prefix"=>nil, "previous_party"=>nil, "primary_email_id"=>1, "priority_level"=>nil, "priority_level_changed_at"=>nil, "profile_content"=>nil, "profile_content_html"=>nil, "profile_headline"=>nil, "received_capital_amount_in_cents"=>0, "recruiter"=>nil, "recruits_count"=>0, "registered_address"=>nil, "registered_at"=>nil, "religion"=>nil, "rule_violations_count"=>0, "spent_capital_amount_in_cents"=>0, "submitted_address"=>nil, "subnations"=>[], "suffix"=>nil, "support_level_changed_at"=>nil, "support_probability_score"=>nil, "turnout_probability_score"=>nil, "twitter_address"=>nil, "twitter_description"=>nil, "twitter_followers_count"=>nil, "twitter_friends_count"=>nil, "twitter_location"=>nil, "twitter_login"=>nil, "twitter_updated_at"=>nil, "twitter_website"=>nil, "unsubscribed_at"=>nil, "user_submitted_address"=>nil, "username"=>nil, "warnings_count"=>0, "website"=>nil, "work_address"=>nil, "work_phone_number"=>nil}, "precinct"=>nil})
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should handle a parametered PUT' do
|
58
|
+
person = {
|
59
|
+
id: 15,
|
60
|
+
person: {
|
61
|
+
first_name: "David"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
response = VCR.use_cassette('parametered_put') do
|
66
|
+
client.call(:people, :update, person)
|
67
|
+
end
|
68
|
+
|
69
|
+
response
|
70
|
+
.should eq({"person"=>{"birthdate"=>nil, "city_district"=>nil, "civicrm_id"=>nil, "county_district"=>nil, "county_file_id"=>nil, "created_at"=>"2014-06-25T15:35:22-07:00", "do_not_call"=>false, "do_not_contact"=>false, "dw_id"=>nil, "email"=>"bob@example.com", "email_opt_in"=>true, "employer"=>nil, "external_id"=>nil, "federal_district"=>nil, "fire_district"=>nil, "first_name"=>"David", "has_facebook"=>false, "id"=>15, "is_twitter_follower"=>false, "is_volunteer"=>false, "judicial_district"=>nil, "labour_region"=>nil, "last_name"=>"Smith", "linkedin_id"=>nil, "mobile"=>nil, "mobile_opt_in"=>true, "nbec_guid"=>nil, "ngp_id"=>nil, "note"=>nil, "occupation"=>nil, "party"=>nil, "pf_strat_id"=>nil, "phone"=>nil, "precinct_id"=>nil, "primary_address"=>nil, "recruiter_id"=>nil, "rnc_id"=>nil, "rnc_regid"=>nil, "salesforce_id"=>nil, "school_district"=>nil, "school_sub_district"=>nil, "sex"=>nil, "state_file_id"=>nil, "state_lower_district"=>nil, "state_upper_district"=>nil, "support_level"=>nil, "supranational_district"=>nil, "tags"=>[], "twitter_id"=>"323013939", "twitter_name"=>"Random EVE Guy", "updated_at"=>"2014-06-25T15:38:50-07:00", "van_id"=>nil, "village_district"=>nil, "active_customer_expires_at"=>nil, "active_customer_started_at"=>nil, "author"=>nil, "author_id"=>nil, "auto_import_id"=>nil, "availability"=>nil, "banned_at"=>nil, "billing_address"=>nil, "bio"=>"", "call_status_id"=>nil, "call_status_name"=>nil, "capital_amount_in_cents"=>500, "children_count"=>0, "church"=>nil, "city_sub_district"=>nil, "closed_invoices_amount_in_cents"=>nil, "closed_invoices_count"=>nil, "contact_status_id"=>nil, "contact_status_name"=>nil, "could_vote_status"=>nil, "demo"=>nil, "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"=>nil, "email2_is_bad"=>false, "email3"=>nil, "email3_is_bad"=>false, "email4"=>nil, "email4_is_bad"=>false, "ethnicity"=>nil, "facebook_address"=>nil, "facebook_profile_url"=>nil, "facebook_updated_at"=>nil, "facebook_username"=>nil, "fax_number"=>nil, "federal_donotcall"=>false, "first_donated_at"=>nil, "first_fundraised_at"=>nil, "first_invoice_at"=>nil, "first_prospect_at"=>nil, "first_recruited_at"=>nil, "first_supporter_at"=>"2014-06-25T15:35:22-07:00", "first_volunteer_at"=>nil, "full_name"=>"David Smith", "home_address"=>nil, "import_id"=>nil, "inferred_party"=>nil, "inferred_support_level"=>nil, "invoice_payments_amount_in_cents"=>0, "invoice_payments_referred_amount_in_cents"=>0, "invoices_amount_in_cents"=>nil, "invoices_count"=>nil, "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"=>nil, "last_call_id"=>nil, "last_contacted_at"=>nil, "last_contacted_by"=>nil, "last_donated_at"=>nil, "last_fundraised_at"=>nil, "last_invoice_at"=>nil, "last_rule_violation_at"=>nil, "legal_name"=>nil, "locale"=>nil, "mailing_address"=>nil, "marital_status"=>nil, "media_market_name"=>nil, "meetup_address"=>nil, "membership_expires_at"=>nil, "membership_level_name"=>nil, "membership_started_at"=>nil, "middle_name"=>nil, "mobile_normalized"=>nil, "nbec_precinct_code"=>nil, "note_updated_at"=>nil, "outstanding_invoices_amount_in_cents"=>nil, "outstanding_invoices_count"=>nil, "overdue_invoices_count"=>0, "page_slug"=>nil, "parent"=>nil, "parent_id"=>nil, "party_member"=>false, "phone_normalized"=>nil, "phone_time"=>nil, "precinct_code"=>nil, "precinct_name"=>nil, "prefix"=>nil, "previous_party"=>nil, "primary_email_id"=>1, "priority_level"=>nil, "priority_level_changed_at"=>nil, "profile_content"=>nil, "profile_content_html"=>nil, "profile_headline"=>nil, "received_capital_amount_in_cents"=>500, "recruiter"=>nil, "recruits_count"=>0, "registered_address"=>nil, "registered_at"=>nil, "religion"=>nil, "rule_violations_count"=>0, "spent_capital_amount_in_cents"=>0, "submitted_address"=>nil, "subnations"=>[], "suffix"=>nil, "support_level_changed_at"=>nil, "support_probability_score"=>nil, "turnout_probability_score"=>nil, "twitter_address"=>nil, "twitter_description"=>"", "twitter_followers_count"=>10, "twitter_friends_count"=>21, "twitter_location"=>"", "twitter_login"=>"RandomEVEGuy", "twitter_updated_at"=>nil, "twitter_website"=>nil, "unsubscribed_at"=>nil, "user_submitted_address"=>nil, "username"=>"randomeveguy", "warnings_count"=>0, "website"=>nil, "work_address"=>nil, "work_phone_number"=>nil}, "precinct"=>nil})
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should handle a DELETE' do
|
74
|
+
params = {
|
75
|
+
id: 15,
|
76
|
+
}
|
77
|
+
|
78
|
+
response = VCR.use_cassette('delete') do
|
79
|
+
client.call(:people, :destroy, params)
|
80
|
+
end
|
81
|
+
|
82
|
+
response.should eq({})
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
ENV['COVERAGE'] && SimpleCov.start
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
require 'rspec'
|
9
|
+
require 'nationbuilder'
|
10
|
+
require 'vcr'
|
11
|
+
|
12
|
+
VCR.configure do |c|
|
13
|
+
c.cassette_library_dir = 'spec/fixtures'
|
14
|
+
c.hook_into :webmock
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nationbuilder-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Huie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httpclient
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.8.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.8.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.8.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.9.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.9.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.18.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.18.0
|
97
|
+
description: A Ruby client to the NationBuilder API
|
98
|
+
email: david@nationbuilder.com
|
99
|
+
executables:
|
100
|
+
- nbdoc
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files:
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
files:
|
106
|
+
- .document
|
107
|
+
- .rspec
|
108
|
+
- .ruby-gemset
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- VERSION
|
115
|
+
- bin/nbdoc
|
116
|
+
- lib/nationbuilder.rb
|
117
|
+
- lib/nationbuilder/api_spec.json
|
118
|
+
- lib/nationbuilder/client.rb
|
119
|
+
- lib/nationbuilder/endpoint.rb
|
120
|
+
- lib/nationbuilder/method.rb
|
121
|
+
- lib/nationbuilder/parameter.rb
|
122
|
+
- lib/nationbuilder/spec_parser.rb
|
123
|
+
- nationbuilder-rb.gemspec
|
124
|
+
- spec/fixtures/delete.yml
|
125
|
+
- spec/fixtures/parametered_get.yml
|
126
|
+
- spec/fixtures/parametered_post.yml
|
127
|
+
- spec/fixtures/parametered_put.yml
|
128
|
+
- spec/nationbuilder_client_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
homepage: http://github.com/3dna/nationbuilder-rb
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.1.11
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: A Ruby client to the NationBuilder API
|
154
|
+
test_files: []
|