Module: Docker::Distribution::Api

Defined in:
lib/docker/distribution/api.rb,
lib/docker/distribution/api/util.rb,
lib/docker/distribution/api/version.rb,
lib/docker/distribution/api/manifest.rb

Defined Under Namespace

Modules: Util Classes: Manifest

Constant Summary collapse

VERSION =
'0.1.1'
API_VERSION =
'2'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#credsObject

Returns the value of attribute creds.



4
5
6
# File 'lib/docker/distribution/api.rb', line 4

def creds
  @creds
end

Class Method Details

.connectionObject



40
41
42
# File 'lib/docker/distribution/api.rb', line 40

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

.loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/docker/distribution/api.rb', line 4

def logger
  @logger
end

.logger=(value) ⇒ Object

Sets the attribute logger

Parameters:

  • value

    the value to set the attribute logger to.



4
5
6
# File 'lib/docker/distribution/api.rb', line 4

def logger=(value)
  @logger = value
end

.optionsObject



31
32
33
# File 'lib/docker/distribution/api.rb', line 31

def options
  @options ||= {}
end

.options=(new_options) ⇒ Object



35
36
37
38
# File 'lib/docker/distribution/api.rb', line 35

def options=(new_options)
  @options = @options.merge(new_options || {})
  reset_connection!
end

.reset_connection!Object



44
45
46
# File 'lib/docker/distribution/api.rb', line 44

def reset_connection!
  @connection = nil
end

.tags(repository, connection = self.connection) ⇒ Object



17
18
19
20
# File 'lib/docker/distribution/api.rb', line 17

def tags(repository, connection = self.connection)
  response = connection.get("/#{repository}/tags/list")
  Util.parse_json(response.body)['tags']
end

.urlObject



22
23
24
# File 'lib/docker/distribution/api.rb', line 22

def url
  @url ||= 'localhost:5000'
end

.url=(new_url) ⇒ Object



26
27
28
29
# File 'lib/docker/distribution/api.rb', line 26

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

.version(connection = self.connection) ⇒ Object



12
13
14
15
# File 'lib/docker/distribution/api.rb', line 12

def version(connection = self.connection)
  response = connection.get('/')
  response.headers['Docker-Distribution-Api-Version']
end