Ruby client for Amazon Alexa APIs.
These include Alexa Top Sites and Alexa Web Information Service.
HTTP transport thanks to Net::HTTP
,
with a little help from addressable.
XML parsing courtesy of Nokogiri.
Thorough test coverage provided by MiniTest::Spec
.
# with bundler
echo 'gem "ralexa"' >> Gemfile
bundle
# or just the gem
gem install ralexa
# grab a Ralexa::Session instance to hold your credentials.
session = Ralexa.session("aws_access_key_id", "aws_secret_access_key")
# all countries
countries = session.top_sites.list_countries
p countries.map(&:name)
# global top 250 sites
global = session.top_sites.global(250)
# per-country top sites
first_by_country = {}
countries.each do |c|
first_by_country[c.name] = session.top_sites.country(c.code, 1).first.url
end
# individual country lookup
puts "Top Ten Australian Sites"
session.top_sites.country("AU", 10).each do |s|
puts "#{s.url} (#{s.page_views} pageviews)"
end
# rank of an individual site
puts "Rank of Flippa.com"
puts session.url_info.rank("http://flippa.com")
puts "bam!"
Service | Action | ResponseGroup | Supported |
---|---|---|---|
Alexa Top Sites | TopSites | Global | Yes |
Country | Yes | ||
ListCountries | Yes | ||
Alexa Web Information Services | UrlInfo | Rank | Yes |
* | Send a pull request! | ||
TrafficHistory | * | Send a pull request! | |
CategoryBrowse | * | Send a pull request! | |
CategoryListings | * | Send a pull request! | |
SitesLinkingIn | * | Send a pull request! |
- Fork it
- Create your feature branch (
git checkout -b some-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin some-new-feature
) - Create new Pull Request
(c) 2012 Flippa, The MIT License.