Module: DiasporaFederation::Entities::Post

Included in:
StatusMessage
Defined in:
lib/diaspora_federation/entities/post.rb

Overview

This is a module that defines common properties for a post which include StatusMessage and Reshare.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#authorString (readonly)

The diaspora* ID of the person who posts the post



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end

#created_atTime (readonly)

Post entity creation time



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end

#guidString (readonly)

A random string of at least 16 chars



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end

#provider_display_nameString (readonly)

A string that describes a means by which a user has posted the post



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end

#publicBoolean (readonly)

Shows whether the post is visible to everyone or only to some aspects



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end

Class Method Details

.included(entity) ⇒ Object

On inclusion of this module the required properties for a post are added to the object that includes it.



31
32
33
34
35
36
37
38
39
# File 'lib/diaspora_federation/entities/post.rb', line 31

def self.included(entity)
  entity.class_eval do
    property :author, :string, xml_name: :diaspora_handle
    property :guid, :string
    property :created_at, :timestamp, default: -> { Time.now.utc }
    property :public, :boolean, default: false
    property :provider_display_name, :string, optional: true
  end
end