action_kit_rest 0.3.0 → 0.3.1

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: 50a2ea00d018df46495e68e40ec1ae83b2da79a4
4
- data.tar.gz: 2674d3dd62e28eb574d6f2622a17b221a7e3fb01
3
+ metadata.gz: 0e6edb307a9b65f7e81288ac4e14b9a80abe777c
4
+ data.tar.gz: 629f250827cd651dbe0ef532a22419e577be2d48
5
5
  SHA512:
6
- metadata.gz: d9d1ea9bbf740f3a1263c195c7d08a6b6cc5c8af95da0c5bb4505d3b2e810084bf6a65ba08c43121399c8da11c0d4c4c2773d34a5f342962a835f12d6d477782
7
- data.tar.gz: 87c4c06d543a54818d8d13dd458f02761ca6c440ffd90296a292a1d7310819a301b97e9068be269151b1fd216d299e9ccf4300ada134d4561a6a820bb1a2b100
6
+ metadata.gz: 248b87b48c6645107eea166d107371056d8ee01ccdd2198d0bf2e5decbee4b99bc2dc63a4ddff261f764807c43390785ff4b83dbd747a5082583bf0f7d698809
7
+ data.tar.gz: 6291cfc494a1996c8a387599428acf958df52345bebd1f773348f55f6c53c30f5bec5ebed4e90c4b2079419730bbde8d2a4f5255889550c89081b960e1b42ba0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: action_kit_rest 0.3.0 ruby lib
5
+ # stub: action_kit_rest 0.3.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "action_kit_rest".freeze
9
- s.version = "0.3.0"
9
+ s.version = "0.3.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze, "Diego Marcet".freeze, "Jacinda Moore".freeze]
14
- s.date = "2017-08-15"
14
+ s.date = "2017-09-04"
15
15
  s.description = "Gem for interacting with the ActionKit API".freeze
16
16
  s.email = "systems@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -62,6 +62,9 @@ Gem::Specification.new do |s|
62
62
  "spec/fixtures/error.json",
63
63
  "spec/fixtures/page/campaign.json",
64
64
  "spec/fixtures/page/collection.json",
65
+ "spec/fixtures/page/find_campaign.json",
66
+ "spec/fixtures/page/find_event_create.json",
67
+ "spec/fixtures/page/find_event_signup.json",
65
68
  "spec/fixtures/page/object.json",
66
69
  "spec/fixtures/phone/object.json",
67
70
  "spec/fixtures/user/object_with_phones.json",
@@ -16,8 +16,29 @@ module ActionKitRest
16
16
  event_campaign
17
17
  end
18
18
 
19
+ def find(name)
20
+ event_campaign = super
21
+ return unless event_campaign.present?
22
+
23
+ # Aggregate EventCreatePage and EventSignupPage
24
+ event_campaign['event_create_page_name'] = get_event_create_page(event_campaign)
25
+ event_campaign['event_signup_page_name'] = get_event_signup_page(event_campaign)
26
+
27
+ event_campaign
28
+ end
29
+
19
30
  private
20
31
 
32
+ def get_event_create_page(event_campaign)
33
+ response = client.get_request('eventcreatepage/', name: "#{event_campaign.name}-event-create")
34
+ response.obj.try(:first).try(:name)
35
+ end
36
+
37
+ def get_event_signup_page(event_campaign)
38
+ response = client.get_request('eventsignuppage/', name: "#{event_campaign.name}-event-signup")
39
+ response.obj.try(:first).try(:name)
40
+ end
41
+
21
42
  def create_event_create_page(event_campaign, tags)
22
43
  params = event_create_page_params(event_campaign, tags)
23
44
  response = client.post_json_request('eventcreatepage/', params)
