Class: Pog
- Inherits:
-
Object
- Object
- Pog
- Defined in:
- lib/generators/pog/templates/pog_handler.rb
Instance Method Summary collapse
- #access_token_expired? ⇒ Boolean
- #has_permission? ⇒ Boolean
-
#initialize(options) ⇒ Pog
constructor
options expected to include client_id, client_secret, and redirect_uri.
- #retrieve_auth(options) ⇒ Object
Constructor Details
#initialize(options) ⇒ Pog
options expected to include client_id, client_secret, and redirect_uri
4 5 6 7 8 |
# File 'lib/generators/pog/templates/pog_handler.rb', line 4 def initialize() @client_id = [:client_id] @client_secret = [:client_secret] @redirect_uri = [:redirect_uri] end |
Instance Method Details
#access_token_expired? ⇒ Boolean
14 15 16 |
# File 'lib/generators/pog/templates/pog_handler.rb', line 14 def access_token_expired? self.access_token_expiration_time < Time.now end |
#has_permission? ⇒ Boolean
10 11 12 |
# File 'lib/generators/pog/templates/pog_handler.rb', line 10 def self. end |
#retrieve_auth(options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/pog/templates/pog_handler.rb', line 18 def retrieve_auth() scope = create_uri_from_scopes() @client = Signet::OAuth2::Client.new( :authorization_uri => 'https://accounts.google.com/o/oauth2/auth', :token_endpoint_uri => 'https://accounts.google.com/o/oauth2/token', :client_id => @client_id, :client_secret => @client_secret, :scope => scope, :redirect_uri => @redirect_uri ) @client..to_s end |