Class: Tagfish::DockerRegistryVbothClient

Inherits:
Object
  • Object
show all
Defined in:
lib/tagfish/docker_registry_vboth_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(docker_uri, debug) ⇒ DockerRegistryVbothClient

Returns a new instance of DockerRegistryVbothClient.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tagfish/docker_registry_vboth_client.rb', line 13

def initialize(docker_uri, debug)
  @api_call = APICall.new(debug)
  @docker_uri = docker_uri
  code = api_call.get(ping_uri).code
  if code == 401
    api_call.auth(docker_uri.registry)
    code = api_call.get(ping_uri).code
  end
  if code == 401
    raise DockerRegistryClient::AuthenticationError, "Please `docker login <REGISTRY>` and try again"
  elsif code != 200
    raise DockerRegistryClient::APIVersionError, "Not recognized"
  end
end

Instance Attribute Details

#api_callObject

Returns the value of attribute api_call.



11
12
13
# File 'lib/tagfish/docker_registry_vboth_client.rb', line 11

def api_call
  @api_call
end

#docker_uriObject

Returns the value of attribute docker_uri.



10
11
12
# File 'lib/tagfish/docker_registry_vboth_client.rb', line 10

def docker_uri
  @docker_uri
end

Instance Method Details

#base_uriObject



28
29
30
# File 'lib/tagfish/docker_registry_vboth_client.rb', line 28

def base_uri
  "#{docker_uri.protocol}#{docker_uri.registry}"
end