Class: HipTail::Event
- Inherits:
-
Object
- Object
- HipTail::Event
- Defined in:
- lib/hiptail/event.rb
Direct Known Subclasses
Defined Under Namespace
Classes: RoomEnter, RoomExit, RoomMessage, RoomMessaging, RoomNotification, RoomTopicChange, RoomVisiting
Instance Attribute Summary collapse
-
#authority ⇒ Object
Returns the value of attribute authority.
- #oauth_client_id ⇒ String readonly
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
- #type ⇒ String readonly
- #webhook_id ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(params) ⇒ HipTail::Event constructor
Constructor Details
#initialize(params) ⇒ HipTail::Event
9 10 11 |
# File 'lib/hiptail/event.rb', line 9 def initialize(params) @raw = params.dup end |
Instance Attribute Details
#authority ⇒ Object
Returns the value of attribute authority.
5 6 7 |
# File 'lib/hiptail/event.rb', line 5 def @authority end |
#oauth_client_id ⇒ String (readonly)
21 22 23 |
# File 'lib/hiptail/event.rb', line 21 def oauth_client_id @raw['oauth_client_id'] end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/hiptail/event.rb', line 6 def raw @raw end |
#type ⇒ String (readonly)
15 16 17 |
# File 'lib/hiptail/event.rb', line 15 def type @raw['event'] end |
#webhook_id ⇒ String (readonly)
27 28 29 |
# File 'lib/hiptail/event.rb', line 27 def webhook_id @raw['webhook_id'] end |
Class Method Details
.parse(params) ⇒ HipTail::Event
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hiptail/event.rb', line 34 def parse(params) type = params['event'] case params['event'] when 'room_message' return Event::RoomMessage.new(params) when 'room_notification' return Event::RoomNotification.new(params) when 'room_topic_change' return Event::RoomTopicChange.new(params) when 'room_enter' return Event::RoomEnter.new(params) when 'room_exit' return Event::RoomExit.new(params) else return Event.new(params) end end |