Class: RubyRedtail::User
- Inherits:
-
Object
- Object
- RubyRedtail::User
- Defined in:
- lib/ruby-redtail/user.rb,
lib/ruby-redtail/user/contacts.rb,
lib/ruby-redtail/user/settings.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#api_hash ⇒ Object
Returns the value of attribute api_hash.
Class Method Summary collapse
- .authenticate_via_basic(username, password) {|self.new('Basic',username,password)| ... } ⇒ Object
- .authenticate_via_user_key(key) {|self.new('UserKey',key)| ... } ⇒ Object
- .authenticate_via_user_token(token) {|self.new('UserToken',token)| ... } ⇒ Object
Instance Method Summary collapse
- #authentication ⇒ Object
- #contacts ⇒ Object
- #initialize(type, *args) ⇒ User constructor
- #settings ⇒ Object
- #sso ⇒ Object
-
#sso_return_url ⇒ Object
Single Sign-On help.redtailtechnology.com/entries/22602246 returns a URL for Single Sign-On based on the specified endpoint.
-
#user_key ⇒ Object
UserKey Retrieval help.redtailtechnology.com/entries/22621068 returns a UserKey in exchange for the Username and Password specified in the Authentication.
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
#authentication ⇒ Object
41 42 43 |
# File 'lib/ruby-redtail/user.rb', line 41 def authentication RubyRedtail::Authentication.new(RubyRedtail::Query.run("authentication", self.api_hash, "GET")) end |
#contacts ⇒ Object
56 57 58 |
# File 'lib/ruby-redtail/user.rb', line 56 def contacts RubyRedtail::User::Contacts.new self.api_hash end |
#settings ⇒ Object
60 61 62 |
# File 'lib/ruby-redtail/user.rb', line 60 def settings RubyRedtail::User::Settings.new self.api_hash end |
#sso ⇒ Object
52 53 54 |
# 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 ⇒ Object
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
49 50 51 |
# File 'lib/ruby-redtail/user.rb', line 49 def sso_return_url sso.return_url end |
#user_key ⇒ Object
UserKey Retrieval help.redtailtechnology.com/entries/22621068 returns a UserKey in exchange for the Username and Password specified in the Authentication.
38 39 40 |
# File 'lib/ruby-redtail/user.rb', line 38 def user_key authentication.user_key end |