class SearchResult

Attributes

current_page[R]
raw_response[R]

Public Class Methods

new(response, page: 1) click to toggle source
# File lib/mas/search_result.rb, line 6
def initialize(response, page: 1)
  @raw_response = response
  @current_page = page
end

Public Instance Methods

firms() click to toggle source
# File lib/mas/search_result.rb, line 11
def firms
  return [] unless raw_response.ok?

  @firms ||= hits.map { |hit| FirmResult.new(hit) }
end

Private Instance Methods

hits() click to toggle source
# File lib/mas/search_result.rb, line 23
def hits
  json['hits']['hits']
end
json() click to toggle source
# File lib/mas/search_result.rb, line 19
def json
  @json ||= JSON.parse(raw_response.body)
end