Class: Chatroid::Adapter::Twitter::Event
- Inherits:
-
Object
- Object
- Chatroid::Adapter::Twitter::Event
- Defined in:
- lib/chatroid/adapter/twitter/event.rb
Constant Summary collapse
- TYPES =
%w[ favorite unfavorite follow unfollow list_member_added list_member_removed list_user_subscribed list_user_unsubscribed ].freeze
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(json, user_id) ⇒ Event
constructor
A new instance of Event.
- #type ⇒ Object
Constructor Details
#initialize(json, user_id) ⇒ Event
Returns a new instance of Event.
20 21 22 23 |
# File 'lib/chatroid/adapter/twitter/event.rb', line 20 def initialize(json, user_id) @params = JSON.parse(json) @user_id = user_id end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
18 19 20 |
# File 'lib/chatroid/adapter/twitter/event.rb', line 18 def params @params end |
Instance Method Details
#type ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chatroid/adapter/twitter/event.rb', line 25 def type if has_event_type? && targeted_to_me? @params["event"] elsif reply_to_me? "reply" elsif tweet? "tweet" elsif favorite? "favorite_other" else "unknown" end end |