Class: Googl::OAuth2::Server

Inherits:
Object
  • Object
show all
Includes:
Utils, Utils
Defined in:
lib/googl/oauth2/server.rb

Constant Summary

Constants included from Utils

Utils::API_CLIENT_LOGIN_URL, Utils::API_HISTORY_URL, Utils::API_URL, Utils::SCOPE_URL

Instance Attribute Summary collapse

Attributes included from Utils

#access_token, #client_id, #client_secret, #expires_at, #expires_in, #items, #refresh_token

Instance Method Summary collapse

Methods included from Utils

#authorized?, #expires?, #history

Constructor Details

#initialize(client_id, client_secret, redirect_uri) ⇒ Server

Returns a new instance of Server



11
12
13
14
15
# File 'lib/googl/oauth2/server.rb', line 11

def initialize(client_id, client_secret, redirect_uri)
  self.client_id     = client_id
  self.client_secret = client_secret
  self.redirect_uri  = redirect_uri
end

Instance Attribute Details

#redirect_uriObject

Returns the value of attribute redirect_uri



9
10
11
# File 'lib/googl/oauth2/server.rb', line 9

def redirect_uri
  @redirect_uri
end

Instance Method Details

#authorize_urlObject



17
18
19
# File 'lib/googl/oauth2/server.rb', line 17

def authorize_url
  make_authorize_url(redirect_uri)
end

#request_access_token(code) ⇒ Object



21
22
23
# File 'lib/googl/oauth2/server.rb', line 21

def request_access_token(code)
  request_token(code, redirect_uri)
end