Class: Docker::API::Connection
- Inherits:
-
Object
- Object
- Docker::API::Connection
- Defined in:
- lib/docker/api/connection.rb
Overview
Connection class.
Instance Method Summary collapse
-
#initialize(url = nil, params = nil) ⇒ Connection
constructor
Create an Excon connection.
-
#request(params) ⇒ Object
Call an Excon request and returns a Docker::API::Response object.
Constructor Details
#initialize(url = nil, params = nil) ⇒ Connection
Create an Excon connection.
23 24 25 26 |
# 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 |
Instance Method Details
#request(params) ⇒ Object
Call an Excon request and returns a Docker::API::Response object.
12 13 14 15 16 |
# 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 |