Class: Procore::Auth::Stores::ActiveRecord
- Inherits:
-
Object
- Object
- Procore::Auth::Stores::ActiveRecord
- Defined in:
- lib/procore/auth/stores/active_record.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #delete ⇒ Object
- #fetch ⇒ Object
-
#initialize(object:) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #save(token) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(object:) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
7 8 9 |
# File 'lib/procore/auth/stores/active_record.rb', line 7 def initialize(object:) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/procore/auth/stores/active_record.rb', line 5 def object @object end |
Instance Method Details
#delete ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/procore/auth/stores/active_record.rb', line 27 def delete object.update( access_token: nil, expires_at: nil, refresh_token: nil, ) end |
#fetch ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/procore/auth/stores/active_record.rb', line 19 def fetch Procore::Auth::Token.new( access_token: object.access_token, refresh_token: object.refresh_token, expires_at: object.expires_at, ) end |
#save(token) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/procore/auth/stores/active_record.rb', line 11 def save(token) object.update( access_token: token.access_token, refresh_token: token.refresh_token, expires_at: token.expires_at, ) end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/procore/auth/stores/active_record.rb', line 35 def to_s "Active Record, Object: #{object.class} #{object.id}" end |