active_force 0.22.0 → 0.22.1

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: c581e80e87411581ea34984582fae46fb088791e5d35a2227b31c983d4331b5f
4
- data.tar.gz: 66b5a50080eafd5d2aecfdd0cd5262b0a1142c96f9cf324840242816f7dd9c71
3
+ metadata.gz: c57b4dd00099e8df4236eeba3f7b917f0cef63f1cbe94a43a9f781633273d00e
4
+ data.tar.gz: ad72dce393fc4d40c869269eefe1c485cd5dcee7e556d9cf70c86036d775bcd9
5
5
  SHA512:
6
- metadata.gz: 55c1344f425f080433b1f00e2c2227c15b1990b20395406ef8d9fb2c8aa2817d2b0f4aac2d173380f93b7e646cc6f30436946915f4b706d237373816b6b0e412
7
- data.tar.gz: 1ec278a796ecdb97c4b8629f671331e49fd21301e06bc6a3b29207ca77498d1e3b2ac8c2cd65ad458f7e250955fe3ace931840a20e7d60738622266a74dd1fe6
6
+ metadata.gz: 0dc1dca5294187220f3998b0216854f8b793dd9f43669607f446136d0a375991dbd708eaacc192b5002c119530f5e4d492dd7e9fef6993b8aa0ca8f63e89efb0
7
+ data.tar.gz: 92c5ca6b3b5d99a0e1eccdc1c1b961e8dacad3b2d133f467ed17b3fce55211172b7a1402127d653054f824f54f596ada534ff3d0fd144c7b22a8ca68183d510d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Not released
4
4
 
5
+ ## 0.22.1
6
+ - Fixes #94. Moved query logic and corrected ActiveQuery `ids` method (https://github.com/Beyond-Finance/active_force/pull/97)
5
7
 
6
8
  ## 0.22.0
7
9
  - Add `ids` method to ActiveQuery interface (https://github.com/Beyond-Finance/active_force/pull/94)
@@ -84,7 +84,7 @@ module ActiveForce
84
84
  end
85
85
 
86
86
  def ids
87
- clone_and_set_instance_variables(query_fields: ["Id"])
87
+ super.pluck(:id)
88
88
  end
89
89
 
90
90
  def find!(id)
@@ -107,6 +107,10 @@ module ActiveForce
107
107
  clone_and_set_instance_variables(query_fields: ["sum(#{field})"])
108
108
  end
109
109
 
110
+ def ids
111
+ clone_and_set_instance_variables(query_fields: ["Id"])
112
+ end
113
+
110
114
  protected
111
115
  def and_conditions
112
116
  "(#{@conditions.join(') AND (')})" unless @conditions.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveForce
4
- VERSION = '0.22.0'
4
+ VERSION = '0.22.1'
5
5
  end
@@ -117,12 +117,6 @@ describe ActiveForce::ActiveQuery do
117
117
  end
118
118
  end
119
119
 
120
- describe '#ids' do
121
- it 'returns a query that selects only the Id field' do
122
- expect(active_query.where(field: 123).ids.to_s).to eq "SELECT Id FROM table_name WHERE (Field__c = 123)"
123
- end
124
- end
125
-
126
120
  describe "condition mapping" do
127
121
  it "maps conditions for a .where" do
128
122
  new_query = active_query.where(field: 123)
@@ -577,4 +571,18 @@ describe ActiveForce::ActiveQuery do
577
571
  expect(active_query.first.id).to eq("0000000000AAAAABBB")
578
572
  end
579
573
  end
574
+
575
+ describe "#ids" do
576
+ before do
577
+ allow(client).to receive(:query).and_return(api_result)
578
+ api_result.each do |instance|
579
+ allow(active_query).to receive(:build).with(instance, {}).and_return(build_restforce_sobject(id: instance['Id']))
580
+ end
581
+ end
582
+
583
+ it "should return an array of id strings" do
584
+ expect(active_query.ids).to be_a Array
585
+ expect(active_query.ids).to eq api_result.map { |r| r['Id'] }
586
+ end
587
+ end
580
588
  end
@@ -236,4 +236,14 @@ describe ActiveForce::Query do
236
236
  expect(query.where("name = 'cool'").sum(:field1).to_s).to eq "SELECT sum(field1) FROM table_name WHERE (name = 'cool')"
237
237
  end
238
238
  end
239
+
240
+ describe ".ids" do
241
+ it "should return the query for selecting Id" do
242
+ expect(query.ids.to_s).to eq 'SELECT Id FROM table_name'
243
+ end
244
+
245
+ it "should work with a condition" do
246
+ expect(query.where("name = 'cool'").ids.to_s).to eq "SELECT Id FROM table_name WHERE (name = 'cool')"
247
+ end
248
+ end
239
249
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-07-09 00:00:00.000000000 Z
14
+ date: 2024-07-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activemodel