Class: Warden::Salesforce::User
- Inherits:
-
Object
- Object
- Warden::Salesforce::User
- Defined in:
- lib/warden-salesforce/user.rb
Instance Attribute Summary collapse
-
#instance_url ⇒ Object
readonly
Returns the value of attribute instance_url.
-
#raw_info ⇒ Object
readonly
Returns the value of attribute raw_info.
-
#refresh_token ⇒ Object
readonly
Returns the value of attribute refresh_token.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#client ⇒ Object
Build a databasedotcom client if databasedotcom gem present.
-
#initialize(access_token) ⇒ User
constructor
A new instance of User.
- #username ⇒ Object
Constructor Details
#initialize(access_token) ⇒ User
Returns a new instance of User.
9 10 11 12 13 14 |
# File 'lib/warden-salesforce/user.rb', line 9 def initialize(access_token) @token = access_token.token @refresh_token = access_token.refresh_token @instance_url = access_token.params['instance_url'] @raw_info = access_token.post(access_token['id']).parsed end |
Instance Attribute Details
#instance_url ⇒ Object (readonly)
Returns the value of attribute instance_url.
6 7 8 |
# File 'lib/warden-salesforce/user.rb', line 6 def instance_url @instance_url end |
#raw_info ⇒ Object (readonly)
Returns the value of attribute raw_info.
7 8 9 |
# File 'lib/warden-salesforce/user.rb', line 7 def raw_info @raw_info end |
#refresh_token ⇒ Object (readonly)
Returns the value of attribute refresh_token.
5 6 7 |
# File 'lib/warden-salesforce/user.rb', line 5 def refresh_token @refresh_token end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/warden-salesforce/user.rb', line 4 def token @token end |
Instance Method Details
#client ⇒ Object
Build a databasedotcom client if databasedotcom gem present
21 22 23 24 25 26 27 |
# File 'lib/warden-salesforce/user.rb', line 21 def client Databasedotcom::Client.new.tap do |config| config.instance_url = instance_url config.oauth_token = token config.refresh_token = refresh_token end end |
#username ⇒ Object
16 17 18 |
# File 'lib/warden-salesforce/user.rb', line 16 def username raw_info['username'] end |