We’ve a pretty large rails application and we are currently deciding
moving a part of the application front-end to a desktop GUI.
For communication between application and GUI we decided to use an API.
So basically what I need is a way to have our models functionality
accessible by the GUI.
The basic idea:
Rails app provides API for models <-> HTTPS Connection <-> GUI can
access models with correct authentication
I took a look to ActionWebservice, but I’m not sure if this is the best
solution.
My concern: The application has currently about 90 models. If I
understood AWS correctly, I need to create an API class for every model
and a ‘service’ for every model I want to serve?
Is there an automation script for this or is there a more direct
approach to my problem ?
dir: RAILS_ROOT/app/controller/myserver_controller.rb
class MyserverController < ApplicationController
wsdl_service_name ‘Myserver’
web_service_api MyserverApi
def list_products(str)
end
def list_users(str)
end
def list_orders(str)
end
end
In the api you put all the method that are in the controller and after
you use
your models inside your controller. You can do the job with one API
class definition or you split in more for how many controllers you
have.
Or if you already have your controllers done, you just need to write
some API