Class: NewsApi::Query
- Inherits:
-
Object
- Object
- NewsApi::Query
- Defined in:
- lib/metonym/lib/news_api.rb
Instance Attribute Summary collapse
-
#news_api_key ⇒ Object
Returns the value of attribute news_api_key.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #everything(args, **options) ⇒ Object
-
#initialize(key) ⇒ Query
constructor
A new instance of Query.
- #sources(args, **options) ⇒ Object
- #top_headlines(args, **options) ⇒ Object
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_key ⇒ Object
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 |
#uri ⇒ Object
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, **) request('everything', args: args, format: define_response_format()) end |
#sources(args, **options) ⇒ Object
21 22 23 |
# File 'lib/metonym/lib/news_api.rb', line 21 def sources(args, **) request('sources', args: args, format: define_response_format()) end |
#top_headlines(args, **options) ⇒ Object
17 18 19 |
# File 'lib/metonym/lib/news_api.rb', line 17 def top_headlines(args, **) request('top-headlines', args: args, format: define_response_format()) end |