Method: ExternalServices::Api#request
- Defined in:
- lib/external_services/api.rb
#request(method, path, params = {}, body = nil) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/external_services/api.rb', line 96 def request(method, path, params = {}, body = nil) resp = if fake? Struct.new(:success?, :body, :headers).new(true, fake_response_body(method, path, params), {}) else connection.send(method, path, body) do |req| req.params = params end end raise Error, resp unless resp.blank? || resp.success? resp end |