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

Returns:

  • (String)

    diaspora* ID

See Also:



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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

Returns:

  • (Time)

    creation time



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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

Returns:

  • (String)

    status message guid

See Also:



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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

Returns:

  • (String)

    provider display name



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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

Returns:

  • (Boolean)

    is it public



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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.

Parameters:

  • entity (Entity)

    the entity in which it is included



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

def self.included(entity)
  entity.class_eval do
    property :author, :string
    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