Sha256: db66ae14ed7a20fb2200c663e4cc947f0738069af4e983df33a06f00bdb8c19d
Contents?: true
Size: 1.6 KB
Versions: 5
Compression:
Stored size: 1.6 KB
Contents
module FbGraph class Post < Node include Connections::Comments include Connections::Likes extend Searchable attr_accessor :from, :to, :message, :picture, :link, :name, :caption, :description, :source, :icon, :attribution, :actions, :like_count, :created_time, :updated_time def initialize(identifier, attributes = {}) super if (from = attributes[:from]) @from = if from[:category] FbGraph::Page.new(from.delete(:id), from) else FbGraph::User.new(from.delete(:id), from) end end @to = [] if attributes[:to] FbGraph::Collection.new(attributes[:to]).each do |to| @to << if to[:category] FbGraph::Page.new(to.delete(:id), to) else FbGraph::User.new(to.delete(:id), to) end end end @message = attributes[:message] @picture = attributes[:picture] @link = attributes[:link] @name = attributes[:name] @caption = attributes[:caption] @description = attributes[:description] @source = attributes[:source] @icon = attributes[:icon] @attribution = attributes[:attribution] @actions = attributes[:actions] @like_count = attributes[:likes] 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 # cached connection @_comments_ = FbGraph::Collection.new(attributes[:comments]) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
fb_graph-1.2.1 | lib/fb_graph/post.rb |
fb_graph-1.2.0 | lib/fb_graph/post.rb |
fb_graph-1.1.7 | lib/fb_graph/post.rb |
fb_graph-1.1.6 | lib/fb_graph/post.rb |
fb_graph-1.1.5 | lib/fb_graph/post.rb |