Class: OauthService::MailRu

Inherits:
Provider show all
Defined in:
app/controllers/concerns/oauth_service/mailru.rb

Constant Summary

Constants inherited from Provider

Provider::AVAILABLE_PROVIDERS

Instance Attribute Summary

Attributes inherited from Provider

#auth_url, #client_id, #client_secret, #downcase_name, #info_url, #name, #scopes, #token_url

Instance Method Summary collapse

Methods inherited from Provider

get_provider_by_name, #get_redirect_uri, #get_token_params, providers_data

Constructor Details

#initialize(name, downcase_name, auth_url, client_id, client_secret, info_url, scopes, token_url) ⇒ MailRu

Returns a new instance of MailRu.



3
4
5
6
7
8
# File 'app/controllers/concerns/oauth_service/mailru.rb', line 3

def initialize(name, downcase_name, auth_url, client_id, client_secret,
  info_url, scopes, token_url)
  super(name, downcase_name, auth_url, client_id, client_secret,
  info_url, scopes, token_url)
  @scopes = nil
end

Instance Method Details

#get_info_headers(options = {}) ⇒ Object



14
15
16
# File 'app/controllers/concerns/oauth_service/mailru.rb', line 14

def get_info_headers(options = {})
  nil
end

#get_info_params(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/concerns/oauth_service/mailru.rb', line 18

def get_info_params(options = {})
  query_params = {
    'app_id' => client_id,
    'method' => 'users.getInfo',
    'secure' => 1,
    'session_key' => options[:access_token]
  }
  query_params['sig'] = Digest::MD5.hexdigest(query_params.collect { |v| v.join('=') }.join + client_secret)
  query_params
end

#get_user_info(info) ⇒ Object



10
11
12
# File 'app/controllers/concerns/oauth_service/mailru.rb', line 10

def (info)
  info.first
end