Method: Berkshelf::Source#api_client

Defined in:
lib/berkshelf/source.rb

#api_clientObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/berkshelf/source.rb', line 60

def api_client
  @api_client ||= case type
                  when :chef_server
                    APIClient.chef_server(server_url: uri.to_s, **options)
                  when :artifactory
                    # Don't accidentally mutate the options.
                    client_options = options.dup
                    api_key = client_options.delete(:api_key)
                    APIClient.new(uri, headers: { "X-Jfrog-Art-Api" => api_key }, **client_options)
                  when :chef_repo
                    ChefRepoUniverse.new(uri_string, **options)
                  else
                    APIClient.new(uri, **options)
                  end
end