Ruby client library

Use the unofficial Ruby client library to integrate News API into your Ruby application without having to make HTTP requests directly.

Source: olegmikhnovich/News-API-ruby

$ gem install news-api
require 'news-api'

# Init
newsapi ="API_KEY")             

# /v2/top-headlines
top_headlines = newsapi.get_top_headlines(q: 'bitcoin',
                                          sources: 'bbc-news,the-verge',
                                          category: 'business',
                                          language: 'en',
                                          country: 'us')

# /v2/everything
all_articles = newsapi.get_everything(q: 'bitcoin',
                                      sources: 'bbc-news,the-verge',
                                      domains: ',',
                                      from: '2017-12-01',
                                      to: '2017-12-12',
                                      language: 'en',
                                      sortBy: 'relevancy',
                                      page: 2))

# /v2/top-headlines/sources
sources = newsapi.get_sources(country: 'us', language: 'en')