Class: Stormpath::Rails::SendPasswordResetEmail
- Inherits:
-
Object
- Object
- Stormpath::Rails::SendPasswordResetEmail
- Defined in:
- app/services/stormpath/rails/send_password_reset_email.rb
Constant Summary collapse
- PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE =
2016
- NoEmailError =
Class.new(ArgumentError)
- UnexistingEmailError =
Class.new(ArgumentError)
Instance Attribute Summary collapse
-
#account_store ⇒ Object
readonly
Returns the value of attribute account_store.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
- #application ⇒ Object
- #call ⇒ Object
-
#initialize(email, account_store = nil) ⇒ SendPasswordResetEmail
constructor
A new instance of SendPasswordResetEmail.
Constructor Details
#initialize(email, account_store = nil) ⇒ SendPasswordResetEmail
Returns a new instance of SendPasswordResetEmail.
8 9 10 11 12 |
# File 'app/services/stormpath/rails/send_password_reset_email.rb', line 8 def initialize(email, account_store = nil) raise(NoEmailError, 'Email parameter not provided.') if email.blank? @email = email @account_store = account_store end |
Instance Attribute Details
#account_store ⇒ Object (readonly)
Returns the value of attribute account_store.
6 7 8 |
# File 'app/services/stormpath/rails/send_password_reset_email.rb', line 6 def account_store @account_store end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
6 7 8 |
# File 'app/services/stormpath/rails/send_password_reset_email.rb', line 6 def email @email end |
Instance Method Details
#application ⇒ Object
26 27 28 |
# File 'app/services/stormpath/rails/send_password_reset_email.rb', line 26 def application Stormpath::Rails::Client.application end |
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/stormpath/rails/send_password_reset_email.rb', line 14 def call begin application.send_password_reset_email(email, account_store: account_store) rescue Stormpath::Error => error if error.code == PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE raise UnexistingEmailError, error. else raise end end end |