Sha256: 8d0d72d84732978f94c866919e8c6395ceaa455bc00ff241ff4a45d1742aa9ed
Contents?: true
Size: 851 Bytes
Versions: 15
Compression:
Stored size: 851 Bytes
Contents
module Service class RegistryApi DEFAULTS = { :url => 'http://localhost:5000' } attr_reader :config def initialize(params = {}) config = DEFAULTS.merge(params) uri = URI(config.delete(:url)) uri.user = config.delete(:user) unless config[:user].blank? uri.password = config.delete(:password) unless config[:password].blank? @config = config.merge(:url => uri.to_s) end def search(aquery) response = RestClient.get(config[:url] + '/v1/search', :params => { :q => aquery }, :accept => :json) JSON.parse(response.body) end def list_repository_tags(arepository) response = RestClient.get(config[:url] + "/v1/repositories/#{arepository}/tags", :accept => :json) JSON.parse(response.body) end end end
Version data entries
15 entries across 15 versions & 1 rubygems