Class: OEHClient::Realtime::Event
- Inherits:
-
Object
- Object
- OEHClient::Realtime::Event
- Defined in:
- lib/oehclient/realtime/event.rb
Constant Summary collapse
- URI_RT_TRACK_PART =
"one/rt/track"
- URI_EVENTS =
"events"
- ONE_PARAM_URI =
ONE attributes that are either in the request and/or returned in the response
"uri"
- ONE_PARAM_TID =
"tid"
- ONE_PARAM_PROPERTIES =
"properties"
- ONE_PROPERTIES_NAME =
Property Hash Keys
"name"
- ONE_PROPERTIES_VALUE =
"value"
Instance Attribute Summary collapse
-
#space ⇒ Object
——-[ CLASS ATTRIBUTES ].
-
#tid ⇒ Object
——-[ CLASS ATTRIBUTES ].
-
#uri ⇒ Object
——-[ CLASS ATTRIBUTES ].
Class Method Summary collapse
-
.post(site_key, uri, properties = {}) ⇒ Object
class-level wrapper to post a new interaction to the OEH server using either the realtime or offline API for an anonymous or known prospects/customer.
Instance Method Summary collapse
-
#initialize(attributes = nil) ⇒ Event
constructor
constructor that allows the passed Ruby Hash to be mapped to the.
- #send(properties = {}) ⇒ Object
Constructor Details
#initialize(attributes = nil) ⇒ Event
constructor that allows the passed Ruby Hash to be mapped to the
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/oehclient/realtime/event.rb', line 44 def initialize(attributes=nil) # set the instance attributes is the parameter hash is created if (!attributes.nil? && attributes.kind_of?(Hash)) @uri = attributes[:uri] if (attributes.has_key?(:uri)) @tid = attributes[:tid] if (attributes.has_key?(:tid)) @space = OEHClient::Config::SpaceManager.instance.get(attributes[:sk]) if (attributes.has_key?(:sk)) end end |
Instance Attribute Details
#space ⇒ Object
——-[ CLASS ATTRIBUTES ]
19 20 21 |
# File 'lib/oehclient/realtime/event.rb', line 19 def space @space end |
#tid ⇒ Object
——-[ CLASS ATTRIBUTES ]
19 20 21 |
# File 'lib/oehclient/realtime/event.rb', line 19 def tid @tid end |
#uri ⇒ Object
——-[ CLASS ATTRIBUTES ]
19 20 21 |
# File 'lib/oehclient/realtime/event.rb', line 19 def uri @uri end |
Class Method Details
.post(site_key, uri, properties = {}) ⇒ Object
class-level wrapper to post a new interaction to the OEH server using either the realtime or offline API for an anonymous or known prospects/customer
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/oehclient/realtime/event.rb', line 26 def self.post(site_key, uri, properties={}) # setup the baseline attributes hash with the site_key and interaction URI, which are the # minimal values needed for an interaction attributes = {:sk => site_key,:uri => uri} # create a new interaction using all attributes pass new_event = OEHClient::Realtime::Event.new(attributes) # Send the interaction for processing and return the instance of the interaction class new_event.send(properties) end |
Instance Method Details
#send(properties = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/oehclient/realtime/event.rb', line 58 def send(properties={}) send_args = {:payload => ActiveSupport::JSON.encode(request_data(properties))} send_args[:header] = properties[:header] if (!properties.nil? && properties.has_key?(:header)) # send the POST or PUT methond along with the arguments to the OEHClient class map_response(OEHClient.send(OEHClient::Helper::Request::POST_METHOD.to_sym, request_url, nil, send_args)) self end |