Skip to content

Instantly share code, notes, and snippets.

@alexvollmer
Forked from seth/gist:14479
Created October 3, 2008 00:09
Show Gist options
  • Save alexvollmer/14480 to your computer and use it in GitHub Desktop.
Save alexvollmer/14480 to your computer and use it in GitHub Desktop.
#!/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