leap_salesforce 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/ChangeLog +4 -0
- data/lib/leap_salesforce/auth.rb +1 -0
- data/lib/leap_salesforce/ext/string.rb +13 -0
- data/lib/leap_salesforce/rake/sfdx.rake +1 -1
- data/lib/leap_salesforce/rake.rb +1 -0
- data/lib/leap_salesforce/soql_data/soql_data.rb +5 -1
- data/lib/leap_salesforce/soql_data/soql_global_object_data.rb +10 -2
- data/lib/leap_salesforce/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05c69a9a17c1add0dad1ef3ba178ef096818a8379dd6488f3bd96fdcd78a32c1
|
4
|
+
data.tar.gz: c05c1ad0beddeac93a2d5af4c880712c8b235a0e18d76e3db71a098bbc714dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23541a09f8e1495f33f776eecdbca0a94d92f1a4b0049ece899a6d32331ccfe014741b35f115c0e0d14e8f3b4354d5a40d1049c1acff3d63690da7c056762f01
|
7
|
+
data.tar.gz: 53a7cdbec9530f8400c6a7f9a20a8a12ce0738293640640cd64c9ba1560d3bf734ddab15b1d90652a5cd011baad3a2001f88fd557f61405c3b84ab424500ef97
|
data/.gitignore
CHANGED
data/ChangeLog
CHANGED
data/lib/leap_salesforce/auth.rb
CHANGED
@@ -64,6 +64,7 @@ module LeapSalesforce
|
|
64
64
|
else
|
65
65
|
'get_prod_auth'
|
66
66
|
end
|
67
|
+
puts "Using JWT folder '#{ENV['JWT_FOLDER']}'"
|
67
68
|
self.sfdx_display_output = `sh #{__dir__}/#{script_name}.sh`
|
68
69
|
self.access_token = from_output 'Access Token'
|
69
70
|
url_obtained = from_output 'Instance Url'
|
@@ -5,6 +5,7 @@ require 'rubykeyword'
|
|
5
5
|
require 'humanize'
|
6
6
|
require 'active_support/core_ext/string'
|
7
7
|
require 'date'
|
8
|
+
require 'json'
|
8
9
|
|
9
10
|
# Override string object to provide convenience methods for Strings
|
10
11
|
class String
|
@@ -91,4 +92,16 @@ class String
|
|
91
92
|
else
|
92
93
|
true
|
93
94
|
end
|
95
|
+
|
96
|
+
# Convert Ruby String representation of Array to SoqlArray
|
97
|
+
# @return [String] String representation for use in Soql IN query
|
98
|
+
def to_soql_array
|
99
|
+
arr = JSON.parse(self)
|
100
|
+
unless arr.is_a? Array
|
101
|
+
raise ArgumentError, "Cannot convert #{self} into Array" \
|
102
|
+
"Called at #{caller_locations[0]}"
|
103
|
+
end
|
104
|
+
joined = arr.join("', '")
|
105
|
+
"('#{joined}')"
|
106
|
+
end
|
94
107
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
namespace :sfdx do
|
5
5
|
desc 'Login with credentials'
|
6
6
|
task :login do
|
7
|
-
puts `sfdx force:auth:jwt:grant --clientid $SF_CONSUMER_KEY --jwtkeyfile
|
7
|
+
puts `sfdx force:auth:jwt:grant --clientid $SF_CONSUMER_KEY --jwtkeyfile "$JWT_FOLDER"/server.key --username $SF_USERNAME --setdefaultdevhubusername --setalias HubOrg`
|
8
8
|
end
|
9
9
|
|
10
10
|
task :display do
|
data/lib/leap_salesforce/rake.rb
CHANGED
@@ -127,7 +127,11 @@ class SoqlData < Exchange
|
|
127
127
|
# @param [Boolean] must_pass Whether to raise exception if call is not successful
|
128
128
|
# @return [Exchange] Exchange object making delete
|
129
129
|
def delete_as_admin(must_pass: true)
|
130
|
-
LeapSalesforce.
|
130
|
+
LeapSalesforce.api_user = LeapSalesforce::Users.where key: :admin
|
131
|
+
rescue LeapSalesforce::UserError
|
132
|
+
raise LeapSalesforce::SetupError, 'Please set up a user with a key of :admin' \
|
133
|
+
'to use "delete_as_admin"'
|
134
|
+
else
|
131
135
|
delete must_pass: must_pass
|
132
136
|
end
|
133
137
|
|
@@ -259,7 +259,7 @@ module SoqlGlobalObjectData
|
|
259
259
|
def condition_for(value)
|
260
260
|
value = value.to_s
|
261
261
|
operator, value = case value[0]
|
262
|
-
when '>', '<' then extract_comparator(value)
|
262
|
+
when '>', '<', '!', 'I' then extract_comparator(value)
|
263
263
|
when '~' then ['LIKE', value[1..-1]]
|
264
264
|
else
|
265
265
|
return "= '#{value}'" unless value.type_of_time?
|
@@ -268,14 +268,22 @@ module SoqlGlobalObjectData
|
|
268
268
|
end
|
269
269
|
return "#{operator} #{value.to_zulu_date_string}" if value.type_of_time?
|
270
270
|
|
271
|
+
return "#{operator} #{value}" if operator.end_with? 'IN'
|
272
|
+
|
271
273
|
"#{operator} '#{value}'"
|
272
274
|
end
|
273
275
|
|
274
276
|
# @param [String] value Value to extract comparator for
|
275
|
-
# @return [Array] Extract of >, >, >= from string and rest of string
|
277
|
+
# @return [Array] Extract of operator, value, taking >, >, >= from string and rest of string
|
276
278
|
def extract_comparator(value)
|
277
279
|
if value[1] == '='
|
278
280
|
[value[0..1], value[2..-1]]
|
281
|
+
elsif value[0..2] == '!IN'
|
282
|
+
['NOT IN', value[3..-1].to_soql_array]
|
283
|
+
elsif value[0..1] == 'IN'
|
284
|
+
['IN', value[2..-1].to_soql_array]
|
285
|
+
elsif value[0] == '!'
|
286
|
+
['!=', value[1..-1]]
|
279
287
|
else
|
280
288
|
[value[0], value[1..-1]]
|
281
289
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leap_salesforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IQA
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-09-
|
12
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|