0.01
Low commit activity in last 3 years
No release in over a year
AYLIEN's officially supported Ruby client library for accessing News API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.6.0, ~> 3.6

Runtime

>= 0.14.0
 Project Readme

aylien_news_api

AylienNewsApi - the Ruby gem for the AYLIEN News API

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.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 5.2.3
  • Package version: 5.2.3
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://newsapi.aylien.com/

Installation

Build a gem

To build the Ruby code into a gem:

gem build aylien_news_api.gemspec

Then either install the gem locally:

gem install ./aylien_news_api-5.2.3.gem

(for development, run gem install --dev ./aylien_news_api-5.2.3.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'aylien_news_api', '~> 5.2.3'

Install from Git

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

gem 'aylien_news_api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.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|
  # Configure API key authorization: app_id
  config.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['X-AYLIEN-NewsAPI-Application-ID'] = 'Bearer'

  # Configure API key authorization: app_key
  config.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['X-AYLIEN-NewsAPI-Application-Key'] = 'Bearer'
end

api_instance = AylienNewsApi::DefaultApi.new
unknown_base_type = {"$and":[{"$or":[{"body":{"$text":"Tim Cook"}},{"social.shares.count.reddit.max":{"$gte":5000,"$boost":5}}]},{"entity":{"$and":[{"name":{"$text":"Apple","$boost":2}},{"$not":[{"type":{"$eq":"Fruit"}}]}]}}]} # UNKNOWN_BASE_TYPE | /stories body schema to perform an advanced search with logical operators and nested objects. 
opts = {
  published_at_start: 'published_at_start_example', # String | This parameter is used for finding stories whose published at time is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates). 
  published_at_end: 'published_at_end_example', # String | This parameter is used for finding stories whose published at time is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates). 
  _return: ['_return_example'], # Array<String> | This parameter is used for specifying return fields.
  sort_by: 'published_at', # String | This parameter is used for changing the order column of the results. You can read about sorting results [here](https://newsapi.aylien.com/docs/sorting-results). 
  sort_direction: 'desc', # String | This parameter is used for changing the order direction of the result. You can read about sorting results [here](https://newsapi.aylien.com/docs/sorting-results). 
  cursor: '*', # String | This parameter is used for finding a specific page. You can read more about pagination of results [here](https://newsapi.aylien.com/docs/pagination-of-results). 
  per_page: 10 # Integer | This parameter is used for specifying number of items in each page You can read more about pagination of results [here](https://newsapi.aylien.com/docs/pagination-of-results) 
}

begin
  #List Stories
  result = api_instance.advanced_list_stories(unknown_base_type, opts)
  p result
rescue AylienNewsApi::ApiError => e
  puts "Exception when calling DefaultApi->advanced_list_stories: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
AylienNewsApi::DefaultApi advanced_list_stories POST /stories List Stories
AylienNewsApi::DefaultApi list_autocompletes GET /autocompletes List autocompletes
AylienNewsApi::DefaultApi list_clusters GET /clusters List Clusters
AylienNewsApi::DefaultApi list_histograms GET /histograms List histograms
AylienNewsApi::DefaultApi list_related_stories_get GET /related_stories
AylienNewsApi::DefaultApi list_related_stories_post POST /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

Documentation for Authorization

app_id

  • Type: API key
  • API key parameter name: X-AYLIEN-NewsAPI-Application-ID
  • Location: HTTP header

app_key

  • Type: API key
  • API key parameter name: X-AYLIEN-NewsAPI-Application-Key
  • Location: HTTP header