Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

AYLIEN News API - Ruby SDK

The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.

Sign up at https://newsapi.aylien.com/.

For more documentation see https://newsapi.aylien.com/docs/.

Installation

Add this to the Gemfile:

gem 'aylien_news_api', '~> 3.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/aylien/aylien_newsapi_ruby, then add the following in the Gemfile:

gem 'aylien_news_api', :git => 'https://github.com/aylien/aylien_newsapi_ruby.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'aylien_news_api'

# Setup authorization
AylienNewsApi.configure do |config|
  config.api_key['X-AYLIEN-NewsAPI-Application-ID'] = ENV['NEWSAPI_APP_ID']
  config.api_key['X-AYLIEN-NewsAPI-Application-Key'] = ENV['NEWSAPI_APP_KEY']
end

api_instance = AylienNewsApi::DefaultApi.new

opts = {
  title: 'trump',
  published_at_start: "NOW-7DAYS",
  published_at_end: "NOW",
  entities_body_links_dbpedia: [
    'http://dbpedia.org/resource/Donald_Trump',
  ],
  not_language: ['en'],
  sort_by: 'social_shares_count.facebook'
}


begin
  result = api_instance.list_stories(opts)
  result.stories.each do |story|
    puts "#{story.title} / #{story.source.name}"
  end
rescue AylienNewsApi::ApiError => e
  puts "Exception when calling DefaultApi->list_stories: #{e}"
  puts e.response_body
end

Documentation for API Endpoints

All URIs are relative to https://api.aylien.com/news

Class Method HTTP request Description
AylienNewsApi::DefaultApi list_autocompletes GET /autocompletes List autocompletes
AylienNewsApi::DefaultApi list_clusters GET /clusters List Clusters
AylienNewsApi::DefaultApi list_coverages GET /coverages List coverages
AylienNewsApi::DefaultApi list_histograms GET /histograms List histograms
AylienNewsApi::DefaultApi list_related_stories GET /related_stories List related stories
AylienNewsApi::DefaultApi list_stories GET /stories List Stories
AylienNewsApi::DefaultApi list_time_series GET /time_series List time series
AylienNewsApi::DefaultApi list_trends GET /trends List trends

Documentation for Models

You can’t perform that action at this time.