Class: ScreenshotScout::TransportRequest

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

Overview

The request object passed to an injected transport's #call method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, url:, headers:, body: nil) ⇒ TransportRequest

Returns a new instance of TransportRequest.



11
12
13
14
15
16
17
18
19
# File 'lib/screenshotscout/transport.rb', line 11

def initialize(method:, url:, headers:, body: nil)
  @method = method.dup.freeze
  @url = url.dup.freeze
  @headers = headers.to_h do |name, value|
    [name.to_s.dup.freeze, value.to_s.dup.freeze]
  end.freeze
  @body = body&.dup&.freeze
  freeze
end

Instance Attribute Details

#bodyString? (readonly)

Returns the value of attribute body.

Returns:

  • (String, nil)


9
10
11
# File 'lib/screenshotscout/transport.rb', line 9

def body
  @body
end

#headersHash[String, String] (readonly)

Returns the value of attribute headers.

Returns:

  • (Hash[String, String])


9
10
11
# File 'lib/screenshotscout/transport.rb', line 9

def headers
  @headers
end

#methodcapture_http_method (readonly)

Returns the value of attribute method.

Returns:

  • (capture_http_method)


9
10
11
# File 'lib/screenshotscout/transport.rb', line 9

def method
  @method
end

#urlString (readonly)

Returns the value of attribute url.

Returns:

  • (String)


9
10
11
# File 'lib/screenshotscout/transport.rb', line 9

def url
  @url
end