class Docker::API::Connection

Connection class.

Public Class Methods

new(url = nil, params = nil) click to toggle source

Create an Excon connection.

@param url [String]: URL for the connection. @param params [String]: Additional parameters.

# File lib/docker/api/connection.rb, line 23
def initialize url = nil, params = nil
    return @connection = Excon.new('unix:///', {socket: '/var/run/docker.sock'}) unless url
    @connection = Excon.new(url, params || {})
end

Public Instance Methods

request(params) click to toggle source

Call an Excon request and returns a Docker::API::Response object.

@param params [Hash]: Request parameters.

# File lib/docker/api/connection.rb, line 12
def request params
    response = Docker::API::Response.new(@connection.request(params).data)
    p response if Docker::API::PRINT_RESPONSE_TO_STDOUT 
    response
end