Project

General

Profile

Download (624 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / models / service / registry_api.rb @ ada932ab

1
module Service
2
  class RegistryApi
3
    DEFAULTS = { :url => 'http://localhost:5000' }
4
    attr_reader :config
5

    
6
    def initialize(params = {})
7
      @config = DEFAULTS.merge(params)
8
    end
9

    
10
    def search(aquery)
11
      response = RestClient.get(config[:url] + '/v1/search',
12
                                :params => { :q => aquery }, :accept => :json)
13
      JSON.parse(response.body)
14
    end
15

    
16
    def list_repository_tags(arepository)
17
      response = RestClient.get(config[:url] + "/v1/repositories/#{arepository}/tags",
18
                                :accept => :json)
19
      JSON.parse(response.body)
20
    end
21
  end
22
end