Class: Nexo::ActiveRecordGoogleTokenStore
- Inherits:
-
Google::Auth::TokenStore
- Object
- Google::Auth::TokenStore
- Nexo::ActiveRecordGoogleTokenStore
- Defined in:
- app/lib/nexo/active_record_google_token_store.rb
Instance Method Summary collapse
Instance Method Details
#delete(id) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/lib/nexo/active_record_google_token_store.rb', line 27 def delete(id) token = find_by_id(id) if token.present? token.update!(nt_status: :revoked) else # TODO: pg_warn("Couldn't find token for revocation: #{id}") end end |
#load(id) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/lib/nexo/active_record_google_token_store.rb', line 6 def load(id) token = find_by_id(id) if token.present? token.secret else nil end end |
#store(integration, token) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/lib/nexo/active_record_google_token_store.rb', line 17 def store(integration, token) ActiveRecord::Base.transaction do # Maybe these should be destroyed integration.tokens.active.update_all(nt_status: :expired) Token.create!(integration:, secret: token) end end |