Sha256: f1bff4f748527ca6d5215b5e38bbe809e9cf0d792bb33e7517c9715ea3dc5c44

Contents?: true

Size: 1.07 KB

Versions: 21

Compression:

Stored size: 1.07 KB

Contents

module Salesforce
  module Connection
    module Async
      extend ActiveSupport::Concern
      
      module ClassMethods
        def async_post(path, body, options = {})
          url = async_api_url(path)
          as_logged_in_user do
            convert_body(RestClient.post(url, body, async_headers(options)), options)
          end
        rescue RestClient::ResourceNotFound, RestClient::BadRequest => e
          convert_error(e, url, options)
        end

        def async_get(path, options = {})
          url = async_api_url(path)
          as_logged_in_user do
            convert_body RestClient.get(url, async_headers(options)), options
          end
        rescue RestClient::ResourceNotFound, RestClient::BadRequest => e
          convert_error(e, url, options)
        end
        
        def async_api_url(path)
          ::Salesforce::Config.async_url + "/" + path
        end
        
        def async_headers(options)
          { 'X-SFDC-Session' => Salesforce::Authentication.session_id }.merge(content_type_headers(options))
        end 

      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
activeforce-5.0.0 lib/salesforce/connection/async.rb
activeforce-1.10.5 lib/salesforce/connection/async.rb
activeforce-1.10.4 lib/salesforce/connection/async.rb
activeforce-4.0.0 lib/salesforce/connection/async.rb
activeforce-1.10.3 lib/salesforce/connection/async.rb
activeforce-3.1.0 lib/salesforce/connection/async.rb
activeforce-1.10.2 lib/salesforce/connection/async.rb
activeforce-3.0.0 lib/salesforce/connection/async.rb
activeforce-2.1.1 lib/salesforce/connection/async.rb
activeforce-1.10.1 lib/salesforce/connection/async.rb
activeforce-2.1.0 lib/salesforce/connection/async.rb
activeforce-1.10.0 lib/salesforce/connection/async.rb
activeforce-2.0.1 lib/salesforce/connection/async.rb
activeforce-2.0.0 lib/salesforce/connection/async.rb
activeforce-1.9.1 lib/salesforce/connection/async.rb
activeforce-1.9.0 lib/salesforce/connection/async.rb
activeforce-1.8.0 lib/salesforce/connection/async.rb
activeforce-1.7.1 lib/salesforce/connection/async.rb
activeforce-1.7.0 lib/salesforce/connection/async.rb
activeforce-1.6.0 lib/salesforce/connection/async.rb