Sha256: f9194f6d86167eca23ff7c81b7330c4c2d88c8f9b4b6b8f6db35ebd04cd91fb3

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fetcher-microdata-facebook-0.0.1 lib/fetcher/microdata/article_small/facebook/coercer.rb