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

### Home Classes Methods

### In Files

- lib/faraday/adapter/test.rb

### Parent

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

### Methods

- ::new
- #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::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::Builder
- Faraday::Builder::Handler
- Faraday::Builder::StackLocked
- Faraday::CompositeReadIO
- Faraday::Connection
- Faraday::Error
- Faraday::Error::ClientError
- Faraday::Error::ConnectionFailed
- Faraday::Error::MissingDependency
- Faraday::Error::ParsingError
- Faraday::Error::ResourceNotFound
- Faraday::Error::TimeoutError
- Faraday::Middleware
- Faraday::MiddlewareRegistry
- Faraday::Request
- Faraday::Request::Authorization
- Faraday::Request::BasicAuthentication
- Faraday::Request::Multipart
- Faraday::Request::Retry
- Faraday::Request::TokenAuthentication
- Faraday::Request::UrlEncoded
- Faraday::Response
- Faraday::Response::Logger
- Faraday::Response::Middleware
- Faraday::Response::RaiseError
- Faraday::Utils
- Faraday::Utils::Headers
- Faraday::Utils::ParamsHash
- Object

No matching classes.

# Faraday::Adapter::Test::Stub

### Public Class Methods

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

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

### Public Instance Methods

matches?(request_uri, request_body) click to toggle source

    # File lib/faraday/adapter/test.rb, line 114
    def matches?(request_uri, 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)
    end

params_match?(request_params) click to toggle source

    # File lib/faraday/adapter/test.rb, line 124
    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 130
    def to_s
      "#{path} #{body}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.