class Rsbe::Client::SearchResults
Public Class Methods
new(api_response)
click to toggle source
# File lib/rsbe/client/search_results.rb, line 4 def initialize(api_response) @api_response = api_response # init json json end
Public Instance Methods
num_found()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 14 def num_found response['numFound'] end
results()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 18 def results @results ||= urls.collect {|u| Rsbe::Client.find(u)} end
success?()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 10 def success? @api_response.status == 200 end
Private Instance Methods
docs()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 32 def docs @docs ||= response['docs'] end
json()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 28 def json @json ||= JSON.parse(@api_response.body) end
response()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 24 def response @response ||= json['response'] end
urls()
click to toggle source
# File lib/rsbe/client/search_results.rb, line 36 def urls @urls ||= docs.collect {|d| d['url']} end