Class: TokenPair
- Inherits:
-
Object
- Object
- TokenPair
- Defined in:
- lib/google_exporter.rb
Overview
Set up our token store
Instance Method Summary collapse
-
#initialize(hash) ⇒ TokenPair
constructor
A new instance of TokenPair.
- #set? ⇒ Boolean
- #to_hash ⇒ Object
- #update_token!(object) ⇒ Object
Constructor Details
#initialize(hash) ⇒ TokenPair
Returns a new instance of TokenPair.
13 14 15 16 17 18 19 20 |
# File 'lib/google_exporter.rb', line 13 def initialize(hash) if hash != nil @access_token = hash[:access_token] @expires_in = hash[:expires_in] @issued_at = hash[:issued_at] @refresh_token= hash[:refresh_token] end end |
Instance Method Details
#set? ⇒ Boolean
29 30 31 |
# File 'lib/google_exporter.rb', line 29 def set? @refresh_token != nil end |
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/google_exporter.rb', line 33 def to_hash return { :refresh_token => @refresh_token, :access_token => @access_token, :expires_in => @expires_in, :issued_at => Time.at(@issued_at) } end |
#update_token!(object) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/google_exporter.rb', line 22 def update_token!(object) @refresh_token = object.refresh_token @access_token = object.access_token @expires_in = object.expires_in @issued_at = object.issued_at end |