Class: Mailkube::RequestSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/mailkube/transport.rb,
sig/mailkube/transport.rbs

Overview

A fully-built request, ready to send.

path is relative to the base URL, or an absolute URL the API itself issued (a pagination link). Config#build_url refuses an absolute URL off the configured origin.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, method: "POST", body: nil, params: {}, headers: {}) ⇒ RequestSpec

Returns a new instance of RequestSpec.

Parameters:

  • path (String)

    the path or absolute URL to request.

  • method (String) (defaults to: "POST")

    the HTTP method.

  • body (Hash, nil) (defaults to: nil)

    the JSON request body, or nil for a body-less request.

  • params (Hash{String => String}) (defaults to: {})

    query parameters, already rendered to strings by Serialization.query. Empty means no query string at all, not an empty one.

  • headers (Hash{String => String}) (defaults to: {})

    per-request headers, merged over the defaults.



20
# File 'lib/mailkube/transport.rb', line 20

def initialize(path:, method: "POST", body: nil, params: {}, headers: {}) = super

Instance Attribute Details

#bodyHash[String, untyped]? (readonly)

Returns:

  • (Hash[String, untyped], nil)


5
6
7
# File 'sig/mailkube/transport.rbs', line 5

def body
  @body
end

#headersHash[String, String] (readonly)

Returns:

  • (Hash[String, String])


7
8
9
# File 'sig/mailkube/transport.rbs', line 7

def headers
  @headers
end

#methodString (readonly)

Returns:

  • (String)


4
5
6
# File 'sig/mailkube/transport.rbs', line 4

def method
  @method
end

#paramsHash[String, String] (readonly)

Returns:

  • (Hash[String, String])


6
7
8
# File 'sig/mailkube/transport.rbs', line 6

def params
  @params
end

#pathString (readonly)

Returns:

  • (String)


3
4
5
# File 'sig/mailkube/transport.rbs', line 3

def path
  @path
end