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