Class: Contrib::Auth::Api
- Inherits:
-
Object
- Object
- Contrib::Auth::Api
- Defined in:
- lib/contrib/auth/api.rb
Instance Method Summary collapse
- #certificates ⇒ Object
- #change_password(id_token, password, password_confirmation) ⇒ Object
-
#initialize(provider = nil) ⇒ Api
constructor
A new instance of Api.
- #reset_password(email_or_username) ⇒ Object
- #sign_in_with_password(email_or_username, password) ⇒ Object
- #sign_up_with_email_and_password(email_or_username, password) ⇒ Object
Constructor Details
#initialize(provider = nil) ⇒ Api
Returns a new instance of Api.
4 5 6 |
# File 'lib/contrib/auth/api.rb', line 4 def initialize(provider = nil) @provider = provider end |
Instance Method Details
#certificates ⇒ Object
34 35 36 |
# File 'lib/contrib/auth/api.rb', line 34 def certificates @provider.certificates end |
#change_password(id_token, password, password_confirmation) ⇒ Object
28 29 30 31 32 |
# File 'lib/contrib/auth/api.rb', line 28 def change_password(id_token, password, password_confirmation) raise ArgumentError unless password == password_confirmation @provider.change_password(id_token, password) end |
#reset_password(email_or_username) ⇒ Object
16 17 18 |
# File 'lib/contrib/auth/api.rb', line 16 def reset_password(email_or_username) @provider.reset_password(email_or_username) end |
#sign_in_with_password(email_or_username, password) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/contrib/auth/api.rb', line 8 def sign_in_with_password(email_or_username, password) raise ArgumentError unless email_or_username raise ArgumentError unless password # TODO: Implement retryable # TODO: Validate incoming attributes @provider.sign_in_with_password(email_or_username, password) end |
#sign_up_with_email_and_password(email_or_username, password) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/contrib/auth/api.rb', line 20 def sign_up_with_email_and_password(email_or_username, password) raise ArgumentError unless email_or_username raise ArgumentError unless password # TODO: ask for password confirmation @provider.sign_up_with_email_and_password(email_or_username, password) end |