Rails passthrough to other application - ruby-on-rails

I am building a rails website that must pass some routes through to other applications (written in ASP.Net Core). The rails website must serve some pages define as normal rails views/controllers, and some that come through from the other ASP.Net applications.
Authentication will only be handled at the Rails level.
This means that some rails controllers will call the other applications (which are not publicly accessible) by sending all post data through and send back their response directly without parsing or further looking at it.
What is the best way to accomplish this?

Related

Using Rails to build a frontend for an API (the MVC "model" is an external API not a database)

I see plenty of articles, posts, and videos about using Rails to build an API-only back-end that is consumed by a various possible front-end technologies (React, Angular, Vue, etc.).
However if one of the desired front-end apps is a separate, standalone front-end for the API built with Rails, are there any tools, gems, or techniques that facilitate creating a "regular" Rails MVC app except, I suppose, the controller CRUD actions replace ActiveRecord with API calls?
One use case example might be that web and mobile front-ends used by consumers will use Vue.js or React. But an entirely separate "managers" front-end app is quicker to develop and easier to maintain using Rails, while still strictly enforcing back-end / front-end separation.
There is ActiveResource. According to the Overview:
Model classes are mapped to remote REST resources by Active Resource much the same way Active Record maps model classes to database tables. When a request is made to a remote resource, a REST JSON request is generated, transmitted, and the result received and serialized into a usable Ruby object.
I gave ActiveResource a go many moons ago. In the end, I rolled my own.

Configuration details for Rails API-only app with one or two full routes

Let's assume I created a rails app passing the --api flag.
I want one or two routes that are full rails, with extra middleware, that inherit from ActionController::Base to serve the javascript single page application or whatever, etc.
I can presumably put them into a Rails engine and have the rest of the app use the api controllers and less middleware.
What would I need to do to configure a Rails Engine to handle the root route like a full rails app while the main app was api only? Are there alternative configurations that may be worth considering?

How can I make different rails sites interact with each other?

I'm a website designer who's fairly new to rails. I'm building a custom CMS for the websites I design.
The idea is that clients will be able to login to their cms panel (on their individual domain and hosting) and can submit a support ticket which will be forwarded to my admin panel on my domain and hosting.
Is anyone aware of a learning resource for this type of function?
Any advice would be great, thanks.
Rails is primarily built to handle web requests, so that's the most straightforward way to interact between Rails apps. Just create a post request containing the ticket info, targeted at your admin panel app, which has the typical Rails setup to handle it.
Rails uses helpers called routes to efficiently handle form submissions. Instead of the expected route any form_for #mymodel can specify a url to send the form to, ostensibly to an offsite url as you desire.

Ruby on Rails application/REST API authentication architecture

I'm going to develop a Ruby on Rails application (basically a back-office) which at the same time will serve data for an Android mobile app via the REST interface Rails provides.
My concerns here are the following: how should I manage and structure my ROR application so that REST calls from Android are authenticated with an API Key + user ID (I was also thinking in using OAuth) and, on the other side, users can interact with via back-office.
Should I use for example different controllers for the same resources (thus, increasing complexity) for BO accesses and Mobile client accesses (so I can implement different auth logic)?
Is there any standard/common way (aka gem) to manage and implement this behavior?
Thanks in advance!

Designing Web Service Using Ruby on Rails - Mapping ActiveRecord Models

I've put together a RoR application and would now like to publish a RESTful web service for interacting with my application.
I'm not sure where to go exactly, I don't want to simply expose my ActiveRecord models since there is some data on each model that isn't needed or shouldn't be exposed via an API like this. I also don't want to create a SOAP solution.
My application is built using Rails 2.3.5 and I hope to move to Rails 3.0 soon after its released.
I'm basically looking for a way to map my ActiveRecord models to "models" that would be exposed via the web service. Is ActiveResource the correct thing to use? What about ActionWebService?
You can do that through a controller (or controllers). Your RESTful controller actions can define the API for incoming web service requests, and you can render XML or JSON in the response instead of rendering an HTML view.
I'm sure there are more sophisticated ways of doing this, but this is the simple approach.

Resources