Sha256: c4b45e8a1c09d5cd261fe84bf1993bea83fc2c981b087bb9650a485b772de71d

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

require 'berkshelf/ridley_compat'

module Berkshelf::APIClient
  require_relative 'errors'

  class ChefServerConnection
    attr_reader :client

    def initialize(*args)
      @client = Berkshelf::RidleyCompat.new(*args)
      @url = args[0][:server_url]
    end

    def universe
      response = client.get("universe")

      [].tap do |cookbooks|
        response.each do |name, versions|
          versions.each { |version, attributes|
            attributes[:location_path] = @url
            cookbooks << RemoteCookbook.new(name, version, attributes) }
        end
      end
    rescue Ridley::Errors::HTTPNotFound
      raise ServiceNotFound, "service not found at: #{@url}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
berkshelf-api-client-4.0.1 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-api-client-4.0.0 lib/berkshelf/api_client/chef_server_connection.rb