Sha256: 9b4a8909c29f96c58038ad2df0ad8ae5d9fe4764251ad059a63735ad447afaee

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'cgi'
require 'json'
require 'excon'
require 'net/http/post/multipart'

# The top-level module for this gem. It's purpose is to hold global
# configuration variables that are used as defaults in other classes.
module Docker
  class << self
    def url
      @url ||= 'http://localhost'
    end

    def options
      @options ||= { :port => 4243 }
    end

    def url=(new_url)
      @url = new_url
      reset_connection!
    end

    def options=(new_options)
      @options = { :port => 4243 }.merge(new_options)
      reset_connection!
    end

    def connection
      @connection ||= Connection.new(url, options)
    end

    def reset_connection!
      @connection = nil
    end

    # Get the version of Go, Docker, and optionally the Git commit.
    def version
      connection.json_request(:get, '/version')
    end

    # Get more information about the Docker server.
    def info
      connection.json_request(:get, '/info')
    end

    # Login to the Docker registry.
    def authenticate!(options = {})
      connection.post(:path => '/auth', :body => options)
      true
    end
  end
end

require 'docker/version'
require 'docker/error'
require 'docker/connection'
require 'docker/model'
require 'docker/multipart'
require 'docker/container'
require 'docker/image'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docker-api-0.0.3 lib/docker.rb
docker-api-0.0.2 lib/docker.rb