Method: Opencrx::Session#action

Defined in:
lib/opencrx/session.rb

#action(method, url, options) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opencrx/session.rb', line 46

def action(method, url, options)
  response = self.class.send(method, url, options)
  logger.debug { "\n\nSENT >>>>>>>>>>>>\n#{response.request.inspect}" }
  logger.debug { "\nRECEIVED <<<<<<<<<<<<<<\n#{response.response.body}" }
  code = response.response.code
  case code
    when /^[45]/
      logger.info { response.response }
      logger.info { response.response.body }
      raise HttpError.new(response)
    else
      response
  end
end