action_kit_api 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 => "#{self.title} - Attend", :campaign_id => self.id)
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 => "#{self.title} - Host", :campaign_id => self.id)
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
- # def create_event(*args)
61
- # raise "EventCampaign needs to be saved before Event creation" if self.id.nil?
62
- #
63
- # args[0].merge {:campaign_id => self.id}
64
- #
65
- # ActionKitApi::Event.new(*args)
66
- # end
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
- #def class_name.count(search)
70
- # ActionKitApi.connection.call("#{class_name}.count", search)
71
- #end
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
@@ -1,3 +1,3 @@
1
1
  module ActionKitApi
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 11
9
- version: 0.3.11
8
+ - 12
9
+ version: 0.3.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sam Stelfox