module Devbootcamp::OAuth
Public Class Methods
client()
click to toggle source
# File lib/devbootcamp/oauth.rb, line 14 def client @client ||= OAuth2::Client.new( application_id, secret, site: site ) end
refresh!()
click to toggle source
# File lib/devbootcamp/oauth.rb, line 63 def refresh! self.token = token.refresh! if token && token.refresh_token end
site_uri()
click to toggle source
# File lib/devbootcamp/oauth.rb, line 20 def site_uri URI(client.site) end
token_as_hash()
click to toggle source
# File lib/devbootcamp/oauth.rb, line 39 def token_as_hash { token: token.token, refresh_token: token.refresh_token, expires_at: token.expires_at, } end
token_from_hash(hash)
click to toggle source
# File lib/devbootcamp/oauth.rb, line 47 def token_from_hash(hash) return unless hash @token = OAuth2::AccessToken.new(client, hash[:token], hash) end