Giter Site home page Giter Site logo

alexa's Introduction

Alexa Web Information Service

Ruby client for AWIS

Installation

gem install alexa

Usage

All success response objects contain response_id method.

Url Info

client = Alexa::Client.new(access_key_id: "key", secret_access_key: "secret")
url_info = client.url_info(url: "site.com")

Returns object that contains methods:

  • rank
  • data_url
  • site_title
  • site_description
  • language_locale
  • language_encoding
  • links_in_count
  • keywords
  • related_links
  • speed_median_load_time
  • speed_percentile
  • rank_by_country
  • rank_by_city
  • usage_statistics
  • categories

You can specify options:

  • url - address to be measured
  • response_group - which data to include in response (i.e. ["rank", "contact_info"]) - defaults to all available

See: Docs for valid groups.

Sites Linking In

client = Alexa::Client.new(access_key_id: "key", secret_access_key: "secret")
sites_linking_in = client.sites_linking_in(url: "site.com")

Returns object that contains method:

  • sites

You can specify options:

  • url - address to be measured
  • count - how many results to retrieve - defaults to max value that is 20
  • start - offset of results - defaults to 0

Traffic History

client = Alexa::Client.new(access_key_id: "key", secret_access_key: "secret")
traffic_history = client.traffic_history(url: "site.com")

Returns object that contains method:

  • site
  • range
  • start
  • data

You can specify options:

  • url - address to be measured
  • range - how many days to retrieve - defaults to max value 31
  • start - start date (i.e. "20120120", 4.days.ago) - defaults to range number days ago

Category Browse

client = Alexa::Client.new(access_key_id: "key", secret_access_key: "secret")
category_browse = client.category_browse(path: "Top/Games/Card_Games")

Returns object that contains methods:

  • categories
  • language_categories
  • related_categories
  • letter_bars

You can specify options:

  • path - category to be measured (i.e. "Top/Games/Card_Games") - valid paths can be found on dmoz
  • response_group - any of: categories, related_categories, language_categories, letter_bars - defaults to all
  • descriptions - should response include descriptions (i.e. false) - defaults to true

Category Listings

client = Alexa::Client.new(access_key_id: "key", secret_access_key: "secret")
category_listings = client.category_listings(path: "Top/Games/Card_Games")

Returns object that contains methods:

  • count
  • recursive_count
  • listings

You can specify options:

  • path - category to be measured (i.e. "Top/Games/Card_Games") - valid paths can be found on dmoz
  • sort_by - sort results by one of: popularity, title, average_review - defaults to popularity
  • recursive - should result include subcategories (i.e. false)- defaults to true
  • count - how many results to retrieve - defaults to max value, that is 20
  • start - offset of results - defaults to 0
  • descriptions - should response include descriptions (i.e. false) - defaults to true

Caveats

Status Code

You can retrieve Alexa status code calling status_code method.

It happens (so far in TrafficHistory) that Alexa returns response 200 with AlexaError status.

Parsers

Alexa is using multi_xml to parse XML documents. Tested with:

  • rexml
  • nokogiri
  • libxml

Currently alexa will not work with ox gem

Contributors

Continuous Integration

Build Status

Copyright

Copyright (c) Wojciech Wnętrzak. See LICENSE for details.

alexa's People

Contributors

jasongill avatar morgoth avatar pelf avatar rmoriz avatar sporkmonger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.