Module: RestClient::Payload

### Home Classes Methods

### In Files

- lib/restclient/payload.rb

### Namespace

- CLASS RestClient::Payload::Base
- CLASS RestClient::Payload::Multipart
- CLASS RestClient::Payload::Streamed
- CLASS RestClient::Payload::UrlEncoded

### Methods

- #generate
- #has_file?
- #has_file_array?

### Class/Module Index

Quicksearch

- RestClient
- RestClient::AbstractResponse
- RestClient::Exception
- RestClient::ExceptionWithResponse
- RestClient::Exceptions
- RestClient::MaxRedirectsReached
- RestClient::Payload
- RestClient::Payload::Base
- RestClient::Payload::Multipart
- RestClient::Payload::Streamed
- RestClient::Payload::UrlEncoded
- RestClient::Platform
- RestClient::RawResponse
- RestClient::Redirect
- RestClient::Request
- RestClient::Request::Redirect
- RestClient::Request::RequestFailed
- RestClient::RequestFailed
- RestClient::Resource
- RestClient::Response
- RestClient::ResponseForException
- RestClient::SSLCertificateNotVerified
- RestClient::ServerBrokeConnection
- RestClient::Windows
- RestClient::Windows::RootCerts
- RestClient::Windows::RootCerts::CERT_CONTEXT

No matching classes.

# RestClient::Payload

### Public Instance Methods

generate(params) click to toggle source

    # File lib/restclient/payload.rb, line 9
    def generate(params)
      if params.is_a?(String)
        Base.new(params)
      elsif params.is_a?(Hash)
        if params.delete(:multipart) == true || has_file?(params)
          Multipart.new(params)
        else
          UrlEncoded.new(params)
        end
      elsif params.respond_to?(:read)
        Streamed.new(params)
      else
        nil
      end
    end

has_file?(params) click to toggle source

    # File lib/restclient/payload.rb, line 25
    def has_file?(params)
      params.any? do |_, v|
        case v
        when Hash
          has_file?(v)
        when Array
          has_file_array?(v)
        else
          v.respond_to?(:path) && v.respond_to?(:read)
        end
      end
    end

has_file_array?(params) click to toggle source

    # File lib/restclient/payload.rb, line 38
    def has_file_array?(params)
      params.any? do |v|
        case v
        when Hash
          has_file?(v)
        when Array
          has_file_array?(v)
        else
          v.respond_to?(:path) && v.respond_to?(:read)
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.