Class: ChefAnalytics::ServerAPI

Inherits:
Chef::HTTP
  • Object
show all
Defined in:
lib/chef-analytics/server_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, token, options = {}) ⇒ ServerAPI

Returns a new instance of ServerAPI.



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/chef-analytics/server_api.rb', line 26

def initialize(url, token, options = {})
  options = options.dup
  options[:authentication_token] = token
  super(url, options)

  @authenticator = ChefAnalytics::HTTP::TokenAuthenticator.new(options)
  @request_id = RemoteRequestID.new(options)

  @middlewares << Chef::HTTP::JSONOutput.new(options)
  @middlewares << @authenticator
  @middlewares << @request_id
end

Instance Attribute Details

#authentication_tokenObject

Returns the value of attribute authentication_token.



24
25
26
# File 'lib/chef-analytics/server_api.rb', line 24

def authentication_token
  @authentication_token
end

#urlObject

Returns the value of attribute url.



24
25
26
# File 'lib/chef-analytics/server_api.rb', line 24

def url
  @url
end