Class: WitBot::WitRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_bot/requests/wit_request.rb

Direct Known Subclasses

MessageRequest, WitModelRequest

Instance Method Summary collapse

Instance Method Details

#httpObject



3
4
5
# File 'lib/wit_bot/requests/wit_request.rb', line 3

def http
  WitBot.http
end

#request(request = http) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/wit_bot/requests/wit_request.rb', line 7

def request(request=http)
  response = process_response request.parse
  if request.code.between? 200, 299
    response
  else
    raise WitError.new(response[:status]), (response[:error] || response[:body])
  end
end