Class: Evri::RPX::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/evri/rpx/credentials.rb

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


18
19
20
# File 'lib/evri/rpx/credentials.rb', line 18

def facebook?
  type == 'Facebook'
end

#facebook_expiresObject

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_keyObject

Returns the Facebook session key.



23
24
25
# File 'lib/evri/rpx/credentials.rb', line 23

def facebook_session_key
  @json['sessionKey']
end

#facebook_uidObject

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.

Returns:

  • (Boolean)


39
40
41
# File 'lib/evri/rpx/credentials.rb', line 39

def oauth?
  type == 'OAuth'
end

#oauth_tokenObject

Returns the OAuth token.



44
45
46
# File 'lib/evri/rpx/credentials.rb', line 44

def oauth_token
  @json['oauthToken']
end

#oauth_token_secretObject

Returns the OAuth token secret.



49
50
51
# File 'lib/evri/rpx/credentials.rb', line 49

def oauth_token_secret
  @json['oauthTokenSecret']
end

#typeObject

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

Returns:

  • (Boolean)


54
55
56
# File 'lib/evri/rpx/credentials.rb', line 54

def windows_live?
  type == 'WindowsLive'
end

#windows_live_eactObject

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