class ApiAiWrapper::Components::Component
Attributes
engine[RW]
Private Instance Methods
handle_response(response_body)
click to toggle source
Throws an error if the call is not successful Returns response if no error is returned
# File lib/api_ai_wrapper/components/component.rb, line 23 def handle_response(response_body) if response_body.is_a?(Hash) && response_body.has_key?("status") response_body = response_body.deep_symbolize_keys response_status = response_body[:status] response_code = response_status[:code] if response_code != 200 raise ApiAiWrapper::Errors::Engine::ApiError.new(response_status[:errorDetails], response_code, response_status[:errorType]) end end response_body end