Class: Wikidata::SearchResponse
Instance Method Summary
collapse
Methods inherited from Response
#initialize, #inspect
Instance Method Details
#empty? ⇒ Boolean
9
10
11
|
# File 'lib/wikidata/search_response.rb', line 9
def empty?
@_empty ||= @raw.body['query'].nil?
end
|
#next_page_offset ⇒ Object
18
19
20
21
|
# File 'lib/wikidata/search_response.rb', line 18
def next_page_offset
return if empty?
@raw.body['continue']['sroffset']
end
|
#results ⇒ Object
4
5
6
7
|
# File 'lib/wikidata/search_response.rb', line 4
def results
return [] if empty?
@_results ||= Wikidata::Item.find(raw_ids).results
end
|
#total_hits ⇒ Object
13
14
15
16
|
# File 'lib/wikidata/search_response.rb', line 13
def total_hits
return if empty?
@raw.body['query']['searchinfo']['totalhits']
end
|