active_force 0.21.1 → 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: 0a2d59fa533f638635afa0e8654fae4f77540310fba228ae697e05eaaf965525
4
- data.tar.gz: 0570306ac71f575994b07aace62ad9579d0103f812eceb59aaa83b1a6ddc1911
3
+ metadata.gz: c57b4dd00099e8df4236eeba3f7b917f0cef63f1cbe94a43a9f781633273d00e
4
+ data.tar.gz: ad72dce393fc4d40c869269eefe1c485cd5dcee7e556d9cf70c86036d775bcd9
5
5
  SHA512:
6
- metadata.gz: ceccbbfb84f6f80190d11ae8722ba8fbbe423cc4164b0567df2fd912f7e45150ddfb4092da3af528d431f03527676dd897e5565f6d5b18fdf70492d489667896
7
- data.tar.gz: 91962473ab612ca13f755f7b94b891d8c6f849677999ef0333a98924b9f6a001566cd602fc3ee3c9c8e1b6cdcef039fbfeb13e4f1a8f2e284877e5d771a84e3c
6
+ metadata.gz: 0dc1dca5294187220f3998b0216854f8b793dd9f43669607f446136d0a375991dbd708eaacc192b5002c119530f5e4d492dd7e9fef6993b8aa0ca8f63e89efb0
7
+ data.tar.gz: 92c5ca6b3b5d99a0e1eccdc1c1b961e8dacad3b2d133f467ed17b3fce55211172b7a1402127d653054f824f54f596ada534ff3d0fd144c7b22a8ca68183d510d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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)
7
+
8
+ ## 0.22.0
9
+ - Add `ids` method to ActiveQuery interface (https://github.com/Beyond-Finance/active_force/pull/94)
10
+ - Add missing standard type for ContentNote and fix the way the model generator handles the name input so it acts a bit more predictably. (https://github.com/Beyond-Finance/active_force/pull/95)
11
+
5
12
  ## 0.21.1
6
13
  - Fixes #91. Applies scopes to eager-loaded associations when they are nested. (https://github.com/Beyond-Finance/active_force/pull/92)
7
14
 
@@ -83,6 +83,10 @@ module ActiveForce
83
83
  super *selected_fields
84
84
  end
85
85
 
86
+ def ids
87
+ super.pluck(:id)
88
+ end
89
+
86
90
  def find!(id)
87
91
  result = find(id)
88
92
  raise RecordNotFound.new("Couldn't find #{table_name} with id #{id}", table_name, id: id) if result.nil?
@@ -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
  module StandardTypes
2
- STANDARD_TYPES = %w[
2
+ STANDARD_TYPES = %w[
3
3
  Account
4
4
  Asset
5
5
  AssetFeed
@@ -67,6 +67,7 @@ module StandardTypes
67
67
  ContentDocumentFeed
68
68
  ContentDocumentHistory
69
69
  ContentDocumentLink
70
+ ContentNote
70
71
  ContentVersion
71
72
  ContentVersionHistory
72
73
  ContentWorkspace
@@ -352,6 +353,6 @@ module StandardTypes
352
353
  WorkRewardHistory
353
354
  WorkRewardShare
354
355
  WorkThanks
355
- WorkThanksShare
356
+ WorkThanksShare
356
357
  ]
357
358
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveForce
4
- VERSION = '0.21.1'
4
+ VERSION = '0.22.1'
5
5
  end
@@ -16,7 +16,7 @@ module ActiveForce
16
16
  }
17
17
 
18
18
  def create_model_file
19
- @table_name = file_name.capitalize
19
+ @table_name = name
20
20
  @class_name = prepare_namespace + @table_name.gsub('__c', '')
21
21
  template "model.rb.erb", "app/models/#{@class_name.underscore}.rb" if table_exists?
22
22
  end
@@ -571,4 +571,18 @@ describe ActiveForce::ActiveQuery do
571
571
  expect(active_query.first.id).to eq("0000000000AAAAABBB")
572
572
  end
573
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
574
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.21.1
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-05-17 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