class Mailarchiva::RestClient

Public Class Methods

basic_auth(app_name, user, pass) click to toggle source
# File lib/mailarchiva/rest_client.rb, line 29
def self.basic_auth(app_name, user, pass)
  Base64.strict_encode64("#{app_name}:#{user}:#{pass}")
end
client(host, user, pass, ssl, port, app_name) click to toggle source
# File lib/mailarchiva/rest_client.rb, line 23
def self.client(host, user, pass, ssl, port, app_name)
  connection = Faraday.new(url: url(ssl, host, port))
  connection.headers = {'Authorization' => basic_auth(app_name, user, pass), 'Accept' => 'application/json'}
  connection
end
new(args) click to toggle source
Calls superclass method Mailarchiva::Base::new
# File lib/mailarchiva/rest_client.rb, line 7
def initialize(args)
  super(args)
  raise "RestClient is not supported yet b/c it does not work on Mailarchiva as of 4.5.8"
end
url(ssl, host, port) click to toggle source
# File lib/mailarchiva/rest_client.rb, line 33
def self.url(ssl, host, port)
  "%s://%s:%s" % [ssl ? 'https' : 'http', host, port]
end

Public Instance Methods

api() click to toggle source
# File lib/mailarchiva/rest_client.rb, line 19
def api
  "/archiva3/api/blob"
end