Class: FbGraph::Post
- Extended by:
- Searchable
- Includes:
- Connections::Comments, Connections::Insights, Connections::Likes, Connections::Likes::Likable
- Defined in:
- lib/fb_graph/post.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#application ⇒ Object
Returns the value of attribute application.
-
#caption ⇒ Object
Returns the value of attribute caption.
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#description ⇒ Object
Returns the value of attribute description.
-
#from ⇒ Object
Returns the value of attribute from.
-
#graph_object_id ⇒ Object
Returns the value of attribute graph_object_id.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#link ⇒ Object
Returns the value of attribute link.
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_tags ⇒ Object
Returns the value of attribute message_tags.
-
#name ⇒ Object
Returns the value of attribute name.
-
#picture ⇒ Object
Returns the value of attribute picture.
-
#place ⇒ Object
Returns the value of attribute place.
-
#privacy ⇒ Object
Returns the value of attribute privacy.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#source ⇒ Object
Returns the value of attribute source.
-
#story ⇒ Object
Returns the value of attribute story.
-
#story_tags ⇒ Object
Returns the value of attribute story_tags.
-
#targeting ⇒ Object
Returns the value of attribute targeting.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
-
#with_tags ⇒ Object
Returns the value of attribute with_tags.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ Post
constructor
A new instance of Post.
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 = {}) ⇒ Post
Returns a new instance of Post.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 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 116 117 |
# File 'lib/fb_graph/post.rb', line 11 def initialize(identifier, attributes = {}) super if (from = attributes[:from]) @from = if from[:category] Page.new(from[:id], from) else User.new(from[:id], from) end end @to = [] if attributes[:to] Collection.new(attributes[:to]).each do |to| @to << if to[:category] Page.new(to[:id], to) elsif to[:start_time] Event.new(to[:id], to) elsif to[:version] Group.new(to[:id], to) elsif to[:namespace] Application.new(to[:id], to) else User.new(to[:id], to) end end end @with_tags = [] if attributes[:with_tags] Collection.new(attributes[:with_tags]).each do |tagged| @with_tags << User.new(tagged[:id], tagged) end end @message = attributes[:message] @message_tags = [] if ( = attributes[:message_tags]) .each do |index, | .each do || @message_tags << TaggedObject.new([:id], ) end end end @picture = attributes[:picture] @link = attributes[:link] @name = attributes[:name] @caption = attributes[:caption] @description = attributes[:description] @source = attributes[:source] @properties = [] if attributes[:properties] attributes[:properties].each do |property| @properties << Property.new(property) end end @icon = attributes[:icon] @actions = [] if attributes[:actions] attributes[:actions].each do |action| @actions << Action.new(action) end end if attributes[:privacy] @privacy = if attributes[:privacy].is_a?(Privacy) attributes[:privacy] else Privacy.new(attributes[:privacy]) end end @type = attributes[:type] @graph_object_id = attributes[:object_id] if attributes[:application] @application = Application.new(attributes[:application][:id], attributes[:application]) end if attributes[:targeting] @targeting = if attributes[:targeting].is_a?(Targeting) attributes[:targeting] else Targeting.new(attributes[:targeting]) end end if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end if attributes[:updated_time] @updated_time = Time.parse(attributes[:updated_time]).utc end @story = attributes[:story] @story_tags = [] if = attributes[:story_tags] .each do |index, story_tag| story_tag.each do |_story_tag_| @story_tags << TaggedObject.new(_story_tag_[:id], _story_tag_) end end end if (place = attributes[:place]) @place = case place when Place place when String, Integer Place.new(place) when Hash Place.new(place[:id], place) end end # cached connection cache_collections attributes, :comments, :likes end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def actions @actions end |
#application ⇒ Object
Returns the value of attribute application.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def application @application end |
#caption ⇒ Object
Returns the value of attribute caption.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def @caption end |
#created_time ⇒ Object
Returns the value of attribute created_time.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def created_time @created_time end |
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def description @description end |
#from ⇒ Object
Returns the value of attribute from.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def from @from end |
#graph_object_id ⇒ Object
Returns the value of attribute graph_object_id.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def graph_object_id @graph_object_id end |
#icon ⇒ Object
Returns the value of attribute icon.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def icon @icon end |
#link ⇒ Object
Returns the value of attribute link.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def link @link end |
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def @message end |
#message_tags ⇒ Object
Returns the value of attribute message_tags.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def @message_tags end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def name @name end |
#picture ⇒ Object
Returns the value of attribute picture.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def picture @picture end |
#place ⇒ Object
Returns the value of attribute place.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def place @place end |
#privacy ⇒ Object
Returns the value of attribute privacy.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def privacy @privacy end |
#properties ⇒ Object
Returns the value of attribute properties.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def properties @properties end |
#source ⇒ Object
Returns the value of attribute source.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def source @source end |
#story ⇒ Object
Returns the value of attribute story.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def story @story end |
#story_tags ⇒ Object
Returns the value of attribute story_tags.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def @story_tags end |
#targeting ⇒ Object
Returns the value of attribute targeting.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def targeting @targeting end |
#to ⇒ Object
Returns the value of attribute to.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def type @type end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def updated_time @updated_time end |
#with_tags ⇒ Object
Returns the value of attribute with_tags.
9 10 11 |
# File 'lib/fb_graph/post.rb', line 9 def @with_tags end |