Class: Wikidata::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/wikidata/client.rb

Constant Summary collapse

DEFAULT_QUERY =
{
  format: 'json'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query = {}) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/wikidata/client.rb', line 9

def initialize(query = {})
  @query = DEFAULT_QUERY.merge(query)
end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



7
8
9
# File 'lib/wikidata/client.rb', line 7

def query
  @query
end

#total_pagesObject

Returns the value of attribute total_pages.



7
8
9
# File 'lib/wikidata/client.rb', line 7

def total_pages
  @total_pages
end

Instance Method Details

#responseObject



13
14
15
# File 'lib/wikidata/client.rb', line 13

def response
  response_class.new api.get('', query)
end