Class: OmniAuth::Strategies::Mixi

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/mixi.rb

Constant Summary collapse

MINIMUM_SCOPE =
'r_profile'
BASIC_SCOPE =
([MINIMUM_SCOPE] + ['name',
                   'location',
                   'about_me'].map {|scope|
  "#{MINIMUM_SCOPE}_#{scope}"
}).join(' ')

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/omniauth/strategies/mixi.rb', line 56

def authorize_params
  super.tap do |params|
    %w[display state scope].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
        session['omniauth.state'] = params[:state] if v == 'state'
      end
    end
    unless params[:scope]
      if options[:info_level] == :min
        params[:scope] = MINIMUM_SCOPE
      else
        params[:scope] = BASIC_SCOPE
      end
    end
  end
end

#callback_urlObject



52
53
54
# File 'lib/omniauth/strategies/mixi.rb', line 52

def callback_url
  full_host + script_name + callback_path
end

#raw_infoObject



46
47
48
49
50
# File 'lib/omniauth/strategies/mixi.rb', line 46

def raw_info
  access_token.options[:mode] = :header
  @raw_info ||=
    access_token.get('/2/people/@me/@self?fields=@all').parsed['entry']
end