{"id":22683235,"url":"https://github.com/mtchavez/al_papi","last_synced_at":"2025-04-12T18:26:09.242Z","repository":{"id":2121034,"uuid":"3063558","full_name":"mtchavez/al_papi","owner":"mtchavez","description":"AuthorityLabs Partner API RubyGem","archived":false,"fork":false,"pushed_at":"2022-03-04T19:38:20.000Z","size":394,"stargazers_count":3,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T09:54:18.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://api.authoritylabs.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-28T16:09:31.000Z","updated_at":"2016-03-23T16:55:21.000Z","dependencies_parsed_at":"2022-08-31T05:21:04.546Z","dependency_job_id":null,"html_url":"https://github.com/mtchavez/al_papi","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fal_papi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fal_papi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fal_papi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fal_papi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/al_papi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248611669,"owners_count":21133150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T21:11:20.584Z","updated_at":"2025-04-12T18:26:09.217Z","avatar_url":"https://github.com/mtchavez.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AuthorityLabs Partner API Gem\n\n[![Latest Version](https://img.shields.io/gem/v/al_papi.svg)](http://rubygems.org/gems/al_papi)\n[![Build Status](https://secure.travis-ci.org/mtchavez/al_papi.png)](http://travis-ci.org/mtchavez/al_papi?branch=master)\n[![Coverage Status](https://coveralls.io/repos/mtchavez/al_papi/badge.png?branch=update%2Fdependencies)](https://coveralls.io/r/mtchavez/al_papi?branch=update%2Fdependencies)\n[![Code Climate](https://codeclimate.com/github/mtchavez/al_papi.png)](https://codeclimate.com/github/mtchavez/al_papi)\n\nA wrapper around the Partner API calls. Allows post, priority post and get calls.\n\n## Install\n\n```ruby\ngem install 'al_papi'\n```\n\nWith bundler\n\n```ruby\ngem 'al_papi', '~\u003e 1.0.4'\n```\n\n## Configuration\n\nSet configuration options to be used on requests:\n\n```ruby\nrequire 'al_papi'\n\nAlPapi.configure do |config|\n  config.api_key = 'yR43BtBDjadfavMy6a6aK0'\nend\n```\n\n## Account\n\nAccount endpoint lets you get basic info about your account, current queue times and any system messages.\n\n```ruby\n# Pass your account ID into the info method\nres = AlPapi::Account.info '1'\n\n# Response body will be JSON response\nres.body\n\n# You can use the parsed_body method for convenience to access data\naccount_info = res.parsed_body\naccount_info.user.current_balance # 500.00\naccount_info.queue.bing_time # 15\naccount_info.messages.system # ['The system is back online!']\n```\n\nExample response in JSON\n\n```javascript\n{\n    \"messages\": {\n        \"system\": ['The system is back online!']\n    },\n    \"queue\": {\n        \"bing_time\": 15,\n        \"google_time\": 3,\n        \"yahoo_time\": 2\n    },\n    \"user\": {\n        \"current_balance\": 500.00,\n        \"current_get_count\": 2000,\n        \"current_post_count\": 1000,\n        \"hourly_get_limit\": 2000,\n        \"hourly_post_limit\": 1000\n    }\n}\n```\n\n## Keywords\n\nKeywords endpoint allows you to POST keywords you want SERPs for and to GET those results\nwhen they are ready.\n\n### POST\n\nPost your keyword-engine-locale combination to the API:\n\n```ruby\nres = AlPapi::Keyword.post keyword: \"Centaur Love'n\", engine: 'google', locale: 'en-us'\n\nif res.success?\n  p 'Centaur High Hoof'\nelse\n  p 'PAPI Fail'\nend\n```\n\n### Priority POST\n\nPost your keyword to the priority queue if you need results in a more timely manner:\n\n```ruby\nres = AlPapi::Keyword.priority_post keyword: \"Mad Scientist\", engine: 'bing', locale: 'en-ca'\n\nif res.success?\n  p 'Canadian Bing Scientist Time'\nelse\n  p 'PAPI Fail'\nend\n```\n\n### GET\n\nWhen you are ready to get your results you can do a GET request for your keyword-engine-locale combo:\n\n```ruby\nres = AlPapi::Keyword.get keyword: \"Mad Scientist\", engine: 'bing', locale: 'en-ca'\n\nif res.success?\n  p 'Canadian Bing Scientist Time'\n  res.body # Hash of your results for that keyword-engine-locale\nelse\n  p 'PAPI Fail'\nend\n```\n\n### Response\n\nWhen making an API request a response object is returned with any errors, http response code and http reponse body.\n\n```ruby\nres = req.get keyword: \"Mad Scientist\", engine: 'bing', locale: 'en-ca'\n\n# Errors:\n# Returns an array of error objects.\nres.errors\n\nif res.errors.present?\n  res.errors.each do |error|\n    p error.code      # http repsonse code\n    p error.message   # error message\n    p error.params    # params of request\n    p error.path      # path of request\n  end\nend\n\n# Success:\n# Returns true or false if request was successful or not.\nres.success?\n\n# Body:\n# Returns body of response.\n# On GET requests the body will be a hash of your results if successful.\nres.body\n\n# Parsed Body:\n# Returns the parsed JSON body, if present, as a Hashie::Mash object.\n# This can be useful to get an object with methods to call instead of\n# indexing into nested hashes.\n\n# Code:\n# Returns http response code.\n# 204: On GET requests when no data is available yet\n# 200: Successful\n# 401: Invalid api key\n# 500: Server Error\nres.code\n\n# Over Limit:\n# Returns true or false if over hourly limit\nres.over_limit?\n\n# Suspended:\n# Returns true or false if your account has been suspended\nres.suspended?\n```\n\n## Web Insight\n\n### Description\n\nWeb Insight queue takes a URL for the Partner API to scrape and parse out high level insight about the page\nand return the results to your callback URL passed in or set for your account.\n\n### POST\n\nPost the URL of the page you want to gain insight into and the callback URL knowing when your results are\nready to get.\n\n```ruby\nres = AlPapi::WebInsight.post url: 'http://www.qwiki.com', callback: 'http://your-callback-url.com'\n```\n\n### GET\n\nWhen your results are ready to get you will receive a callback that contains the information on how\nto get the insight on your URL. In the callback you should receive a date_created and time_created to use\nin your get request. You will also use your original URL posted.\n\n```ruby\nres = AlPapi::WebInsight.get url: 'http://www.qwiki.com', date_created: '2012-06-14', time_created: '01:50'\n```\n\n## Extras\n\n### Engines\n\nSupported engines are Google, Yahoo and Bing. To get a list of supported engines run the following:\n\n```ruby\nAlPapi::Engines.all\n```\n\n### Locales\n\nSupported locales differ by the engine being used. In order to make sure you are using a supported locale\nfor the engine you are posting a keyword to there is a locales class to help you:\n\n### Supported\n\nA way to see all the supported locales for a specified engine\n\n```ruby\nAlPapi::Locales.supported # defaults to google\n```\n\nExample response\n\n```javascript\n{\n  engine: google\n  locales: {\n    ko-kr: {\n      description: Korea - Korean\n      tld: http://www.google.co.kr\n    },\n    ...\n    el-gr: {\n      description: Greece - Greek\n      tld: http://www.google.gr\n    }\n  }\n  supported: true\n}\n```\n\n### Description\n\nYou can query the API to see if a specific locale is supported for an engine and get a description of that locale.\n\n```ruby\nAlPapi::Locales.description 'google', 'ko-kr'\n```\n\nExample response\n\n```javascript\n{\n  locale: ko-kr\n  description: Korea - Korean\n  supported: true\n  engine: google\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fal_papi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fal_papi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fal_papi/lists"}