class RubyRedtail::User

Attributes

api_hash[RW]

Public Class Methods

authenticate_via_basic(username, password) { |self('Basic',username,password)| ... } click to toggle source
# File lib/ruby-redtail/user.rb, line 23
def self.authenticate_via_basic(username, password)
  yield self.new('Basic',username,password)
end
authenticate_via_user_key(key) { |self('UserKey',key)| ... } click to toggle source
# File lib/ruby-redtail/user.rb, line 27
def self.authenticate_via_user_key(key)
  yield self.new('UserKey',key)
end
authenticate_via_user_token(token) { |self('UserToken',token)| ... } click to toggle source
# File lib/ruby-redtail/user.rb, line 31
def self.authenticate_via_user_token(token)
  yield self.new('UserToken',token)
end
new(type, *args) click to toggle source

help.redtailtechnology.com/entries/21654562-authentication-methods

# File lib/ruby-redtail/user.rb, line 11
def initialize type, *args
  if type == "Basic"
    self.api_hash = "Basic " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}:#{args[1]}")
  elsif type == "UserKey"
    self.api_hash = "Userkeyauth " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}")
  elsif type == "UserToken"
    self.api_hash = "UsertokenAuth " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}")
  else
    raise ArgumentError
  end
end

Public Instance Methods

authentication() click to toggle source
# File lib/ruby-redtail/user.rb, line 41
def authentication
  RubyRedtail::Authentication.new(RubyRedtail::Query.run("authentication", self.api_hash, "GET"))
end
contacts() click to toggle source
# File lib/ruby-redtail/user.rb, line 56
def contacts
  RubyRedtail::User::Contacts.new self.api_hash
end
settings() click to toggle source
# File lib/ruby-redtail/user.rb, line 60
def settings
  RubyRedtail::User::Settings.new self.api_hash
end
sso() click to toggle source
# File lib/ruby-redtail/user.rb, line 52
      def sso
  RubyRedtail::Sso.new(RubyRedtail::Query.run("sso", self.api_hash, "GET"))
end
sso_return_url() click to toggle source

Single Sign-On help.redtailtechnology.com/entries/22602246 returns a URL for Single Sign-On based on the specified endpoint. TODO: pass endpoint and id parameters

# File lib/ruby-redtail/user.rb, line 49
def sso_return_url
  sso.return_url
end
user_key() click to toggle source

UserKey Retrieval help.redtailtechnology.com/entries/22621068 returns a UserKey in exchange for the Username and Password specified in the Authentication.

# File lib/ruby-redtail/user.rb, line 38
def user_key
  authentication.user_key
end