diaspora_federation/lib/diaspora_federation/entities/message.rb
cmrd Senya a0545c37de Allow parent entity types different than "Post"
Entities::Message requires "Conversation" at the place, for instance.
2015-12-21 14:05:42 +03:00

42 lines
1.2 KiB
Ruby

module DiasporaFederation
module Entities
# this entity represents a private message exchanged in private conversation
#
# @see Validators::MessageValidator
class Message < Entity
# @!attribute [r] guid
# a random string of at least 16 chars.
# @see Validation::Rule::Guid
# @return [String] message guid
property :guid
include Relayable
# @!attribute [r] text
# text of the message composed by a user
# @return [String] text
property :text
# @!attribute [r] created_at
# message creation time
# @return [Time] creation time
property :created_at, default: -> { Time.now.utc }
# @!attribute [r] diaspora_id
# The diaspora ID of the message author.
# @see Person#diaspora_id
# @return [String] diaspora ID
property :diaspora_id, xml_name: :diaspora_handle
# @!attribute [r] conversation_guid
# guid of a conversation this message belongs to
# @see Conversation#guid
# @return [String] conversation guid
property :conversation_guid
def self.get_target_entity_type(*)
"Conversation"
end
end
end
end