module Fetcher class Microdata class ArticleSmall module Facebook Coercer = proc { |post, viewer| resp = { :likes_type => "http://schema.org/AggregateRating/Likes", :id => post["id"], :comments => [], :likes => [], :articleBody => post["message"], :dateCreated => post["created_time"], :author => PersonUser.new(:facebook, post["from"]), :likes_count => post["likes"]["count"], :comments_count => post["comments"]["count"], :viewer => PersonUser.new(:facebook, viewer), :provider => ["facebook"] } i = 0 post["likes"]["data"].each do |like| #resp[:likes].push Like.new :facebook, like resp[:likes].push "like#{i}" i = i + 1 end post["comments"]["data"].each do |comment| resp[:comments].push UserComments.new :facebook, comment end resp } end end end end