Class: FbGraph::PromotablePost

Inherits:
Post
  • Object
show all
Defined in:
lib/fb_graph/promotable_post.rb

Instance Attribute Summary collapse

Attributes inherited from Post

#actions, #application, #caption, #created_time, #description, #from, #graph_object_id, #icon, #link, #message, #message_tags, #name, #picture, #place, #privacy, #properties, #source, #story, #story_tags, #targeting, #to, #type, #updated_time, #with_tags

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Searchable

search, #search, search_query_param

Methods included from Connections::Likes::Likable

#like!, #unlike!

Methods included from Connections::Likes

#likes

Methods included from Connections::Insights

#insights

Methods included from Connections::Comments

#comment!, #comments, #reply!

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ PromotablePost

Returns a new instance of PromotablePost.



5
6
7
8
9
10
11
# File 'lib/fb_graph/promotable_post.rb', line 5

def initialize(identifier, attributes = {})
  super
  @is_published = attributes[:is_published]
  @scheduled_publish_time = if attributes[:scheduled_publish_time]
    Time.at attributes[:scheduled_publish_time]
  end
end

Instance Attribute Details

#is_publishedObject

Returns the value of attribute is_published.



3
4
5
# File 'lib/fb_graph/promotable_post.rb', line 3

def is_published
  @is_published
end

#scheduled_publish_timeObject

Returns the value of attribute scheduled_publish_time.



3
4
5
# File 'lib/fb_graph/promotable_post.rb', line 3

def scheduled_publish_time
  @scheduled_publish_time
end

Instance Method Details

#publish!(options = {}) ⇒ Object



22
23
24
# File 'lib/fb_graph/promotable_post.rb', line 22

def publish!(options = {})
  update options.merge(:is_published => true)
end

#publishable?Boolean Also known as: schedulable?

Returns:

  • (Boolean)


13
14
15
# File 'lib/fb_graph/promotable_post.rb', line 13

def publishable?
  !@is_published
end

#schedule!(time, options = {}) ⇒ Object



26
27
28
# File 'lib/fb_graph/promotable_post.rb', line 26

def schedule!(time, options = {})
  update options.merge(:scheduled_publish_time => time.to_i)
end

#scheduled?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fb_graph/promotable_post.rb', line 18

def scheduled?
  !!scheduled_publish_time
end

#unschedule!(options = {}) ⇒ Object



30
31
32
# File 'lib/fb_graph/promotable_post.rb', line 30

def unschedule!(options = {})
  schedule! nil, options
end