rails-salesforce-connect 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe16853c79db4c2f6889b3780d8e8b02b035260a470380c344c7cb9bbd3f3ce0
4
- data.tar.gz: 8c31403f91485bb6d8b3a50e3d6cc1e9142c35fb4eb5088382fe2c424348f205
3
+ metadata.gz: ff9ea02ac79206e82e01714db016175463a899687cd6dea66e797c47a70dec89
4
+ data.tar.gz: 6ebd5939a8d67f46d9b67c4fce892c8e729475debd5e477245ca87e2013fe5a9
5
5
  SHA512:
6
- metadata.gz: 6e3a373ea57b58a8f3ec5c54b767332b264be5afa3384845274c7b98267a04dba43abbc91edcc5bea38f189e3c023ddfacd09a1b87b2511dbc90723d789cbd38
7
- data.tar.gz: 7c0a80e45c275b8e90e79e9a1a255cd1994a3264d13a1a011a875d2521a3901f71516ba51f8b61b3de1ae12453647ef438263f2659be24af7823ef75c3714472
6
+ metadata.gz: d8978198bb2cddc77e48da49bafcfc3914c0802bab8039ac76797d5e0d94d543441da54185f28bbcb9106dc7cf6de8421cff9245c537938420aa5d5d1cbe9fc1
7
+ data.tar.gz: 84678f94af6a3cfdad8ccfdaaa8de86603e7b13bd88670b185b4b1471d579cfd1cd29e0a253c6fec94e62e1eea63248e86ea45e87600746b95f1bb1d1272189e
@@ -20,6 +20,18 @@ module Connect
20
20
  security_token: env.fetch("SALESFORCE_REST_API_SECURITY_TOKEN", ""),
21
21
  )
22
22
  end
23
+
24
+ def tooling(env=ENV)
25
+ @tooling ||= Restforce::Tooling::Client.new(
26
+ api_version: env.fetch('API_VERSION', "41.0"),
27
+ host: env.fetch("SALESFORCE_REST_API_HOST"),
28
+ client_id: env.fetch("SALESFORCE_REST_API_CLIENT_ID"),
29
+ client_secret: env.fetch("SALESFORCE_REST_API_CLIENT_SECRET"),
30
+ username: env.fetch("SALESFORCE_REST_API_USERNAME"),
31
+ password: env.fetch("SALESFORCE_REST_API_PASSWORD"),
32
+ security_token: env.fetch("SALESFORCE_REST_API_SECURITY_TOKEN", ""),
33
+ )
34
+ end
23
35
  end
24
36
  end
25
37
  end
@@ -27,11 +27,38 @@ namespace :salesforce do
27
27
  description[k] = v.first
28
28
  description[k].delete("name")
29
29
  end
30
+
31
+ q = <<-SQL
32
+ Select
33
+ Id,
34
+ ValidationName,
35
+ Description,
36
+ EntityDefinition.DeveloperName,
37
+ ErrorDisplayField,
38
+ ErrorMessage
39
+ From
40
+ ValidationRule
41
+ where
42
+ Active = true
43
+ order by
44
+ Id
45
+ SQL
46
+ validations = Connect::ApiAdapter.tooling(env).query(q)
47
+ formatted_validations = {}
48
+ validations.each {|v| formatted_validations[v.dig('Id')] = {
49
+ description: v['Description'],
50
+ column: v.dig("EntityDefinition", 'DeveloperName'),
51
+ show_on: v['ErrorDisplayField'],
52
+ message: v['ErrorMessage'],
53
+ name: v['ValidationName'],
54
+ }}
55
+
30
56
  File.write(
31
57
  outfile,
32
- JSON.pretty_generate(description)
58
+ JSON.pretty_generate({schema: description, validations: formatted_validations})
33
59
  )
34
60
  end
61
+ # Select Id,Active,Description,ErrorDisplayField, ErrorMessage From ValidationRule Where EntityDefinition.QualifiedApiName = 'SVMXC__Parts_Request__c'
35
62
 
36
63
  desc "Diff two schema files against one another"
37
64
  task :diff, [:old, :new] do |_t, args|
@@ -1,7 +1,7 @@
1
1
  # gem 'activerecord'
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'rails-salesforce-connect'
4
- s.version = '0.0.10'
4
+ s.version = '0.0.11'
5
5
  s.licenses = ['MIT']
6
6
  s.summary = "Tools for using heroku connect with rails"
7
7
  s.description = "Base class for salesforce migrations, activerecord types; deduplication rules aware, and rake tasks to sync schema"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-salesforce-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Heath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-05 00:00:00.000000000 Z
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord