Class: Firering::Message
- Inherits:
-
Struct
- Object
- Struct
- Firering::Message
- Extended by:
- Instantiator
- Defined in:
- lib/firering/data/message.rb,
lib/firering/data/message.rb
Constant Summary collapse
- MESSAGE_TYPES =
%w[ TextMessage PasteMessage SoundMessage AdvertisementMessage AllowGuestsMessage DisallowGuestsMessage IdleMessage KickMessage LeaveMessage SystemMessage TimestampMessage TopicChangeMessage UnidleMessage UnlockMessage UploadMessage ]
Instance Attribute Summary collapse
-
#body ⇒ Object
(also: #to_s)
Returns the value of attribute body.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#room_id ⇒ Object
Returns the value of attribute room_id.
-
#starred ⇒ Object
Returns the value of attribute starred.
-
#tweet ⇒ Object
Returns the value of attribute tweet.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
- #from_user? ⇒ Boolean
- #room(&callback) ⇒ Object
-
#star(id, yes_or_no = true, &callback) ⇒ Object
Highlights a message / Removes a message highlight.
- #user(&callback) ⇒ Object
Methods included from Instantiator
Instance Attribute Details
#body ⇒ Object Also known as: to_s
Returns the value of attribute body
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def body @body end |
#connection ⇒ Object
Returns the value of attribute connection
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def connection @connection end |
#created_at ⇒ Object
Returns the value of attribute created_at
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def description @description end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def id @id end |
#room_id ⇒ Object
Returns the value of attribute room_id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def room_id @room_id end |
#starred ⇒ Object
Returns the value of attribute starred
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def starred @starred end |
#tweet ⇒ Object
Returns the value of attribute tweet
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def tweet @tweet end |
#type ⇒ Object
Returns the value of attribute type
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def type @type end |
#url ⇒ Object
Returns the value of attribute url
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def url @url end |
#user_id ⇒ Object
Returns the value of attribute user_id
2 3 4 |
# File 'lib/firering/data/message.rb', line 2 def user_id @user_id end |
Instance Method Details
#from_user? ⇒ Boolean
29 30 31 |
# File 'lib/firering/data/message.rb', line 29 def from_user? !user_id.nil? && (!user_id.instance_of?(String) || user_id !~ /^\s*$/) end |
#room(&callback) ⇒ Object
38 39 40 |
# File 'lib/firering/data/message.rb', line 38 def room(&callback) connection.room(room_id, &callback) end |
#star(id, yes_or_no = true, &callback) ⇒ Object
Highlights a message / Removes a message highlight.
34 35 36 |
# File 'lib/firering/data/message.rb', line 34 def star(id, yes_or_no = true, &callback) connection.(id, yes_or_no, &callback) end |
#user(&callback) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/firering/data/message.rb', line 42 def user(&callback) if from_user? connection.user(user_id, &callback) else callback.call(nil, connection) end end |