Class: Visa::Token
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Visa::Token
- Defined in:
- app/models/visa/token.rb
Instance Attribute Summary collapse
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
13 14 15 |
# File 'app/models/visa/token.rb', line 13 def secret @secret end |
Class Method Details
.find_by_credentials(client_id, secret) ⇒ Object
15 16 17 18 |
# File 'app/models/visa/token.rb', line 15 def self.find_by_credentials(client_id, secret) token = find_by client_id: client_id token && token.has_secret?(secret) ? token : nil end |
Instance Method Details
#has_secret?(secret) ⇒ Boolean
20 21 22 |
# File 'app/models/visa/token.rb', line 20 def has_secret?(secret) BCrypt::Password.new(encrypted_secret) == secret end |