class ApiClient::Configuration

ApiClient::Configuration provides a way to configure ApiClient globally.

Attributes

header[R]
hydra[RW]
mock[RW]

Public Instance Methods

basic_auth(account, password) click to toggle source

Set a basic authentication for all requisitions.

@param [String] account the user for requisitions. @param [String] password the password for requisitions.

# File lib/api-client/configuration.rb, line 50
def basic_auth(account, password)
  @header.merge!({ 'Authorization' => "Basic #{["#{account}:#{password}"].pack('m').delete("\r\n")}" })
end
header=(header = {}) click to toggle source

Set the default params of header.

@param [Hash] header the default header for requisitions.

# File lib/api-client/configuration.rb, line 42
def header=(header = {})
  @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)
end
path() click to toggle source

Return the api url.

@return [String] the api url.

# File lib/api-client/configuration.rb, line 10
def path
  @paths.each do |name, path|
    raise Exceptions::BadlyConfigured.new(name) unless path.size > 1
  end
  @paths
end
path=(path) click to toggle source

Set the api url.

@param [String] path api url.

# File lib/api-client/configuration.rb, line 20
def path=(path)
  path = "#{path}/" unless path[path.size - 1, 1] == '/'
  @paths = { :default => path }
end
paths=(paths = {}) click to toggle source

Set several api urls.

@param [Hash] paths hash with paths to api urls.

# File lib/api-client/configuration.rb, line 28
def paths=(paths = {})
  @paths = {}
  paths.each do |name, path|
    if path[path.size - 1, 1] == '/'
      @paths[name] = path
    else
      @paths[name] = "#{path}/"
    end
  end
end