@@ -2,7 +2,7 @@ module ActionKitRest
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 0
5
+ PATCH = 1
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -0,0 +1,43 @@
1
+ {
2
+ "meta": {
3
+ "limit": 20,
4
+ "next": null,
5
+ "offset": 0,
6
+ "previous": null,
7
+ "total_count": 1
8
+ },
9
+ "objects": [
10
+ {
11
+ "allow_private": true,
12
+ "created_at": "2010-11-30T18:45:43",
13
+ "default_event_size": 50,
14
+ "default_title": "",
15
+ "eventcreatepages": [],
16
+ "events": "/rest/v1/event/?campaign=88",
17
+ "eventsignuppages": [],
18
+ "id": 88,
19
+ "max_event_size": null,
20
+ "name": "climate-change-paris-2015",
21
+ "public_create_page": true,
22
+ "public_search_page": true,
23
+ "require_email_confirmation": true,
24
+ "require_staff_approval": false,
25
+ "resource_uri": "/rest/v1/campaign/88/",
26
+ "show_address1": false,
27
+ "show_attendee_count": false,
28
+ "show_city": true,
29
+ "show_directions": false,
30
+ "show_public_description": true,
31
+ "show_state": true,
32
+ "show_title": true,
33
+ "show_venue": true,
34
+ "show_zip": true,
35
+ "starts_at": null,
36
+ "title": "Climate Change Paris 2015",
37
+ "updated_at": "2015-06-19T01:39:09",
38
+ "use_start_date": true,
39
+ "use_start_time": true,
40
+ "use_title": true
41
+ }
42
+ ]
43
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "meta": {
3
+ "limit": 20,
4
+ "next": null,
5
+ "offset": 0,
6
+ "previous": null,
7
+ "total_count": 1
8
+ },
9
+ "objects": [
10
+ {
11
+ "actions": "/rest/v1/eventcreateaction/?page=818",
12
+ "allow_multiple_responses": true,
13
+ "campaign": "/rest/v1/campaign/88/",
14
+ "campaign_title": "",
15
+ "created_at": "2010-11-30T18:45:43",
16
+ "eventcreateform": null,
17
+ "fields": { },
18
+ "followup": null,
19
+ "goal": null,
20
+ "goal_type": "actions",
21
+ "hidden": false,
22
+ "hosted_with": "/rest/v1/hostingplatform/1/",
23
+ "id": 818,
24
+ "language": "/rest/v1/language/100/",
25
+ "list": "/rest/v1/list/66/",
26
+ "multilingual_campaign": null,
27
+ "name": "climate-change-paris-2015-event-create",
28
+ "never_spam_check": false,
29
+ "notes": "",
30
+ "real_actions": true,
31
+ "recognize": "once",
32
+ "required_fields": [],
33
+ "resource_uri": "/rest/v1/eventcreatepage/818/",
34
+ "status": "active",
35
+ "tags": [],
36
+ "title": "Climate Change Paris 2015: event create",
37
+ "type": "EventCreate",
38
+ "updated_at": "2015-06-19T01:39:09",
39
+ "url": ""
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "meta": {
3
+ "limit": 20,
4
+ "next": null,
5
+ "offset": 0,
6
+ "previous": null,
7
+ "total_count": 1
8
+ },
9
+ "objects": [
10
+ {
11
+ "actions": "/rest/v1/eventsignupaction/?page=819",
12
+ "allow_multiple_responses": true,
13
+ "campaign": "/rest/v1/campaign/88/",
14
+ "created_at": "2017-09-01T14:49:50",
15
+ "eventsignupform": null,
16
+ "fields": {},
17
+ "followup": null,
18
+ "goal": null,
19
+ "goal_type": "actions",
20
+ "hidden": false,
21
+ "hosted_with": "/rest/v1/hostingplatform/1/",
22
+ "id": 819,
23
+ "language": "/rest/v1/language/100/",
24
+ "list": "/rest/v1/list/66/",
25
+ "multilingual_campaign": null,
26
+ "name": "climate-change-paris-2015-event-signup",
27
+ "never_spam_check": false,
28
+ "notes": "",
29
+ "real_actions": true,
30
+ "recognize": "once",
31
+ "required_fields": [],
32
+ "resource_uri": "/rest/v1/eventsignuppage/819/",
33
+ "status": "active",
34
+ "tags": [],
35
+ "title": "Climate Change Paris 2015: event signup",
36
+ "type": "EventSignup",
37
+ "updated_at": "2017-09-01T14:49:50",
38
+ "url": ""
39
+ }
40
+ ]
41
+ }
@@ -45,4 +45,28 @@ describe ActionKitRest::Pages::EventCampaignPage do
45
45
  expect(a_request(:post, 'https://test.com/rest/v1/eventsignuppage/')).to have_been_made
46
46
  end
47
47
  end
48
+
49
+ describe 'find' do
50
+ let(:actionkit) { ActionKitRest.new(host: 'test.com') }
51
+
52
+ let(:event_campaign_title) { "Climate Change Paris 2015" }
53
+ let(:event_campaign_name) { "climate-change-paris-2015" }
54
+
55
+ before :each do
56
+ stub_request(:get, 'https://test.com/rest/v1/campaign/?name=climate-change-paris-2015')
57
+ .to_return(body: fixture('page/find_campaign.json'), status: '200', headers: {content_type: "application/json; charset=utf-8"})
58
+ stub_request(:get, "https://test.com/rest/v1/eventcreatepage/?name=climate-change-paris-2015-event-create")
59
+ .to_return(body: fixture('page/find_event_create.json'), status: '200', headers: {content_type: "application/json; charset=utf-8"})
60
+ stub_request(:get, "https://test.com/rest/v1/eventsignuppage/?name=climate-change-paris-2015-event-signup")
61
+ .to_return(body: fixture('page/find_event_signup.json'), status: '200', headers: {content_type: "application/json; charset=utf-8"})
62
+ end
63
+
64
+ it 'should retrieve event campaign by name' do
65
+ resp = actionkit.event_campaign_page.find(event_campaign_name)
66
+
67
+ expect(resp.name).to eq event_campaign_name
68
+ expect(resp.event_create_page_name).to eq 'climate-change-paris-2015-event-create'
69
+ expect(resp.event_signup_page_name).to eq 'climate-change-paris-2015-event-signup'
70
+ end
71
+ end
48
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_kit_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-08-15 00:00:00.000000000 Z
13
+ date: 2017-09-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vertebrae
@@ -189,6 +189,9 @@ files:
189
189
  - spec/fixtures/error.json
190
190
  - spec/fixtures/page/campaign.json
191
191
  - spec/fixtures/page/collection.json
192
+ - spec/fixtures/page/find_campaign.json
193
+ - spec/fixtures/page/find_event_create.json
194
+ - spec/fixtures/page/find_event_signup.json
192
195
  - spec/fixtures/page/object.json
193
196
  - spec/fixtures/phone/object.json
194
197
  - spec/fixtures/user/object_with_phones.json