module Mongoid::Xoauth
Public Instance Methods
oauth(klass)
click to toggle source
# File lib/mongoid/xoauth.rb, line 24 def oauth(klass) self.oauths.find_by(_type: klass.to_s) # "Oauth::#{name.to_s.capitalize}" end
refresh_oauth(oauth)
click to toggle source
# File lib/mongoid/xoauth.rb, line 28 def refresh_oauth(oauth) auth = self.oauth(oauth.class) if auth.access_token == oauth.access_token # check expires_in else %w{access_token created_at expires_in refresh_token}.each do |key| auth[key] = oauth[key] end end auth end