class Arbor::Client

Attributes

highest_revision[RW]
host[RW]
password[RW]
settings[RW]
username[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/arbor/client.rb, line 12
def initialize(*args)
  @settings = args.last.is_a?(Hash) ? args.pop : {}
  raise ArgumentError, "must supply a subdomain, username and password" if args.length < 3
  subdomain, @username, @password = args
  @host = "https://#{subdomain}.uk.arbor.sc"
  @highest_revision = 0
end

Private Instance Methods

configure_request(path, *args) click to toggle source
# File lib/arbor/client.rb, line 31
def configure_request(path, *args)
  url = "#{host}#{path}"
  request = HTTPI::Request.new(url, *args)
  request.headers["Accept"] = "application/json"
  auth_type = settings[:adapter] == :net_http ? :basic : :digest
  request.auth.send(auth_type, username, password)
  request
end