Module: Fopost::HTTP::Transport

Included in:
NetHTTPTransport
Defined in:
lib/fopost/http/transport.rb

Overview

The seam the SDK sends requests through.

Implement call and pass an instance as transport: to swap in your own HTTP stack, or to stub the network in tests.

class MyTransport
def call(method:, url:, headers:, body:)
  Fopost::HTTP::Response.new(status: 200, body: '{}')
end
end

Instance Method Summary collapse

Instance Method Details

#call(method:, url:, headers:, body:) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/fopost/http/transport.rb', line 16

def call(method:, url:, headers:, body:)
  raise NotImplementedError, 'a transport must implement #call'
end