Class: Warchat::Chat::Message
- Inherits:
-
Object
- Object
- Warchat::Chat::Message
- Defined in:
- lib/warchat/chat/message.rb
Constant Summary collapse
- CHAT_ID_TYPE_CHARACTER =
"character"
- CHAT_ID_TYPE_GUILD =
"guild"
- CHAT_ID_TYPE_GUILD_MEMBER =
"guild_member"
- CHAT_MSG_TYPE_AFK =
"afk"
- CHAT_MSG_TYPE_DND =
"dnd"
- CHAT_MSG_TYPE_GUILD_CHAT =
"guild_chat"
- CHAT_MSG_TYPE_GUILD_MOTD =
"motd"
- CHAT_MSG_TYPE_OFFICER_CHAT =
"officer_chat"
- CHAT_MSG_TYPE_WHISPER =
"whisper"
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#character_id ⇒ Object
readonly
Returns the value of attribute character_id.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#from_type ⇒ Object
readonly
Returns the value of attribute from_type.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #character_name ⇒ Object
-
#initialize(response) ⇒ Message
constructor
A new instance of Message.
- #realm_id ⇒ Object
Constructor Details
#initialize(response) ⇒ Message
Returns a new instance of Message.
18 19 20 21 22 23 24 25 26 |
# File 'lib/warchat/chat/message.rb', line 18 def initialize response @type = response["messageType"] @body = response['body'] @from = response["from"] if @from @from_type = from["chatIdType"] @character_id = from["characterId"] end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
16 17 18 |
# File 'lib/warchat/chat/message.rb', line 16 def body @body end |
#character_id ⇒ Object (readonly)
Returns the value of attribute character_id.
16 17 18 |
# File 'lib/warchat/chat/message.rb', line 16 def character_id @character_id end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
16 17 18 |
# File 'lib/warchat/chat/message.rb', line 16 def from @from end |
#from_type ⇒ Object (readonly)
Returns the value of attribute from_type.
16 17 18 |
# File 'lib/warchat/chat/message.rb', line 16 def from_type @from_type end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/warchat/chat/message.rb', line 16 def type @type end |
Instance Method Details
#character_name ⇒ Object
28 29 30 |
# File 'lib/warchat/chat/message.rb', line 28 def character_name @character_id and @character_id.split(':')[-2] end |
#realm_id ⇒ Object
32 33 34 |
# File 'lib/warchat/chat/message.rb', line 32 def realm_id @character_id and @character_id.split(':').last end |