Class: NewsApi::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/metonym/lib/news_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Query

Returns a new instance of Query.



8
9
10
11
# File 'lib/metonym/lib/news_api.rb', line 8

def initialize(key)
  @news_api_key = key
  @news_api = NewsApi::NewsApiRepository.new(key)
end

Instance Attribute Details

#news_api_keyObject

Returns the value of attribute news_api_key.



5
6
7
# File 'lib/metonym/lib/news_api.rb', line 5

def news_api_key
  @news_api_key
end

#uriObject

Returns the value of attribute uri.



6
7
8
# File 'lib/metonym/lib/news_api.rb', line 6

def uri
  @uri
end

Instance Method Details

#everything(args, **options) ⇒ Object



13
14
15
# File 'lib/metonym/lib/news_api.rb', line 13

def everything(args, **options)
  request('everything', args: args, format: define_response_format(options))
end

#sources(args, **options) ⇒ Object



21
22
23
# File 'lib/metonym/lib/news_api.rb', line 21

def sources(args, **options)
  request('sources', args: args, format: define_response_format(options))
end

#top_headlines(args, **options) ⇒ Object



17
18
19
# File 'lib/metonym/lib/news_api.rb', line 17

def top_headlines(args, **options)
  request('top-headlines', args: args, format: define_response_format(options))
end