class HNsearch::HNsearchAPI

Public Class Methods

new() click to toggle source
# File lib/HNsearch/HNsearch_api.rb, line 6
def initialize
  @client = "http://api.thriftdb.com/api.hnsearch.com/"
end

Public Instance Methods

query_items(query) click to toggle source
# File lib/HNsearch/HNsearch_api.rb, line 15
def query_items(query)
  api_response = Nestful.get "#{@client}items/_search?q=#{query}"
  return JSON.parse(api_response)
end
query_users(query) click to toggle source
# File lib/HNsearch/HNsearch_api.rb, line 10
def query_users(query)
  api_response = Nestful.get "#{@client}users/_search?q=#{query}"
  return JSON.parse(api_response)
end