Class: Turntabler::Message

Inherits:
Resource show all
Defined in:
lib/turntabler/message.rb

Overview

Represents a message that was sent to or from the current user. This can either be within the context of a room or a private conversation.

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Method Summary

Methods inherited from Resource

#==, attribute, #attributes=, #hash, #initialize, #load, #loaded?, #pretty_print, #pretty_print_instance_variables

Methods included from Assertions

#assert_valid_keys, #assert_valid_values

Methods included from DigestHelpers

#digest

Constructor Details

This class inherits a constructor from Turntabler::Resource

Instance Attribute Details

#contentString (readonly)

The text of the message

Returns:

  • (String)


16
# File 'lib/turntabler/message.rb', line 16

attribute :content, :text

#created_atTime (readonly)

The time at which the message was created

Returns:

  • (Time)


20
21
22
# File 'lib/turntabler/message.rb', line 20

attribute :created_at, :time do |value|
  Time.at(value)
end

#senderTurntabler::User (readonly)

The user who sent the message

Returns:



10
11
12
# File 'lib/turntabler/message.rb', line 10

attribute :sender, :senderid do |id|
  room? ? room.build_user(:_id => id) : User.new(client, :_id => id)
end