action_kit_api 0.1.3 → 0.1.4

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.
@@ -16,26 +16,5 @@ module ActionKitApi
16
16
  @required_attrs = [:page, :user]
17
17
  super
18
18
  end
19
-
20
- # Takes a page object and a user object and a hash of any additional
21
- # attributes and records the action. Will return a Action object with
22
- # status information and unique identifiers
23
- def act(page, user, args = {})
24
- return false unless page.valid? and user.valid?
25
-
26
- # Ensure we have an ActionKit ID before performing the action
27
- user.save if user.akid.nil?
28
-
29
- # Include the supplied arguments overiding akid and page name if they
30
- # were supplied with those in the page and user
31
- act_attrs = args.update({
32
- "page" => page.name,
33
- "akid" => user.akid,
34
- })
35
-
36
- response = ActionKitApi::Connection.call('act', act_attrs)
37
-
38
- self.new(response)
39
- end
40
19
  end
41
20
  end
@@ -61,12 +61,21 @@ module ActionKitApi
61
61
  # and add a CA to authenticate against
62
62
  @@connection.instance_variable_get("@http").verify_mode = OpenSSL::SSL::VERIFY_PEER
63
63
  @@connection.instance_variable_get("@http").ca_file = File.join(File.dirname(__FILE__), "actionkit_ca_chain.pem")
64
+
65
+ return nil
64
66
  end
65
67
 
66
68
  def self.call(command, args = {})
67
69
  raise NoConnection if @@connection.nil?
68
-
69
- @@connection.call(command, args)
70
+
71
+ # XMLRPC::Client doesn't flush it's IO buffer which occasionally
72
+ # causes a second command in the same session to fail with an EOFError
73
+ # calling it again after that will actually execute the command
74
+ begin
75
+ @@connection.call(command, args)
76
+ rescue EOFError
77
+ @@connection.call(command, args)
78
+ end
70
79
  end
71
80
 
72
81
  def self.version
@@ -1,3 +1,3 @@
1
1
  module ActionKitApi
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -12,3 +12,26 @@ require "action_kit_api/page_types/petition"
12
12
  require "action_kit_api/page_types/signup"
13
13
  require "action_kit_api/page_types/unsubscribe"
14
14
  require "action_kit_api/page_types/import"
15
+
16
+ module ActionKitApi
17
+ # Takes a page object and a user object and a hash of any additional
18
+ # attributes and records the action. Will return a Action object with
19
+ # status information and unique identifiers
20
+ def self.act(page, user, args = {})
21
+ return false unless page.valid? and user.valid?
22
+
23
+ # Ensure we have an ActionKit ID before performing the action
24
+ user.save if user.akid.nil?
25
+
26
+ # Include the supplied arguments overiding akid and page name if they
27
+ # were supplied with those in the page and user
28
+ act_attrs = args.update({
29
+ "page" => page.name,
30
+ "akid" => user.akid,
31
+ })
32
+
33
+ response = ActionKitApi::Connection.call('act', act_attrs)
34
+
35
+ ActionKitApi::Action.new(response)
36
+ end
37
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sam Stelfox
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-22 00:00:00 -05:00
17
+ date: 2012-02-23 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency