Module: ActionKitApi
- Defined in:
- lib/action_kit_api/connection.rb,
lib/action_kit_api.rb,
lib/action_kit_api/page.rb,
lib/action_kit_api/user.rb,
lib/action_kit_api/event.rb,
lib/action_kit_api/action.rb,
lib/action_kit_api/version.rb,
lib/action_kit_api/data_model.rb,
lib/action_kit_api/searchable.rb,
lib/action_kit_api/event_campaign.rb,
lib/action_kit_api/page_types/signup.rb,
lib/action_kit_api/page_types/petition.rb,
lib/action_kit_api/page_types/unsubscribe.rb,
lib/action_kit_api/page_types/event_create.rb,
lib/action_kit_api/page_types/event_signup.rb
Overview
This is the connection information for the ActionKit API which is used throughout the rest of the Gem (a connection being required for … well every operation … this is a remote API gem :)
Defined Under Namespace
Modules: Searchable Classes: Action, ApiDataModel, Connection, Event, EventCampaign, EventCreatePage, EventSignupPage, MissingRequiredAttributeException, Page, PetitionPage, SignupPage, UnsubscribePage, User
Constant Summary collapse
- VERSION =
"0.4.8"
- @@connection =
nil
Class Method Summary collapse
-
.act(page, user, args = {}) ⇒ Object
Takes a page object and a user object and a hash of any additional attributes and records the action.
-
.connect(username, password, hostname) ⇒ Object
Takes username, password, and hostname.
- .connection ⇒ Object
- .raw_act(*args) ⇒ Object
Class Method Details
.act(page, user, args = {}) ⇒ Object
Takes a page object and a user object and a hash of any additional attributes and records the action. Will return a Action object with status information and unique identifiers
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/action_kit_api.rb', line 28 def self.act(page, user, args = {}) return false unless page.valid? and user.valid? # Ensure we have an ActionKit ID before performing the action user.save if user.akid.nil? # Include the supplied arguments overiding akid and page name if they # were supplied with those in the page and user act_attrs = args.update({ "page" => page.name, "akid" => user.akid, }) self.raw_act(act_attrs) end |
.connect(username, password, hostname) ⇒ Object
Takes username, password, and hostname. This is simply a wrapper to ActionKitAPi::Connection.connect to make the gem a bit easier to use
52 53 54 |
# File 'lib/action_kit_api.rb', line 52 def self.connect(username, password, hostname) @@connection = ActionKitApi::Connection.new(username, password, hostname) end |
.connection ⇒ Object
56 57 58 |
# File 'lib/action_kit_api.rb', line 56 def self.connection @@connection end |
.raw_act(*args) ⇒ Object
44 45 46 47 48 |
# File 'lib/action_kit_api.rb', line 44 def self.raw_act(*args) response = @@connection.call('act', *args) ActionKitApi::Action.new(response) end |