I did this a few years back for Canvas and here is what I remember.
You are the Tool Provider (TP) and those LMSes needs to show your content on their platform. The content can vary, from images, quizzes, etc. Canvas rendered our content in an iframe, and if I am not mistaken all are doing the same.
When some of your content is requested it is usually done via a LTI call. Here's an overview of the thing, https://www.imsglobal.org/basic-overview-how-lti-works - it's not complicated. Basically you need to have one endpoint where all the LTI calls land (they are called "launches"), validate them, and return a specific response.
I used this gem, https://github.com/instructure/ims-lti, and my code looked something like this:
before_action :validate_launch, only: :launch
def launch
pp params.inspect
end
private
def validate_launch
@tool_provider = IMS::LTI::ToolProvider.new(consumer_key, secret_key, params)
Lti::VerifyLaunchParameters.new(@tool_provider, consumer_key, params).call
respond_with_error('Invalid LTI launch') unless @tool_provider.valid_request?(request)
rescue Lti::InvalidLaunchParameter => exception
respond_with_error(exception.message)
end
Check out some youtube videos. I remember this guy: https://www.youtube.com/watch?v=I0zhjzCxovw.
I really don't know how Moodle works, but Canvas had a demo playground where you could test those "launches".