Last active
August 29, 2015 14:04
-
-
Save christopherstyles/f83f95e17aa8806bc9db to your computer and use it in GitHub Desktop.
Calling service objects from other services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ArchiveInactiveUsers | |
| def self.call(users) | |
| users.each do |user| | |
| UnsubscribeUserFromList.call(user) | |
| SendGoodbyeEmail.call(user) | |
| RemoveUserComment.call(user) | |
| end | |
| end | |
| end | |
| user = User.find(99) | |
| ArchiveInactiveUsers.call([user]) | |
| # => "User #99 was removed from the mailing list." | |
| # => "Sent a goodbye email to User #99." | |
| # => "Removed comments by User #99." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment