leap_salesforce 0.2.7 → 0.2.8

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: bb7154cf99cf12053647574f3638760270b3d0e18cfdcb2f5680561765c49aa9
4
- data.tar.gz: 66016e3b7e5999e8df24bdef7031bf3b40e9f0662aa6e2fcd76bdbd176390ee4
3
+ metadata.gz: 0727f9b6fbfb3b1c1b20b77a96eae10a2769574e7aeefd9af1282bffa2c9ce1d
4
+ data.tar.gz: 6ebb6a6246a65acec84880ac0b0c06f5757f0cad273bcff6e03c974973e2b41b
5
5
  SHA512:
6
- metadata.gz: c9a1048067ba6873d69ce44313e88573be5be000c544ff0d00f036f35dcae4d0e92d2884be69f5486c8da3e09ed8f4ca42670cbab1dfae33a16a351120bf6285
7
- data.tar.gz: 930e8204a42e3285f2eec5ffdacb94596658e4a4983862b538463c79a8faa00d29c04a3c77f35703f51f000962a3d8010a8cecc7d8f1fb2fd9b975c8343dc841
6
+ metadata.gz: 15c74d38ab17892e205e0682ecdc677357a7810b384b60ed8b09b182de08abfca49320ba092af86e3f74a48293c158faf5544d24fc496b4f05831426e4c2e492
7
+ data.tar.gz: 4bf6d4319d775a085f1083128b36adbfe02d824238fa830c4f08a3f932c7077a0476235917d86e0aada28fbec9dc9986f1d400a918a39af6acd6ef809f22919b
@@ -4,7 +4,9 @@
4
4
  <shared />
5
5
  </component>
6
6
  <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$" />
7
+ <content url="file://$MODULE_DIR$">
8
+ <excludeFolder url="file://$MODULE_DIR$/doc" />
9
+ </content>
8
10
  <orderEntry type="jdk" jdkName="RVM: ruby-2.6.0" jdkType="RUBY_SDK" />
9
11
  <orderEntry type="sourceFolder" forTests="false" />
10
12
  <orderEntry type="library" scope="PROVIDED" name="activemodel (v6.0.0, RVM: ruby-2.6.0) [gem]" level="application" />
@@ -21,7 +23,7 @@
21
23
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.0) [gem]" level="application" />
22
24
  <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.6.0) [gem]" level="application" />
23
25
  <orderEntry type="library" scope="PROVIDED" name="factory_bot (v5.1.0, RVM: ruby-2.6.0) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="faker (v2.4.0, RVM: ruby-2.6.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="faker (v2.5.0, RVM: ruby-2.6.0) [gem]" level="application" />
25
27
  <orderEntry type="library" scope="PROVIDED" name="gyoku (v1.3.1, RVM: ruby-2.6.0) [gem]" level="application" />
26
28
  <orderEntry type="library" scope="PROVIDED" name="hashie (v3.6.0, RVM: ruby-2.6.0) [gem]" level="application" />
27
29
  <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.6.0) [gem]" level="application" />
@@ -60,7 +62,7 @@
60
62
  <orderEntry type="library" scope="PROVIDED" name="rspec-its (v1.3.0, RVM: ruby-2.6.0) [gem]" level="application" />
61
63
  <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
62
64
  <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
63
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.74.0, RVM: ruby-2.6.0) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.75.0, RVM: ruby-2.6.0) [gem]" level="application" />
64
66
  <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.0, RVM: ruby-2.6.0) [gem]" level="application" />
65
67
  <orderEntry type="library" scope="PROVIDED" name="rubykeyword (v0.0.4, RVM: ruby-2.6.0) [gem]" level="application" />
66
68
  <orderEntry type="library" scope="PROVIDED" name="savon (v2.12.0, RVM: ruby-2.6.0) [gem]" level="application" />
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.2.8
2
+ * Bug fix
3
+ * Could not handle double and boolean values in SOQL query
4
+
1
5
  Version 0.2.7
2
6
  * Bug Fix
3
7
  * New way of handling [] method broke error message's ability to diagnose
@@ -61,7 +61,7 @@ module SoqlGlobalObjectData
61
61
  lookup.each do |key, value|
62
62
  conditional_term = conditional.empty? ? 'WHERE' : 'AND'
63
63
  key_used = map_key key
64
- conditional += "#{conditional_term} #{key_used} #{condition_for(value)} "
64
+ conditional += "#{conditional_term} #{key_used} #{condition_for(key_used, value)} "
65
65
  end
66
66
  query = conditional + "ORDER BY #{@default_filter} DESC NULLS FIRST"
67
67
  query += " LIMIT #{limit}" if limit
@@ -238,24 +238,30 @@ module SoqlGlobalObjectData
238
238
  # Returns SOQL condition for value passed to be used in SOQL query
239
239
  # @example Greater than or equal to yesterday's date
240
240
  # condition_for("<=#{Time.mktime(2019,1,1)}") # => '<= 2019-01-01T00:00:00.000Z'
241
+ # @param [String] field_name Backend field name
241
242
  # @param [String, Object] value Value to search for. Certain characters modify this to be more of a complex
242
243
  # check. Object will be converted String if not already one
243
244
  # @return [String] Condition criteria to match value using SOQL
244
- def condition_for(value)
245
- value = value.to_s
245
+ def condition_for(field_name, value)
246
+ value = value.nil? ? 'null' : value.to_s
246
247
  operator, value = case value[0]
247
248
  when '>', '<', '!', 'I' then extract_comparator(value)
248
249
  when '~' then ['LIKE', value[1..-1]]
249
- else
250
- return "= '#{value}'" unless value.type_of_time?
251
-
252
- return "= #{value.to_zulu_date_string}"
250
+ else ['=', value]
253
251
  end
254
- return "#{operator} #{value.to_zulu_date_string}" if value.type_of_time?
255
-
256
- return "#{operator} #{value}" if operator.end_with? 'IN'
252
+ case type_for(field_name)
253
+ when 'boolean', 'double', 'int' then "#{operator} #{value}"
254
+ when 'date', 'datetime', 'time'
255
+ unless value.type_of_time?
256
+ raise LeapSalesforce::RequestError,
257
+ "Value '#{value}' cannot be interpreted as date for #{field_name}"
258
+ end
259
+ "#{operator} #{value.to_zulu_date_string}"
260
+ else # string, picklist, reference, id, textarea
261
+ return "#{operator} #{value}" if operator.end_with?('IN') || value == 'null'
257
262
 
258
- "#{operator} '#{value}'"
263
+ "#{operator} '#{value}'"
264
+ end
259
265
  end
260
266
 
261
267
  # @param [String] value Value to extract comparator for
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LeapSalesforce
4
4
  # @return [String] Version of leap salesforce
5
- VERSION = '0.2.7'
5
+ VERSION = '0.2.8'
6
6
  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.7
4
+ version: 0.2.8
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-26 00:00:00.000000000 Z
12
+ date: 2019-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler