Class: DockerRegistry

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Authorizable, Encryptable, Taxonomix
Defined in:
app/models/docker_registry.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.humanize_class_name(_name = nil) ⇒ Object



41
42
43
# File 'app/models/docker_registry.rb', line 41

def self.humanize_class_name(_name = nil)
  _("Docker/Registry")
end

Instance Method Details

#apiObject



45
46
47
48
# File 'app/models/docker_registry.rb', line 45

def api
  @api ||= Service::RegistryApi.new(url: url, user: username,
                                    password: password, verify_ssl: verify_ssl)
end

#prefixed_url(image_name) ⇒ Object



36
37
38
39
# File 'app/models/docker_registry.rb', line 36

def prefixed_url(image_name)
  uri = URI(url)
  "#{uri.hostname}:#{uri.port}/#{image_name}"
end

#used_location_idsObject



24
25
26
27
28
# File 'app/models/docker_registry.rb', line 24

def used_location_ids
  Location.joins(:taxable_taxonomies).where(
    'taxable_taxonomies.taxable_type' => 'DockerRegistry',
    'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
end

#used_organization_idsObject



30
31
32
33
34
# File 'app/models/docker_registry.rb', line 30

def used_organization_ids
  Organization.joins(:taxable_taxonomies).where(
    'taxable_taxonomies.taxable_type' => 'DockerRegistry',
    'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
end