Module: SfConnect

Extended by:
ActiveSupport::Autoload
Defined in:
lib/sf_connect.rb,
lib/sf_connect/define.rb,
lib/sf_connect/fields.rb,
lib/sf_connect/payload.rb,
lib/sf_connect/version.rb,
lib/sf_connect/uploader.rb,
lib/sf_connect/downloader.rb

Overview

salesforce connective object

Defined Under Namespace

Modules: Downloader, Uploader Classes: Define, Fields, Payload

Constant Summary collapse

VERSION =
"0.2.4".freeze

Class Method Summary collapse

Class Method Details

.connect {|Restforce.new| ... } ⇒ Object

Yields:

  • (Restforce.new)


20
21
22
# File 'lib/sf_connect.rb', line 20

def connect
  yield Restforce.new
end

.create!(salesforce_object_name, payload) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/sf_connect.rb', line 32

def create!(salesforce_object_name, payload)
  connect do |restforce|
    restforce.create!(
      salesforce_object_name, payload
    )
  end
end

.define(salesforce_object_name, where: nil, **fields) ⇒ Object



16
17
18
# File 'lib/sf_connect.rb', line 16

def define(salesforce_object_name, where: nil, **fields, &)
  SfConnect::Define.new(salesforce_object_name, where:, fields:, &).call
end

.find(salesforce_object_name, id, field) ⇒ Object



28
29
30
# File 'lib/sf_connect.rb', line 28

def find(salesforce_object_name, id, field)
  connect { |restforce| restforce.find(salesforce_object_name, id, field) }
end

.query(soql) ⇒ Object



24
25
26
# File 'lib/sf_connect.rb', line 24

def query(soql)
  connect { |restforce| restforce.query(soql) }
end

.update!(salesforce_object_name, id, payload) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/sf_connect.rb', line 40

def update!(salesforce_object_name, id, payload)
  connect do |restforce|
    restforce.update!(
      salesforce_object_name, { Id: id, **payload }
    )
  end
end