class GH::TokenCheck
Attributes
client_id[RW]
client_secret[RW]
token[RW]
Public Instance Methods
check_token()
click to toggle source
# File lib/gh/token_check.rb, line 16 def check_token return unless @check_token and client_id and client_secret and token @check_token = false auth_header = "Basic %s" % Base64.encode64("#{client_id}:#{client_secret}").gsub("\n", "") http :post, path_for("/applications/#{client_id}/token"), :body => "{\"access_token\": \"#{token}\"}", "Authorization" => auth_header rescue GH::Error(:response_status => 404) => error raise GH::TokenInvalid, error end
http(*)
click to toggle source
Calls superclass method
# File lib/gh/token_check.rb, line 26 def http(*) check_token super end
setup(backend, options)
click to toggle source
Calls superclass method
# File lib/gh/token_check.rb, line 8 def setup(backend, options) @client_secret = options[:client_secret] @client_id = options[:client_id] @token = options[:token] @check_token = true super end