-
-
Save alexvollmer/14480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'httparty' | |
require 'radar_love' | |
require 'pp' | |
require 'yaml' | |
class TopEntities | |
include HTTParty | |
format :xml | |
def initialize(env, ingestion_id) | |
@env = env | |
@ingestion_id = ingestion_id | |
end | |
def fetch_uris(etype, n=10) | |
radar = Radar::Client.new(@env) | |
srv = radar.find(:one, 'usage-store', { "ingestionId" => @ingestion_id}) | |
if srv.nil? | |
puts "no usage-store :-(" | |
exit 1 | |
end | |
url = srv.root_url + "/top/known-entity-#{etype}-popular-score-alpha" | |
self.class.get(url, :query => {:max => n}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment