Method: FbGraph::Post#initialize
- Defined in:
- lib/fb_graph/post.rb
#initialize(identifier, options = {}) ⇒ Post
Returns a new instance of Post.
7 8 9 10 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 |
# File 'lib/fb_graph/post.rb', line 7 def initialize(identifier, = {}) super if (from = [:from]) @from = if from[:category] FbGraph::Page.new(from.delete(:id), from) else FbGraph::User.new(from.delete(:id), from) end end @to = [] if [:to] FbGraph::Collection.new([: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 = [:message] @picture = [:picture] @link = [:link] @name = [:name] @caption = [:caption] @description = [:description] @source = [:source] @icon = [:icon] @attribution = [:attribution] @actions = [:actions] @likes = [:likes] if [:created_time] @created_time = Time.parse([:created_time]).utc end if [:updated_time] @updated_time = Time.parse([:updated_time]).utc end # cached connection @_comments_ = FbGraph::Collection.new([:comments]) end |