Raas::Client::Rails

Adding client to access Raas. This client allows you to call Raas API.

Usage

Set your Credentials

landscape, application, token are mandatory to interact with RaaS. Basically, these variables can be assigned externally with files or hard-code. Following is the example of how you set these variables on your code. These credentials would be provided by SuTech. Please, ask SuTech adminisators for further information.

 Raas::Client::Rails::Engine.config.raas_client_rails.landscape   = 'LANDSCAPE'
 Raas::Client::Rails::Engine.config.raas_client_rails.application = 'APP'
 Raas::Client::Rails::Engine.config.raas_client_rails.token = 'TOKEN VALUE'

This condifuration is mandatory please, do not forget before you start interacting with APIs below.

APIs

Once you install gem and set it up, your application has several extra endpoints to interact with RaaS.

  • /raas/report/session : Generate external session by using your credentials for report
  • /raas/datatraveler/session : Generate external session by using your credentials for datatraveler

Both session APIs accept an optional scope parameter (space-delimited, e.g. csv_admin.invoice pdf.invoice) for scope-based route restriction. You can also fix it on the server side by setting @scope in your prepare_tenant_and_sub override (see below). If omitted, nothing is sent and the behavior is unchanged.

Installation

The client is provided as RubyGem, and this provided as Rails Engine. you should follow the steps below to make the API work

  1. Update your gem file
gem "raas-client-rails"
  1. install gem
$ bundle install
  1. implement raas_controller.rb
class RaasController < Raas::Client::Rails::RaasController
    skip_before_action :verify_authenticity_token

    def prepare_tenant_and_sub
        super

        @tenant = "xxxxx"
        @sub = "xxxx"
        # Optional: scopes granted to the current user (space-delimited).
        # Used for scope-based route restriction on RaaS side.
        # @scope = "csv_admin.invoice pdf.invoice"
      end
end
  1. add endPoint on config/routes.rb
  post '/raas/datatraveler/session', to: 'raas#datatraveler_session'
  post '/raas/report/session', to: 'raas#report_session'
  1. Launch your rails server

  2. then you can use this with...

/raas/datatraveler/session /raas/report/session

License

All the patents belong to SuTech