active_force 0.22.0 → 0.22.1
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 +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/active_force/active_query.rb +1 -1
- data/lib/active_force/query.rb +4 -0
- data/lib/active_force/version.rb +1 -1
- data/spec/active_force/active_query_spec.rb +14 -6
- data/spec/active_force/query_spec.rb +10 -0
- 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: c57b4dd00099e8df4236eeba3f7b917f0cef63f1cbe94a43a9f781633273d00e
|
4
|
+
data.tar.gz: ad72dce393fc4d40c869269eefe1c485cd5dcee7e556d9cf70c86036d775bcd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/active_force/query.rb
CHANGED
@@ -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?
|
data/lib/active_force/version.rb
CHANGED
@@ -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.
|
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-
|
14
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activemodel
|