Module: CallRemote

Included in:
Salesforce::Rest::AsfRest
Defined in:
lib/Salesforce/rest/asf_rest_call_rest_svr.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

class methods



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/Salesforce/rest/asf_rest_call_rest_svr.rb', line 22

def self.included(base)
  class << base

    def call_rest_svr (verb, target, headers, data=nil)
      case verb
      when 'GET'
        return resp = HTTParty.get(target, :headers => headers)
      when 'POST'
        return resp = HTTParty.post(target, :body => data, :headers => headers)
      when 'DELETE'
        return resp = HTTParty.delete(target, :headers => headers)
      when 'PATCH'
        # TODO use Httpgeneric.
      when 'DEFINE'
        # TODO for creating a new SObject in Salesfore, e.g. rake
      when 'REMOVE'
        # TODO for deleting a new SObject in Salesfore, e.g. rake
      when 'MODIFY'
        # TODO for modifying a new SObject in Salesfore, e.g. rake
      end
    end
  end
end