Class: MailruToken

Inherits:
AccessToken
  • Object
show all
Defined in:
lib/authlogic_connect_mailru/mailru_token.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.app_idObject



5
6
7
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 5

def app_id
  credentials[:app_id]
end

.secretObject



9
10
11
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 9

def secret
  credentials[:secret]
end

.sign(params) ⇒ Object



13
14
15
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 13

def sign( params )
  Digest::MD5.hexdigest( params.reject{|k,v| k.to_s == 'sig'}.sort{|a, b| a.first.to_s <=> b.first.to_s}.collect{|key, value| "#{key}=#{value}"}.join + secret )
end

Instance Method Details

#clientObject



19
20
21
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 19

def client
  @client ||= MailruClient.new self
end

#expObject



28
29
30
31
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 28

def exp
  parse_token unless @exp
  @exp.to_i
end

#session_keyObject



23
24
25
26
# File 'lib/authlogic_connect_mailru/mailru_token.rb', line 23

def session_key
  parse_token unless @session_key
  @session_key
end