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
- AylienNewsApi::AggregatedSentiment
- AylienNewsApi::Author
- AylienNewsApi::Autocomplete
- AylienNewsApi::Autocompletes
- AylienNewsApi::Category
- AylienNewsApi::CategoryLinks
- AylienNewsApi::CategoryTaxonomy
- AylienNewsApi::Cluster
- AylienNewsApi::Clusters
- AylienNewsApi::DunsNumber
- AylienNewsApi::Entity
- AylienNewsApi::EntityInText
- AylienNewsApi::EntityLinks
- AylienNewsApi::EntityMention
- AylienNewsApi::EntityMentionIndex
- AylienNewsApi::EntitySentiment
- AylienNewsApi::EntitySurfaceForm
- AylienNewsApi::Error
- AylienNewsApi::ErrorLinks
- AylienNewsApi::Errors
- AylienNewsApi::ExternalIds
- AylienNewsApi::HistogramInterval
- AylienNewsApi::Histograms
- AylienNewsApi::Location
- AylienNewsApi::Logicals
- AylienNewsApi::Media
- AylienNewsApi::MediaFormat
- AylienNewsApi::MediaType
- AylienNewsApi::NestedEntity
- AylienNewsApi::Parameter
- AylienNewsApi::Query
- AylienNewsApi::Rank
- AylienNewsApi::Rankings
- AylienNewsApi::RelatedStories
- AylienNewsApi::RepresentativeStory
- AylienNewsApi::Scope
- AylienNewsApi::ScopeLevel
- AylienNewsApi::Sentiment
- AylienNewsApi::SentimentPolarity
- AylienNewsApi::Sentiments
- AylienNewsApi::ShareCount
- AylienNewsApi::ShareCounts
- AylienNewsApi::Source
- AylienNewsApi::Stories
- AylienNewsApi::Story
- AylienNewsApi::StoryCluster
- AylienNewsApi::StoryLinks
- AylienNewsApi::StoryTranslation
- AylienNewsApi::StoryTranslations
- AylienNewsApi::Summary
- AylienNewsApi::TimeSeries
- AylienNewsApi::TimeSeriesList
- AylienNewsApi::Trend
- AylienNewsApi::Trends
- AylienNewsApi::Warning
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