class OmniAuth::Strategies::Zaif
Public Instance Methods
callback_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/zaif.rb, line 55 def callback_phase super rescue StandardError => e fail!(:unkown_error, e) end
raw_info()
click to toggle source
# File lib/omniauth/strategies/zaif.rb, line 34 def raw_info return @raw_info if @raw_info uri = URI.parse('https://api.zaif.jp/tapi') https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true req = Net::HTTP::Post.new(uri.request_uri) req['token'] = access_token.token req.set_form_data({nonce: Time.now.to_f, method: 'get_id_info'}) res = https.request(req) raise "failed to execute get_id_info. http status code: #{res.code}" unless res.code.to_i == 200 res = JSON.load(res.body) raise "failed to execute get_id_info. error: #{res['error']}" unless res['success'] == 1 @raw_info = res['return']['user'] end