Sha256: e4547b80bb29346d00157c4bc0e73d1a2b7f0a4f8d7f430da8f587c4850104a7
Contents?: true
Size: 787 Bytes
Versions: 3
Compression:
Stored size: 787 Bytes
Contents
module Scouter class HatenaBookmark < Scouter::Base::Object END_POINT = 'http://api.b.st-hatena.com'.freeze private # build Hatena Bookmark Count API URL # @param [Array] url # @return [String] API url def self.api_url(url) url_str = url.map{ |u| "url=#{URI.escape(u)}" }.join('&') "#{END_POINT}/entry.counts?#{url_str}" end # Parse json data of response # @param [Hash] response # @return [Hash] url & count def self.parse_response(response, urls = nil) parse_response_item(JSON.parse(response)) end def self.parse_response_item(json_list) results = {} json_list.each do |json| url = json[0] results[url] = { self.service_name => json[1] } end results end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scouter-0.0.3 | lib/scouter/hatena_bookmark.rb |
scouter-0.0.2 | lib/scouter/hatena_bookmark.rb |
scouter-0.0.1 | lib/scouter/hatena_bookmark.rb |