action_kit_api 0.3.11 → 0.3.12
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.
@@ -39,10 +39,11 @@ module ActionKitApi
|
|
39
39
|
signup_page_name = "#{self.name}_signup"
|
40
40
|
create_page_name = "#{self.name}_create"
|
41
41
|
|
42
|
-
# These two calls trigger an exception EVEN IF THEY SUCCEED
|
42
|
+
# These two calls trigger an exception EVEN IF THEY SUCCEED, since there
|
43
|
+
# won't be any events for them yet :-/
|
43
44
|
begin
|
44
45
|
if ActionKitApi::Page.find_by_name(signup_page_name).nil?
|
45
|
-
signup_page = ActionKitApi::EventSignupPage.new(:name => signup_page_name, :title => "
|
46
|
+
signup_page = ActionKitApi::EventSignupPage.new(:name => signup_page_name, :title => "{self.title} - Attend", :campaign_id => self.id)
|
46
47
|
signup_page.save
|
47
48
|
end
|
48
49
|
rescue
|
@@ -50,20 +51,25 @@ module ActionKitApi
|
|
50
51
|
|
51
52
|
begin
|
52
53
|
if ActionKitApi::Page.find_by_name(create_page_name).nil?
|
53
|
-
create_page = ActionKitApi::EventCreatePage.new(:name => create_page_name, :title => "
|
54
|
+
create_page = ActionKitApi::EventCreatePage.new(:name => create_page_name, :title => "{self.title} - Host", :campaign_id => self.id)
|
54
55
|
create_page.save
|
55
56
|
end
|
56
57
|
rescue
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
def create_event(*args)
|
62
|
+
raise "EventCampaign needs to be saved before Event creation" if self.id.nil?
|
63
|
+
|
64
|
+
(args[0]).merge(:campaign_id => self.id)
|
65
|
+
|
66
|
+
event = ActionKitApi::Event.new(*args)
|
67
|
+
event.save
|
68
|
+
|
69
|
+
result = ActionKitApi.connection.call("EventCreate.create", {:event_id => event.id})
|
70
|
+
|
71
|
+
event
|
72
|
+
end
|
67
73
|
|
68
74
|
# Uses public_search so is subject those limitations
|
69
75
|
def find_local_events(zip, radius)
|
@@ -66,9 +66,9 @@ module ActionKitApi
|
|
66
66
|
response_objects
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
def class_name.count(search)
|
70
|
+
ActionKitApi.connection.call("#{class_name}.count", search)
|
71
|
+
end
|
72
72
|
|
73
73
|
# Helper method for method_missing and the find_* virtual methods that
|
74
74
|
# parses part of a method name and arguments into a hash usuable for the
|