Class: Tinysky::FeedPost

Inherits:
Object
  • Object
show all
Defined in:
lib/tinysky/feed_post.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, options) ⇒ FeedPost

Returns a new instance of FeedPost.



3
4
5
6
# File 'lib/tinysky/feed_post.rb', line 3

def initialize(text, options)
  @text = text
  @options = options
end

Instance Method Details

#to_hashObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tinysky/feed_post.rb', line 8

def to_hash
  hsh = {
    "$type" => Tinysky::Lexicon::FEED_POST,
    "createdAt" => created_at,
    "langs" => ["en-US"],
    "text" => @text
  }

  hsh["embed"] = embed.to_hash unless embed.nil?
  hsh["facets"] = facets.map(&:to_hash) if facets.any?

  hsh
end