Module: TicketAbstractorClient::Base::ResponseHandler

Extended by:
ActiveSupport::Concern
Included in:
Client
Defined in:
lib/ticket_abstractor_client/base/response_handler.rb

Instance Method Summary collapse

Instance Method Details

#with_response_handlingObject

Raises:

  • (error_by_context(response['context']))


6
7
8
9
10
11
12
# File 'lib/ticket_abstractor_client/base/response_handler.rb', line 6

def with_response_handling
  response = yield

  raise(error_by_context(response['context']), response['error'].to_s) if response.key?('error')

  response['result']
end