Class: Gnews::Query
- Inherits:
-
Object
- Object
- Gnews::Query
- Defined in:
- lib/metonym/lib/gnews.rb
Instance Attribute Summary collapse
-
#gnews_api_key ⇒ Object
Returns the value of attribute gnews_api_key.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(key) ⇒ Query
constructor
A new instance of Query.
- #search(args, **options) ⇒ Object
- #top_news(args, **options) ⇒ Object
Constructor Details
#initialize(key) ⇒ Query
Returns a new instance of Query.
8 9 10 11 |
# File 'lib/metonym/lib/gnews.rb', line 8 def initialize(key) @gnews_api_key = key @gnews = Gnews::GnewsRepository.new(key) end |
Instance Attribute Details
#gnews_api_key ⇒ Object
Returns the value of attribute gnews_api_key.
5 6 7 |
# File 'lib/metonym/lib/gnews.rb', line 5 def gnews_api_key @gnews_api_key end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/metonym/lib/gnews.rb', line 6 def uri @uri end |
Instance Method Details
#search(args, **options) ⇒ Object
13 14 15 |
# File 'lib/metonym/lib/gnews.rb', line 13 def search(args, **) request('search', args: args, format: define_response_format()) end |
#top_news(args, **options) ⇒ Object
17 18 19 |
# File 'lib/metonym/lib/gnews.rb', line 17 def top_news(args, **) request('top-news', args: args, format: define_response_format()) end |