Class: Wikidata::Client
- Inherits:
-
Object
- Object
- Wikidata::Client
- Defined in:
- lib/wikidata/client.rb
Constant Summary collapse
- DEFAULT_QUERY =
{ format: 'json' }
Instance Attribute Summary collapse
-
#query ⇒ Object
Returns the value of attribute query.
-
#total_pages ⇒ Object
Returns the value of attribute total_pages.
Instance Method Summary collapse
-
#initialize(query = {}) ⇒ Client
constructor
A new instance of Client.
- #response ⇒ Object
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
#query ⇒ Object
Returns the value of attribute query.
7 8 9 |
# File 'lib/wikidata/client.rb', line 7 def query @query end |
#total_pages ⇒ Object
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
#response ⇒ Object
13 14 15 |
# File 'lib/wikidata/client.rb', line 13 def response response_class.new api.get('', query) end |