action_kit_api 0.3.9 → 0.3.10
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.
- data/lib/action_kit_api/event.rb +4 -3
- data/lib/action_kit_api/event_campaign.rb +28 -5
- data/lib/action_kit_api/page.rb +6 -3
- data/lib/action_kit_api/page_types/event_create.rb +14 -0
- data/lib/action_kit_api/page_types/event_signup.rb +14 -0
- data/lib/action_kit_api/version.rb +1 -1
- data/lib/action_kit_api.rb +5 -3
- metadata +4 -2
data/lib/action_kit_api/event.rb
CHANGED
@@ -5,7 +5,7 @@ module ActionKitApi
|
|
5
5
|
include Searchable
|
6
6
|
|
7
7
|
# Required
|
8
|
-
attr_accessor :id, :campaign_id, :creator_id
|
8
|
+
attr_accessor :id, :campaign_id, :creator_id
|
9
9
|
|
10
10
|
# Other/Active
|
11
11
|
attr_accessor :address1, :address2, :attendee_count, :city, :country,
|
@@ -13,10 +13,11 @@ module ActionKitApi
|
|
13
13
|
:is_full, :is_in_past, :is_open_for_signup, :is_private,
|
14
14
|
:latitude, :longitude, :max_attendees, :note_to_attendees,
|
15
15
|
:notes, :phone, :plus4, :postal, :public_description, :region,
|
16
|
-
:starts_at, :state, :status, :status_summary, :
|
16
|
+
:starts_at, :state, :status, :status_summary, :title, :venue,
|
17
|
+
:zip
|
17
18
|
|
18
19
|
def initialize(*args)
|
19
|
-
@required_attrs = [:campaign_id, :creator_id
|
20
|
+
@required_attrs = [:campaign_id, :creator_id]
|
20
21
|
@read_only_attrs = [:attendee_count]
|
21
22
|
|
22
23
|
super
|
@@ -26,15 +26,38 @@ module ActionKitApi
|
|
26
26
|
@show_address1 ||= true
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
# After creating a new event campaign we need to create the
|
30
|
+
# associated signup and hosting pages. These will follow the
|
31
|
+
# ActionKit convention to prevent them from getting wise. This
|
32
|
+
# is so we don't have to use that sketchy part of their API
|
33
|
+
def after_save
|
34
|
+
# Only continue if we have a valid id
|
35
|
+
if self.id.nil?
|
36
|
+
return
|
37
|
+
end
|
31
38
|
|
32
|
-
|
33
|
-
|
39
|
+
signup_page_name = "#{self.name}_signup"
|
40
|
+
create_page_name = "#{self.name}_create"
|
34
41
|
|
35
|
-
ActionKitApi::
|
42
|
+
if ActionKitApi::EventSignupPage.find_by_name(signup_page_name).nil?
|
43
|
+
signup_page = ActionKitApi::EventSignupPage.new(:name => signup_page_name, :title => "#{self.title} - Attend", :campaign_id => self.id)
|
44
|
+
signup_page.save
|
45
|
+
end
|
46
|
+
|
47
|
+
if ActionKitApi::EventCreatePage.find_by_name(create_page_name).nil?
|
48
|
+
create_page = ActionKitApi::EventCreatePage.new(:name => create_page_name, :title => "#{self.title} - Host", :campaign_id => self.id)
|
49
|
+
create_page.save
|
50
|
+
end
|
36
51
|
end
|
37
52
|
|
53
|
+
# def create_event(*args)
|
54
|
+
# raise "EventCampaign needs to be saved before Event creation" if self.id.nil?
|
55
|
+
#
|
56
|
+
# args[0].merge {:campaign_id => self.id}
|
57
|
+
#
|
58
|
+
# ActionKitApi::Event.new(*args)
|
59
|
+
# end
|
60
|
+
|
38
61
|
# Uses public_search so is subject those limitations
|
39
62
|
def find_local_events(zip, radius)
|
40
63
|
self.public_search(:zip => zip, :radius => radius)
|
data/lib/action_kit_api/page.rb
CHANGED
@@ -12,11 +12,14 @@ module ActionKitApi
|
|
12
12
|
attr_accessor :id, :name, :title, :type
|
13
13
|
|
14
14
|
# Other/Active
|
15
|
-
attr_accessor :
|
16
|
-
:
|
15
|
+
attr_accessor :canonical_url, :custom_fields, :hidden, :hosted_with, :goal,
|
16
|
+
:goal_type, :lang, :list, :multilingual_campaign,
|
17
|
+
:required_fields, :status, :tags, :url
|
17
18
|
|
18
19
|
def initialize(*args)
|
19
|
-
@required_attrs
|
20
|
+
@required_attrs ||= []
|
21
|
+
@required_attrs.concat([:name, :title, :type])
|
22
|
+
|
20
23
|
super
|
21
24
|
end
|
22
25
|
end
|
data/lib/action_kit_api.rb
CHANGED
@@ -5,17 +5,19 @@ require "action_kit_api/searchable"
|
|
5
5
|
require "action_kit_api/data_model"
|
6
6
|
|
7
7
|
# Extensions to the data model for specific information
|
8
|
+
require "action_kit_api/event"
|
9
|
+
require "action_kit_api/event_campaign"
|
8
10
|
require "action_kit_api/user"
|
9
11
|
require "action_kit_api/page"
|
10
12
|
require "action_kit_api/action"
|
11
|
-
require "action_kit_api/event"
|
12
|
-
require "action_kit_api/event_campaign"
|
13
13
|
|
14
14
|
# Page types
|
15
|
+
require "action_kit_api/page_types/event_create"
|
16
|
+
require "action_kit_api/page_types/event_signup"
|
17
|
+
require "action_kit_api/page_types/import"
|
15
18
|
require "action_kit_api/page_types/petition"
|
16
19
|
require "action_kit_api/page_types/signup"
|
17
20
|
require "action_kit_api/page_types/unsubscribe"
|
18
|
-
require "action_kit_api/page_types/import"
|
19
21
|
|
20
22
|
module ActionKitApi
|
21
23
|
@@connection = nil
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 10
|
9
|
+
version: 0.3.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sam Stelfox
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- lib/action_kit_api/event.rb
|
74
74
|
- lib/action_kit_api/event_campaign.rb
|
75
75
|
- lib/action_kit_api/page.rb
|
76
|
+
- lib/action_kit_api/page_types/event_create.rb
|
77
|
+
- lib/action_kit_api/page_types/event_signup.rb
|
76
78
|
- lib/action_kit_api/page_types/import.rb
|
77
79
|
- lib/action_kit_api/page_types/petition.rb
|
78
80
|
- lib/action_kit_api/page_types/signup.rb
|