Module: Salesforce::Connection::Async::ClassMethods

Defined in:
lib/salesforce/connection/async.rb

Instance Method Summary collapse

Instance Method Details

#async_api_url(path) ⇒ Object



25
26
27
# File 'lib/salesforce/connection/async.rb', line 25

def async_api_url(path)
  ::Salesforce::Config.async_url + "/" + path
end

#async_get(path, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/salesforce/connection/async.rb', line 16

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

#async_headers(options) ⇒ Object



29
30
31
# File 'lib/salesforce/connection/async.rb', line 29

def async_headers(options)
  { 'X-SFDC-Session' => Salesforce::Authentication.session_id }.merge(content_type_headers(options))
end

#async_post(path, body, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/salesforce/connection/async.rb', line 7

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