Class: Evri::RPX::Credentials
- Inherits:
-
Object
- Object
- Evri::RPX::Credentials
- Defined in:
- lib/evri/rpx/credentials.rb
Instance Method Summary collapse
-
#facebook? ⇒ Boolean
Returns true if these credentials are Facebook.
-
#facebook_expires ⇒ Object
Returns when this Facebook session expires, as a Time object.
-
#facebook_session_key ⇒ Object
Returns the Facebook session key.
-
#facebook_uid ⇒ Object
Returns the UID for the authorized Facebook user.
-
#initialize(json) ⇒ Credentials
constructor
A new instance of Credentials.
-
#oauth? ⇒ Boolean
Returns true if these credentials are OAuth.
-
#oauth_token ⇒ Object
Returns the OAuth token.
-
#oauth_token_secret ⇒ Object
Returns the OAuth token secret.
-
#type ⇒ Object
Returns the type of credentials: (Facebook|OAuth|WindowsLive).
-
#windows_live? ⇒ Boolean
Returns true if these credentials are for Windows Live.
-
#windows_live_eact ⇒ Object
Returns the Windows Live eact string, which contains the user’s delegated authentication consent token.
Constructor Details
#initialize(json) ⇒ Credentials
Returns a new instance of Credentials.
4 5 6 |
# File 'lib/evri/rpx/credentials.rb', line 4 def initialize(json) @json = json end |
Instance Method Details
#facebook? ⇒ Boolean
Returns true if these credentials are Facebook.
18 19 20 |
# File 'lib/evri/rpx/credentials.rb', line 18 def facebook? type == 'Facebook' end |
#facebook_expires ⇒ Object
Returns when this Facebook session expires, as a Time object.
29 30 31 |
# File 'lib/evri/rpx/credentials.rb', line 29 def facebook_expires Time.at(@json['expires'].to_i) end |
#facebook_session_key ⇒ Object
Returns the Facebook session key.
23 24 25 |
# File 'lib/evri/rpx/credentials.rb', line 23 def facebook_session_key @json['sessionKey'] end |
#facebook_uid ⇒ Object
Returns the UID for the authorized Facebook user.
34 35 36 |
# File 'lib/evri/rpx/credentials.rb', line 34 def facebook_uid @json['uid'] end |
#oauth? ⇒ Boolean
Returns true if these credentials are OAuth.
39 40 41 |
# File 'lib/evri/rpx/credentials.rb', line 39 def oauth? type == 'OAuth' end |
#oauth_token ⇒ Object
Returns the OAuth token.
44 45 46 |
# File 'lib/evri/rpx/credentials.rb', line 44 def oauth_token @json['oauthToken'] end |
#oauth_token_secret ⇒ Object
Returns the OAuth token secret.
49 50 51 |
# File 'lib/evri/rpx/credentials.rb', line 49 def oauth_token_secret @json['oauthTokenSecret'] end |
#type ⇒ Object
Returns the type of credentials:
(Facebook|OAuth|WindowsLive)
Generally, you should use the helper methods such as #facebook?, #oauth?, #windows_live?
13 14 15 |
# File 'lib/evri/rpx/credentials.rb', line 13 def type @json['type'] end |
#windows_live? ⇒ Boolean
Returns true if these credentials are for Windows Live
54 55 56 |
# File 'lib/evri/rpx/credentials.rb', line 54 def windows_live? type == 'WindowsLive' end |
#windows_live_eact ⇒ Object
Returns the Windows Live eact string, which contains the user’s delegated authentication consent token.
60 61 62 |
# File 'lib/evri/rpx/credentials.rb', line 60 def windows_live_eact @json['eact'] end |