module InfinumId module Resources class Invite def initialize(resource_params, current_resource) @resource_params = resource_params @current_resource = current_resource end def self.call(resource_params, current_resource) new(resource_params, current_resource).call end def call @resource = InfinumId.resource_class.create(@resource_params) send_invite_request if @resource.errors.empty? @resource end private attr_reader :current_resource, :resource def send_invite_request InfinumId::Requests::InviteSender.call(@resource.id, current_resource.uid) end end end end