Class: Ayadn::PostObject

Inherits:
Object show all
Defined in:
lib/ayadn/post_object.rb

Overview

also works for messages

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ PostObject

Returns a new instance of PostObject.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/ayadn/post_object.rb', line 89

def initialize hash
  @input = hash
  @num_stars = @input["num_stars"]
  @num_reposts = @input["num_reposts"]
  @num_replies = @input["num_replies"]
  @text = @input["text"]
  @created_at = @input["created_at"]
  @id = @input["id"]
  @canonical_url = @input["canonical_url"]
  @machine_only = @input["machine_only"]
  @you_reposted = @input["you_reposted"]
  @you_starred = @input["you_starred"]
  @thread_id = @input["thread_id"]
  @pagination_id = @input["pagination_id"]
  @source = PostSourceObject.new(@input)
  @entities = EntitiesObject.new(@input)
  @user = UserObject.new(@input["user"])
  if !@input["annotations"].nil?
    @annotations = @input["annotations"].map { |hash| PostAnnotationObject.new(hash) }
  else
    @annotations = []
  end
  @repost_of = PostObject.new(@input["repost_of"]) if !@input["repost_of"].blank?
  @reply_to = @input["reply_to"]
  @is_deleted = @input["is_deleted"]
  @channel_id = @input["channel_id"]
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def annotations
  @annotations
end

#canonical_urlObject (readonly)

Returns the value of attribute canonical_url.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def canonical_url
  @canonical_url
end

#channel_idObject (readonly)

Returns the value of attribute channel_id.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def channel_id
  @channel_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def created_at
  @created_at
end

#entitiesObject (readonly)

Returns the value of attribute entities.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def entities
  @entities
end

#idObject (readonly)

Returns the value of attribute id.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def id
  @id
end

#inputObject (readonly)

Returns the value of attribute input.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def input
  @input
end

#is_deletedObject (readonly)

Returns the value of attribute is_deleted.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def is_deleted
  @is_deleted
end

#machine_onlyObject (readonly)

Returns the value of attribute machine_only.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def machine_only
  @machine_only
end

#num_repliesObject (readonly)

Returns the value of attribute num_replies.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def num_replies
  @num_replies
end

#num_repostsObject (readonly)

Returns the value of attribute num_reposts.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def num_reposts
  @num_reposts
end

#num_starsObject (readonly)

Returns the value of attribute num_stars.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def num_stars
  @num_stars
end

#pagination_idObject (readonly)

Returns the value of attribute pagination_id.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def pagination_id
  @pagination_id
end

#reply_toObject (readonly)

Returns the value of attribute reply_to.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def reply_to
  @reply_to
end

#repost_ofObject (readonly)

Returns the value of attribute repost_of.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def repost_of
  @repost_of
end

#sourceObject (readonly)

Returns the value of attribute source.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def source
  @source
end

#textObject (readonly)

Returns the value of attribute text.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def text
  @text
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def thread_id
  @thread_id
end

#userObject (readonly)

Returns the value of attribute user.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def user
  @user
end

#viewObject

Returns the value of attribute view.



87
88
89
# File 'lib/ayadn/post_object.rb', line 87

def view
  @view
end

#you_repostedObject (readonly)

Returns the value of attribute you_reposted.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def you_reposted
  @you_reposted
end

#you_starredObject (readonly)

Returns the value of attribute you_starred.



86
87
88
# File 'lib/ayadn/post_object.rb', line 86

def you_starred
  @you_starred
end