Class: WhoAPI::Request

Inherits:
Object
  • Object
show all
Includes:
Symbolize
Defined in:
lib/whoapi/request.rb

Constant Summary collapse

BASE_URL =
'api.whoapi.com'

Instance Method Summary collapse

Methods included from Symbolize

#symbolize_recursive

Constructor Details

#initialize(type, params) ⇒ Request

Returns a new instance of Request.



7
8
9
10
# File 'lib/whoapi/request.rb', line 7

def initialize(type, params)
  @type = type
  @params = params
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
# File 'lib/whoapi/request.rb', line 12

def run
  resp = call
  json = JSON.parse(resp.body)
  check_response(resp, json)
  json.delete('status')
  symbolize_recursive(json)
end