sf_connect 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bbd8b629514161ddfce2d6e3b7339dec55eec9f83239fa35900e455afcf8c74
4
- data.tar.gz: 34254fdbe07ce3b7a5d57ae7147f6237293880900470ee06f78188c7ecaeb5a8
3
+ metadata.gz: f8db480f58bf437229d4a2514b8c145c870bcff9931be3948c268ececf5ce90e
4
+ data.tar.gz: cd5cedda64562b26e30887bdf8e622c66268c2c04d5a6510fa520a8c1e7f3bd6
5
5
  SHA512:
6
- metadata.gz: 91e4bc66a5470b3b0cd4fc46652f7b7d0d7f862cf74d411541de0b20b261599641472e2a37e48a26cf1c2750cbaf959506b466946a065b998dcf5ce712f677e1
7
- data.tar.gz: 760587c3c70be8694c11e90470efef931c9730d9d2cbbe361f3455a0a640797536ab463ee78a91da9f0ca2ec8e2d4bb6452c02cef09347c9af0c99bbacf503cf
6
+ metadata.gz: c9bd2c79639efc91ecb6baea6d2d071e37daaac742804ddb78bacde7cec940e144766db5e71f1cd2d6e6fc98f82dab45269483fc132b5302c7fd00f8567fefa2
7
+ data.tar.gz: 6facb02db12ddd4056d2199ad7100a3e6f007227ac5dd861357953442fa92b28d354dcf029e23485ac55aa005a0efd3043cbff9a6e1da9035ea3572858c24ea2
@@ -35,9 +35,13 @@ module SfConnect
35
35
  record
36
36
  end
37
37
 
38
+ def import_records_for_salesforce(records)
39
+ upsert_all records
40
+ end
41
+
38
42
  def download_salesforce_records(batch_size = 1000)
39
43
  fetch_all.each_slice(batch_size) do |records|
40
- upsert_all records.map(&:for_download)
44
+ import_records_for_salesforce records.map(&:for_download)
41
45
  end
42
46
  end
43
47
  end
@@ -1,3 +1,3 @@
1
1
  module SfConnect
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
data/lib/sf_connect.rb CHANGED
@@ -17,24 +17,32 @@ module SfConnect
17
17
  SfConnect::Define.new(salesforce_object_name, where:, fields:, &).call
18
18
  end
19
19
 
20
+ def connect
21
+ yield Restforce.new
22
+ end
23
+
20
24
  def query(soql)
21
- Restforce.new.query(soql)
25
+ connect { |restforce| restforce.query(soql) }
22
26
  end
23
27
 
24
28
  def find(salesforce_object_name, id, field)
25
- Restforce.new.find(salesforce_object_name, id, field)
29
+ connect { |restforce| restforce.find(salesforce_object_name, id, field) }
26
30
  end
27
31
 
28
32
  def create!(salesforce_object_name, payload)
29
- Restforce.new.create!(
30
- salesforce_object_name, payload
31
- )
33
+ connect do |restforce|
34
+ restforce.create!(
35
+ salesforce_object_name, payload
36
+ )
37
+ end
32
38
  end
33
39
 
34
40
  def update!(salesforce_object_name, id, payload)
35
- Restforce.new.update!(
36
- salesforce_object_name, { Id: id, **payload }
37
- )
41
+ connect do |restforce|
42
+ restforce.update!(
43
+ salesforce_object_name, { Id: id, **payload }
44
+ )
45
+ end
38
46
  end
39
47
  end
40
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sf_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masa (Aileron inc)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-27 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: restforce