Class: GSGraph::PromotablePost
- Defined in:
- lib/gs_graph/promotable_post.rb
Instance Attribute Summary collapse
-
#is_published ⇒ Object
Returns the value of attribute is_published.
-
#scheduled_publish_time ⇒ Object
Returns the value of attribute scheduled_publish_time.
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
-
#initialize(identifier, attributes = {}) ⇒ PromotablePost
constructor
A new instance of PromotablePost.
- #publish!(options = {}) ⇒ Object
- #publishable? ⇒ Boolean (also: #schedulable?)
- #schedule!(time, options = {}) ⇒ Object
- #scheduled? ⇒ Boolean
- #unschedule!(options = {}) ⇒ Object
Methods included from Searchable
search, #search, search_query_param
Methods included from Connections::Likes::Likable
Methods included from Connections::Likes
Methods included from Connections::Insights
Methods included from Connections::Comments
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/gs_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_published ⇒ Object
Returns the value of attribute is_published.
3 4 5 |
# File 'lib/gs_graph/promotable_post.rb', line 3 def is_published @is_published end |
#scheduled_publish_time ⇒ Object
Returns the value of attribute scheduled_publish_time.
3 4 5 |
# File 'lib/gs_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/gs_graph/promotable_post.rb', line 22 def publish!( = {}) update .merge(:is_published => true) end |
#publishable? ⇒ Boolean Also known as: schedulable?
13 14 15 |
# File 'lib/gs_graph/promotable_post.rb', line 13 def publishable? !@is_published end |
#schedule!(time, options = {}) ⇒ Object
26 27 28 |
# File 'lib/gs_graph/promotable_post.rb', line 26 def schedule!(time, = {}) update .merge(:scheduled_publish_time => time.to_i) end |
#scheduled? ⇒ Boolean
18 19 20 |
# File 'lib/gs_graph/promotable_post.rb', line 18 def scheduled? !!scheduled_publish_time end |
#unschedule!(options = {}) ⇒ Object
30 31 32 |
# File 'lib/gs_graph/promotable_post.rb', line 30 def unschedule!( = {}) schedule! nil, end |