class Clarification::SearchResponse

Attributes

concept[R]
hits[R]
raw_response[R]

Public Class Methods

new(raw_response, concept) click to toggle source
# File lib/clarification/response/search_response.rb, line 7
def initialize(raw_response, concept)
  @hits = []
  @concept = concept
  @raw_response = JSON.parse(raw_response)

  parse_raw_response
end

Private Instance Methods

parse_raw_response() click to toggle source
# File lib/clarification/response/search_response.rb, line 16
def parse_raw_response
  @raw_response['hits'].each do |hit|
    score = hit["score"]
    url = hit["input"]["data"]["image"]["url"]
    created_at = hit["input"]["created_at"]
    @hits << Hit.new(score, url, created_at)
  end
end