Class: Gnews::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/metonym/lib/gnews.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/gnews.rb', line 8

def initialize(key)
  @gnews_api_key = key
  @gnews = Gnews::GnewsRepository.new(key)
end

Instance Attribute Details

#gnews_api_keyObject

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

#uriObject

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, **options)
  request('search', args: args, format: define_response_format(options))
end

#top_news(args, **options) ⇒ Object



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

def top_news(args, **options)
  request('top-news', args: args, format: define_response_format(options))
end