Class: RubyRedtail::User
- Inherits:
-
Object
show all
- Defined in:
- lib/ruby-redtail/user.rb,
lib/ruby-redtail/user/contacts.rb,
lib/ruby-redtail/user/settings.rb
Defined Under Namespace
Classes: Contacts, Settings
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(type, *args) ⇒ User
11
12
13
14
15
16
17
18
19
20
21
|
# 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
|
Instance Attribute Details
#api_hash ⇒ Object
Returns the value of attribute api_hash.
8
9
10
|
# File 'lib/ruby-redtail/user.rb', line 8
def api_hash
@api_hash
end
|
Class Method Details
.authenticate_via_basic(username, password) {|self.new('Basic',username,password)| ... } ⇒ Object
23
24
25
|
# 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.new('UserKey',key)| ... } ⇒ Object
27
28
29
|
# 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.new('UserToken',token)| ... } ⇒ Object
31
32
33
|
# File 'lib/ruby-redtail/user.rb', line 31
def self.authenticate_via_user_token(token)
yield self.new('UserToken',token)
end
|
Instance Method Details
#sso_return_url ⇒ Object
49
50
51
|
# File 'lib/ruby-redtail/user.rb', line 49
def sso_return_url
sso.return_url
end
|
#user_key ⇒ Object
38
39
40
|
# File 'lib/ruby-redtail/user.rb', line 38
def user_key
authentication.user_key
end
|