Class: Socialmod::Callback
- Inherits:
-
Object
- Object
- Socialmod::Callback
- Defined in:
- lib/socialmod/callback.rb
Instance Attribute Summary collapse
-
#custom_id ⇒ Object
readonly
Returns the value of attribute custom_id.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #deferred? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(params) ⇒ Callback
constructor
A new instance of Callback.
- #item ⇒ Object
- #passed? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(params) ⇒ Callback
Returns a new instance of Callback.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/socialmod/callback.rb', line 13 def initialize(params) @params = params @id = params['id'] @timestamp = params['timestamp'] @custom_id = params['custom_id'] @state = params['state'] @signature = params['signature'] @time = Time.at(@timestamp.to_i) @data = params['data'] @src = params['src'] end |
Instance Attribute Details
#custom_id ⇒ Object (readonly)
Returns the value of attribute custom_id.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def custom_id @custom_id end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def id @id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def params @params end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def signature @signature end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def src @src end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def state @state end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def time @time end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
3 4 5 |
# File 'lib/socialmod/callback.rb', line 3 def @timestamp end |
Instance Method Details
#deferred? ⇒ Boolean
37 38 39 |
# File 'lib/socialmod/callback.rb', line 37 def deferred? state == 'deferred' end |
#failed? ⇒ Boolean
33 34 35 |
# File 'lib/socialmod/callback.rb', line 33 def failed? state == 'failed' end |
#item ⇒ Object
41 42 43 |
# File 'lib/socialmod/callback.rb', line 41 def item id && Socialmod::Item.find(id) end |
#passed? ⇒ Boolean
29 30 31 |
# File 'lib/socialmod/callback.rb', line 29 def passed? state == 'passed' end |
#valid? ⇒ Boolean
25 26 27 |
# File 'lib/socialmod/callback.rb', line 25 def valid? hmac == @signature end |