Class: Stelapoint

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/stelapoint.rb

Defined Under Namespace

Classes: StelapointAuthenticationError, StelapointError

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Stelapoint

Returns a new instance of Stelapoint.



13
14
15
# File 'lib/stelapoint.rb', line 13

def initialize(api_key)
  @auth = {:username => api_key, :password => 'x'}
end

Instance Method Details

#search(names) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stelapoint.rb', line 17

def search(names)
  response = post("/search", names)
  case response.code
    when 200
      return response.parsed_response
    when 401
      raise StelapointAuthenticationError, "Invalid API Key"
    when 500
      raise StelapointError, "There was an error with your input or the stelapoint API"
  end
  
  return response
end