Class: Faraday::Adapter::MockRequest::Stub

Inherits:
Struct
  • Object
show all
Defined in:
lib/faraday/adapter/mock_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body


35
36
37
# File 'lib/faraday/adapter/mock_request.rb', line 35

def body
  @body
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path


35
36
37
# File 'lib/faraday/adapter/mock_request.rb', line 35

def path
  @path
end

#request_headersObject

Returns the value of attribute request_headers

Returns:

  • (Object)

    the current value of request_headers


35
36
37
# File 'lib/faraday/adapter/mock_request.rb', line 35

def request_headers
  @request_headers
end

#response_headersObject

Returns the value of attribute response_headers

Returns:

  • (Object)

    the current value of response_headers


35
36
37
# File 'lib/faraday/adapter/mock_request.rb', line 35

def response_headers
  @response_headers
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status


35
36
37
# File 'lib/faraday/adapter/mock_request.rb', line 35

def status
  @status
end

Instance Method Details

#matches?(request_path, headers) ⇒ Boolean

Returns:

  • (Boolean)

36
37
38
39
40
41
42
# File 'lib/faraday/adapter/mock_request.rb', line 36

def matches?(request_path, headers)
  return false if request_path != path
  request_headers.each do |key, value|
    return false if headers[key] != value
  end
  true
end