class DockerRegistry::Client

Public Class Methods

new(base_uri, options = {}) click to toggle source

@param [#to_s] base_uri Docker registry base URI @param [Hash] options Client options @option options [#to_s] :user User name for basic authentication @option options [#to_s] :password Password for basic authentication

# File lib/docker_registry/client.rb, line 11
def initialize(base_uri, options = {})
  @base_uri = base_uri.to_s
  @faraday = Faraday.new(@base_uri) do |builder|
    builder.request :json
    builder.use DockerRegistry::OjParser, content_type: /\bjson$/

    if options[:user] && options[:password]
      builder.request(
        :basic_auth,
        options[:user].to_s, options[:password].to_s
      )
    end

    builder.adapter :net_http
  end
end

Public Instance Methods

delete_reporitory_tag(repository_name, tag_name) click to toggle source
# File lib/docker_registry/client.rb, line 49
def delete_reporitory_tag(repository_name, tag_name)
  @faraday\
    .delete("/v1/repositories/#{repository_name}/tags/#{tag_name}")\
    .status == 200
end
delete_repository(name) click to toggle source
# File lib/docker_registry/client.rb, line 45
def delete_repository(name)
  @faraday.delete("/v1/repositories/#{name}/").status == 200
end
ping() click to toggle source
# File lib/docker_registry/client.rb, line 28
def ping
  @faraday.get('/v1/_ping').body
end
repositry_tag(name, tag) click to toggle source
# File lib/docker_registry/client.rb, line 41
def repositry_tag(name, tag)
  @faraday.get("/v1/repositories/#{name}/tags/#{tag}").body
end
repositry_tags(name) click to toggle source
# File lib/docker_registry/client.rb, line 37
def repositry_tags(name)
  @faraday.get("/v1/repositories/#{name}/tags").body
end