class ShareNotify::SearchResponse

Attributes

response[R]
status[R]

Public Class Methods

new(response) click to toggle source

@param [HTTParty::Response] response returned from ShareNotify::API

# File lib/share_notify/search_response.rb, line 7
def initialize(response)
  fail ArgumentError, 'API response is nil' if response.nil?
  @status = response.code
  @response = response.parsed_response
end

Public Instance Methods

count() click to toggle source
# File lib/share_notify/search_response.rb, line 13
def count
  response.fetch('count', 0)
end
docs() click to toggle source
# File lib/share_notify/search_response.rb, line 17
def docs
  @docs ||= response.fetch('results', []).map { |d| Document.new(d) }
end