Class: Jirafe::Callback::Event
Constant Summary
collapse
- GLOBAL_ACTION =
{
:noop => "noop"
}
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
callback_url, logger, notify
included
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4
5
6
|
# File 'lib/jirafe/callback/event.rb', line 4
def action
@action
end
|
#data ⇒ Object
Returns the value of attribute data.
4
5
6
|
# File 'lib/jirafe/callback/event.rb', line 4
def data
@data
end
|
#version ⇒ Object
Returns the value of attribute version.
4
5
6
|
# File 'lib/jirafe/callback/event.rb', line 4
def version
@version
end
|
Class Method Details
.events_url ⇒ Object
11
12
13
|
# File 'lib/jirafe/callback/event.rb', line 11
def events_url
"/events"
end
|
.send(site_id, token, events) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/jirafe/callback/event.rb', line 15
def send(site_id, token, events)
raise Jirafe::Error::MissingSiteId if site_id.nil?
response = post(events_url, {:body => {
"siteId" => site_id,
"token" => token,
"timestamp" => Time.now.to_i,
"events" => events.to_json
}})
check_response_for_exception(response)
true
end
|
.trust_callback?(token, confirmation_token, confirmation_hash) ⇒ Boolean
27
28
29
|
# File 'lib/jirafe/callback/event.rb', line 27
def trust_callback?(token, confirmation_token, confirmation_hash)
Digest::SHA1.hexdigest(confirmation_token.to_s + token.to_s) == confirmation_hash
end
|
Instance Method Details
#action_map ⇒ Object
32
33
34
|
# File 'lib/jirafe/callback/event.rb', line 32
def action_map
{}
end
|
#to_json(*args) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/jirafe/callback/event.rb', line 44
def to_json(*args)
{
"v" => version,
"a" => action,
"d" => data
}.to_json(*args)
end
|