Skip to content

Instantly share code, notes, and snippets.

@krzkrzkrz
Created September 19, 2015 15:16
Show Gist options
  • Save krzkrzkrz/c581443771b3eb0cc5c1 to your computer and use it in GitHub Desktop.
Save krzkrzkrz/c581443771b3eb0cc5c1 to your computer and use it in GitHub Desktop.
class AcceptInvite
def self.call(*args)
new(*args).call
end
include Virtus.model
attribute :invite, Invite
attribute :user, User
attribute :account, Account
attribute :time, Time, default: proc { Time.now }
def call
unless invite_already_accepted?
accept_invite
send_notification_to_inviter
end
end
private
def invite_already_accepted?
# ...
end
def accept_invite
# ...
end
def send_notification_to_inviter
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment