module Writer module Fetcher module Microdata class ArticleSmall attr_accessor :source def initialize the_source self.source = the_source end def hash @attributes = @source.attributes resp = { "type" => [@source._type], "properties" => { "additionalType" => [ @attributes[:additionalType] ], "Item#id" => [ @attributes[:id] ], "articleBody" => [ @attributes[:articleBody] ], "author" => [ @attributes[:author].to.hash ], "Item#viewer" => [ @attributes[:viewer].to.hash ], "UserComments" => [ ], "dateCreated" => [ @attributes[:dateCreated] ], "provider" => @attributes[:provider], "url" => [ @attributes[:url] ] } } @attributes[:comments].each do |c| resp["properties"]["UserComments"].push c.to.hash end resp end end end end end