Class: Account::Service::Confirmation
- Inherits:
-
Object
- Object
- Account::Service::Confirmation
- Defined in:
- app/models/aikotoba/account/service/confirmation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #confirm! ⇒ Object
- #create_token!(notify:) ⇒ Object
-
#initialize(account:) ⇒ Confirmation
constructor
A new instance of Confirmation.
Constructor Details
#initialize(account:) ⇒ Confirmation
Returns a new instance of Confirmation.
13 14 15 |
# File 'app/models/aikotoba/account/service/confirmation.rb', line 13 def initialize(account:) @account = account end |
Class Method Details
.confirm!(account:) ⇒ Object
9 10 11 |
# File 'app/models/aikotoba/account/service/confirmation.rb', line 9 def self.confirm!(account:) new(account: account).confirm! end |
.create_token!(account:, notify: false) ⇒ Object
5 6 7 |
# File 'app/models/aikotoba/account/service/confirmation.rb', line 5 def self.create_token!(account:, notify: false) new(account: account).create_token!(notify: notify) end |
Instance Method Details
#confirm! ⇒ Object
24 25 26 27 28 29 |
# File 'app/models/aikotoba/account/service/confirmation.rb', line 24 def confirm! ActiveRecord::Base.transaction do @account.confirm! @account.confirmation_token&.destroy! end end |
#create_token!(notify:) ⇒ Object
17 18 19 20 21 22 |
# File 'app/models/aikotoba/account/service/confirmation.rb', line 17 def create_token!(notify:) ActiveRecord::Base.transaction do @account.build_confirmation_token.save! @account.confirmation_token.notify if notify end end |