Class: Faraday::Adapter::Test::Stub

### Home Classes Methods

### In Files

- lib/faraday/adapter/test.rb

### Parent

Struct.new(:path, :params, :headers, :body, :block)

### Methods

- ::new
- #headers_match?
- #matches?
- #params_match?
- #to_s

### Class/Module Index

Quicksearch

- Faraday
- Faraday::Adapter
- Faraday::Adapter::EMHttp
- Faraday::Adapter::EMHttp::Manager
- Faraday::Adapter::EMHttp::Options
- Faraday::Adapter::EMSynchrony
- Faraday::Adapter::EMSynchrony::ParallelManager
- Faraday::Adapter::Excon
- Faraday::Adapter::HTTPClient
- Faraday::Adapter::NetHttp
- Faraday::Adapter::NetHttpPersistent
- Faraday::Adapter::Parallelism
- Faraday::Adapter::Patron
- Faraday::Adapter::Rack
- Faraday::Adapter::Test
- Faraday::Adapter::Test::Stub
- Faraday::Adapter::Test::Stubs
- Faraday::Adapter::Test::Stubs::NotFound
- Faraday::Adapter::Typhoeus
- Faraday::AutoloadHelper
- Faraday::ClientError
- Faraday::CompositeReadIO
- Faraday::Connection
- Faraday::ConnectionFailed
- Faraday::ConnectionOptions
- Faraday::Env
- Faraday::Error
- Faraday::FlatParamsEncoder
- Faraday::Middleware
- Faraday::MiddlewareRegistry
- Faraday::MissingDependency
- Faraday::NestedParamsEncoder
- Faraday::Options
- Faraday::ParsingError
- Faraday::ProxyOptions
- Faraday::RackBuilder
- Faraday::RackBuilder::Handler
- Faraday::RackBuilder::StackLocked
- Faraday::Request
- Faraday::Request::Authorization
- Faraday::Request::BasicAuthentication
- Faraday::Request::Instrumentation
- Faraday::Request::Instrumentation::Options
- Faraday::Request::Multipart
- Faraday::Request::Retry
- Faraday::Request::Retry::Options
- Faraday::Request::TokenAuthentication
- Faraday::Request::UrlEncoded
- Faraday::RequestOptions
- Faraday::ResourceNotFound
- Faraday::Response
- Faraday::Response::Logger
- Faraday::Response::Middleware
- Faraday::Response::RaiseError
- Faraday::SSLError
- Faraday::SSLOptions
- Faraday::TimeoutError
- Faraday::Utils
- Faraday::Utils::Headers
- Faraday::Utils::ParamsHash
- EmHttpSslPatch
- Object

No matching classes.

# Faraday::Adapter::Test::Stub

### Public Class Methods

new(full, headers, body, block) click to toggle source

    # File lib/faraday/adapter/test.rb, line 98
    def initialize(full, headers, body, block)
      path, query = full.split('?')
      params = query ?
        Faraday::Utils.parse_nested_query(query) :
        {}
      super(path, params, headers, body, block)
    end

### Public Instance Methods

headers_match?(request_headers) click to toggle source

    # File lib/faraday/adapter/test.rb, line 123
    def headers_match?(request_headers)
      headers.keys.all? do |key|
        request_headers[key] == headers[key]
      end
    end

matches?(request_uri, request_headers, request_body) click to toggle source

    # File lib/faraday/adapter/test.rb, line 106
    def matches?(request_uri, request_headers, request_body)
      request_path, request_query = request_uri.split('?')
      request_params = request_query ?
        Faraday::Utils.parse_nested_query(request_query) :
        {}
      request_path == path &&
        params_match?(request_params) &&
        (body.to_s.size.zero? || request_body == body) &&
        headers_match?(request_headers)
    end

params_match?(request_params) click to toggle source

    # File lib/faraday/adapter/test.rb, line 117
    def params_match?(request_params)
      params.keys.all? do |key|
        request_params[key] == params[key]
      end
    end

to_s() click to toggle source

    # File lib/faraday/adapter/test.rb, line 129
    def to_s
      "#{path} #{body}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.