Sha256: e0951d7ccb9b9b2625b80e9fbc6747863cbb0fb3bd8cd375a6a56546604b8196

Contents?: true

Size: 746 Bytes

Versions: 10

Compression:

Stored size: 746 Bytes

Contents

require_relative "../ridley_compat"

module Berkshelf
  module APIClient
    require_relative "errors"

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

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkshelf-8.0.15 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.13 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.12 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.9 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.7 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.5 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.2 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.1 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-8.0.0 lib/berkshelf/api_client/chef_server_connection.rb
berkshelf-7.2.2 lib/berkshelf/api_client/chef_server_connection.rb