class Berkshelf::APIClient::Connection

def initialize(url, options = {})

Options Hash: (**options)
  • :retry_interval (Float) --
  • :retries (Integer) --
  • :timeout (Integer) --
  • :open_timeout (Integer) --

Parameters:
  • url (String, Addressable::URI) --
def initialize(url, options = {})
  # it looks like Faraday mutates the URI argument it is given, when we ripped Faraday out of this
  # API it stopped doing that.  this may or may not be a breaking change (it broke some fairly
  # brittle berkshelf tests).  if it causes too much berkshelf chaos we could revert by uncommenting
  # the next line.  as it is removing this behavior feels more like fixing a bug.
  # @url = url.normalize! if url.is_a?(Addressable::URI)
  options = { retries: 3, retry_interval: 0.5, open_timeout: 30, timeout: 30 }.merge(options)
  options[:server_url] = url
  @client = Berkshelf::RidleyCompatJSON.new(**options)
end

def universe

Returns:
  • (Array) -

Raises:
  • (APIClient::TimeoutError) -
def universe
  response = @client.get("universe")
  [].tap do |cookbooks|
    response.each do |name, versions|
      versions.each { |version, attributes| cookbooks << RemoteCookbook.new(name, version, attributes) }
    end
  end
end