class CryptoCoins::News
Public Class Methods
search(secret_key, options = {})
click to toggle source
# File lib/cryptocoins.rb, line 95 def self.search(secret_key, options = {}) request = {query: {language: 'en', sortBy: 'popularity', apiKey: secret_key, from: Date.today.prev_day.strftime('%Y-%m-%d'), to: Date.today.strftime('%Y-%m-%d'), q: '+bitcoin', pageSize: '100'}} options.each do |key, value| request[:query][key] = value if request[:query][key] end request[:query].merge!(sources: options[:sources]) if options[:sources] return HTTParty.get('https://newsapi.org/v2/everything?', request)['articles'] end