Create a basic Interactor
masterTo define a basic interactor, create a class that includes the Interactor module and implement a call instance method. The interactor can access and modify its context within the call method.
class AuthenticateUser
include Interactor
def call
if user = User.authenticate(context.email, context.password)
context.user = user
context.token = user.secret_token
else
context.fail!(message: "authenticate_user.failure")
end
end
end