Up Readme Releases Todo

tla-sbuilder-salesforce - Salesforce API interface loader (for tla-sbuilder) - $Release:0.0.4$

API loader plugin for Sbuilder to load Salasforce API interfaces in a Sbuilder specification model.

Usage

Create Gemfile

Create Gemfile with the following content

source "https://rubygems.org"
gem 'tla-sbuilder-salesforce'

and run

bundle install

Include Plugin to Sbuilder

To include the plugin into Sbuilder add an entry to extend.loaders array in sbuilder.yaml -configuration file as shown below:

extend:
      loaders:
          - gem: tla-sbuilder-salesforce
            className: Sbuilder::Interfaces::Salesforce::SalesforceLoader
            configuration:
                  client_id: xxxxxxxxxxxxxxx
                  client_secret: xxxxxxxxxx
                  username: xxxxxxxe
                  password: 'xxxxxxxx'
                  security_token:  'xxxxxxxxxx'

In the entry, modify following properties to match your environment:

  • cliend_id: salesforce client_id to use in connection
  • client_secret : salesforce client_secret to use in connection
  • username: username to login to salesforce
  • password: password to login to salesforce
  • security_token: additional security_token needed in salesforce login

Additional confiuration properties supported:

  • api_version: api version to use (default 34.0)

Configure API Loader Instanace

Add an array entry interfaces section in sbuilder.yaml -configuration file referring to an interface configuration file for the plugin:

interfaces:

    - className: Sbuilder::Interfaces::Salesforce::SalesforceLoader
      infrastructureServices: true
      file: salesforce-api.yaml
      cache: sf

In the configuration above:

  • className: Sbuilder::Interfaces::Salesforce::SalesforceLoader matches className property in extend.loaders section

  • infrastructureServices: value true when embedding Salesforce services as part of composite service, value false, when Salesforce services be called directly in the generated specification model

  • file: name of configuration file in cnf -directory defining Salesforce API (see below)

  • cache: optional cache file name prefix for the API loader to cache Salesforce API descriptions

Define Salaseforce API

Saleforce API Loader plugin uses a configuration file to define API operation on Salesforce sObjects. The configuration file is an array of entries with the following properties:

  • sObject: Salesforce sObject for the API operation
  • path: REST entrypoint for the interface
  • action: REST action (put, get, post, ..)
  • request: type name (sObject) of request attribute
  • reply: type name (sObject) of reply attribute

For example, to access Salasesforce sObjects Lead and Account use configuration:

  - sObject: Account
    path: /sf/account
    action: get
    request: Account
    reply: Account

  - sObject: Lead
    path: /sf/lead
    action: post
    request: Account
    reply: Account

License

MIT