restforce 5.2.3 → 5.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a41bb3b7f6f9c7fc06a71266e685e82afae4d6e291553159a6909ed29485553
4
- data.tar.gz: b7e01b436eafbd7be80dc4210fce034ff8ae08b4920241c84999b252d34501d2
3
+ metadata.gz: dfdaff5160d8845afd9c6ed3c384c7edf7d9ecb2593d562bae4d9a4812904137
4
+ data.tar.gz: 8510146b906c8f7f0869a467db96d9bd3416446338a9d237d8c2e633c911cc35
5
5
  SHA512:
6
- metadata.gz: b465fc051f6199309d6bf7c18328b6765a8c08fb24daf28e978bd478602a2b6988dbd3578c3cc6562d2b5066666fdb9ddb64b4bd9a73fe9297d5dc3a073388ca
7
- data.tar.gz: b1cc8939cb52563e39959bf2df3b27d91f64dba0fc7b5afd1d80fea47a4cdc55b5c921a9eaeef39ba97923037cd9ef0a873e3eed96dca0e50581f73d6ab66f06
6
+ metadata.gz: 592471696b0c585cb73bc26cca75267cfc7a2f3543f86449edd4e3ffc5401975cd4ded7cc7a20b63b5854434c06e6e63c48e0f49bf51839b8b8bee15e02113e8
7
+ data.tar.gz: 71c9272a0799c6e899bbdd56a0380b6ae5b7112d11e56fb3860a10ca0ba0b1dfb9cf58bb25b0bf59ad8f8b38f50360f5f8ccbed4090afa194a67a19a7ae28318
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 5.2.4 (Mar 16, 2022)
2
+
3
+ * Fix `Restforce::Collection#size` for Salesforce APIs that use the `size` property to return the total number of results, instead of `totalSize` (@kwong-yw)
4
+
1
5
  # 5.2.3 (Jan 17, 2022)
2
6
 
3
7
  * Add official support for Ruby 3.1 (@timrogers)
data/Gemfile CHANGED
@@ -8,10 +8,10 @@ gem 'guard-rspec'
8
8
  gem 'guard-rubocop'
9
9
  gem 'jruby-openssl', platforms: :jruby
10
10
  gem 'rake'
11
- gem 'rspec', '~> 3.10.0'
11
+ gem 'rspec', '~> 3.11.0'
12
12
  gem 'rspec-collection_matchers', '~> 1.2.0'
13
13
  gem 'rspec-its', '~> 1.3.0'
14
14
  gem 'rspec_junit_formatter', '~> 0.5.1'
15
- gem 'rubocop', '~> 1.24.1'
15
+ gem 'rubocop', '~> 1.26.0'
16
16
  gem 'simplecov', '~> 0.21.2'
17
17
  gem 'webmock', '~> 3.14.0'
data/README.md CHANGED
@@ -27,7 +27,7 @@ Features include:
27
27
 
28
28
  Add this line to your application's Gemfile:
29
29
 
30
- gem 'restforce', '~> 5.2.3'
30
+ gem 'restforce', '~> 5.2.4'
31
31
 
32
32
  And then execute:
33
33
 
@@ -30,8 +30,12 @@ module Restforce
30
30
  # Return the number of items in the Collection without making any additional
31
31
  # requests and going through all of the pages of results, one by one. Instead,
32
32
  # we can rely on the total count of results which Salesforce returns.
33
+ #
34
+ # Most of the Salesforce API returns this in the `totalSize` attribute. For
35
+ # some reason, the [List View Results](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviewresults.htm)
36
+ # endpoint (and maybe others?!) uses the `size` attribute.
33
37
  def size
34
- @raw_page['totalSize']
38
+ @raw_page['totalSize'] || @raw_page['size']
35
39
  end
36
40
  alias length size
37
41
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restforce
4
- VERSION = '5.2.3'
4
+ VERSION = '5.2.4'
5
5
  end
@@ -0,0 +1,151 @@
1
+ {
2
+ "columns" : [ {
3
+ "ascendingLabel" : "Z-A",
4
+ "descendingLabel" : "A-Z",
5
+ "fieldNameOrPath" : "Name",
6
+ "hidden" : false,
7
+ "label" : "Account Name",
8
+ "selectListItem" : "Name",
9
+ "sortDirection" : "ascending",
10
+ "sortIndex" : 0,
11
+ "sortable" : true,
12
+ "type" : "string"
13
+ }, {
14
+ "ascendingLabel" : "Z-A",
15
+ "descendingLabel" : "A-Z",
16
+ "fieldNameOrPath" : "Site",
17
+ "hidden" : false,
18
+ "label" : "Account Site",
19
+ "selectListItem" : "Site",
20
+ "sortDirection" : null,
21
+ "sortIndex" : null,
22
+ "sortable" : true,
23
+ "type" : "string"
24
+ }, {
25
+ "ascendingLabel" : "Z-A",
26
+ "descendingLabel" : "A-Z",
27
+ "fieldNameOrPath" : "BillingState",
28
+ "hidden" : false,
29
+ "label" : "Billing State/Province",
30
+ "selectListItem" : "BillingState",
31
+ "sortDirection" : null,
32
+ "sortIndex" : null,
33
+ "sortable" : true,
34
+ "type" : "string"
35
+ }, {
36
+ "ascendingLabel" : "9-0",
37
+ "descendingLabel" : "0-9",
38
+ "fieldNameOrPath" : "Phone",
39
+ "hidden" : false,
40
+ "label" : "Phone",
41
+ "selectListItem" : "Phone",
42
+ "sortDirection" : null,
43
+ "sortIndex" : null,
44
+ "sortable" : true,
45
+ "type" : "phone"
46
+ }, {
47
+ "ascendingLabel" : "Low to High",
48
+ "descendingLabel" : "High to Low",
49
+ "fieldNameOrPath" : "Type",
50
+ "hidden" : false,
51
+ "label" : "Type",
52
+ "selectListItem" : "toLabel(Type)",
53
+ "sortDirection" : null,
54
+ "sortIndex" : null,
55
+ "sortable" : true,
56
+ "type" : "picklist"
57
+ }, {
58
+ "ascendingLabel" : "Z-A",
59
+ "descendingLabel" : "A-Z",
60
+ "fieldNameOrPath" : "Owner.Alias",
61
+ "hidden" : false,
62
+ "label" : "Account Owner Alias",
63
+ "selectListItem" : "Owner.Alias",
64
+ "sortDirection" : null,
65
+ "sortIndex" : null,
66
+ "sortable" : true,
67
+ "type" : "string"
68
+ }, {
69
+ "ascendingLabel" : null,
70
+ "descendingLabel" : null,
71
+ "fieldNameOrPath" : "Id",
72
+ "hidden" : true,
73
+ "label" : "Account ID",
74
+ "selectListItem" : "Id",
75
+ "sortDirection" : null,
76
+ "sortIndex" : null,
77
+ "sortable" : false,
78
+ "type" : "id"
79
+ }, {
80
+ "ascendingLabel" : null,
81
+ "descendingLabel" : null,
82
+ "fieldNameOrPath" : "CreatedDate",
83
+ "hidden" : true,
84
+ "label" : "Created Date",
85
+ "selectListItem" : "CreatedDate",
86
+ "sortDirection" : null,
87
+ "sortIndex" : null,
88
+ "sortable" : false,
89
+ "type" : "datetime"
90
+ }, {
91
+ "ascendingLabel" : null,
92
+ "descendingLabel" : null,
93
+ "fieldNameOrPath" : "LastModifiedDate",
94
+ "hidden" : true,
95
+ "label" : "Last Modified Date",
96
+ "selectListItem" : "LastModifiedDate",
97
+ "sortDirection" : null,
98
+ "sortIndex" : null,
99
+ "sortable" : false,
100
+ "type" : "datetime"
101
+ }, {
102
+ "ascendingLabel" : null,
103
+ "descendingLabel" : null,
104
+ "fieldNameOrPath" : "SystemModstamp",
105
+ "hidden" : true,
106
+ "label" : "System Modstamp",
107
+ "selectListItem" : "SystemModstamp",
108
+ "sortDirection" : null,
109
+ "sortIndex" : null,
110
+ "sortable" : false,
111
+ "type" : "datetime"
112
+ } ],
113
+ "developerName" : "MyAccounts",
114
+ "done" : true,
115
+ "id" : "00BD0000005WcCN",
116
+ "label" : "My Accounts",
117
+ "records" : [ {
118
+ "columns" : [ {
119
+ "fieldNameOrPath" : "Name",
120
+ "value" : "Burlington Textiles Corp of America"
121
+ }, {
122
+ "fieldNameOrPath" : "Site",
123
+ "value" : null
124
+ }, {
125
+ "fieldNameOrPath" : "BillingState",
126
+ "value" : "NC"
127
+ }, {
128
+ "fieldNameOrPath" : "Phone",
129
+ "value" : "(336) 222-7000"
130
+ }, {
131
+ "fieldNameOrPath" : "Type",
132
+ "value" : "Customer - Direct"
133
+ }, {
134
+ "fieldNameOrPath" : "Owner.Alias",
135
+ "value" : "TUser"
136
+ }, {
137
+ "fieldNameOrPath" : "Id",
138
+ "value" : "001D000000JliSTIAZ"
139
+ }, {
140
+ "fieldNameOrPath" : "CreatedDate",
141
+ "value" : "Fri Aug 01 21:15:46 GMT 2014"
142
+ }, {
143
+ "fieldNameOrPath" : "LastModifiedDate",
144
+ "value" : "Fri Aug 01 21:15:46 GMT 2014"
145
+ }, {
146
+ "fieldNameOrPath" : "SystemModstamp",
147
+ "value" : "Fri Aug 01 21:15:46 GMT 2014"
148
+ } ]
149
+ } ],
150
+ "size" : 1
151
+ }
@@ -63,6 +63,24 @@ describe Restforce::Collection do
63
63
  end
64
64
  end
65
65
 
66
+ describe '#size' do
67
+ subject(:size) do
68
+ described_class.new(JSON.parse(fixture(sobject_fixture)), client).size
69
+ end
70
+
71
+ context 'when the query response contains a totalSize field' do
72
+ let(:sobject_fixture) { 'sobject/query_success_response' }
73
+
74
+ it { should eq 1 }
75
+ end
76
+
77
+ context 'when the query response contains a size field' do
78
+ let(:sobject_fixture) { 'sobject/list_view_results_success_response' }
79
+
80
+ it { should eq 1 }
81
+ end
82
+ end
83
+
66
84
  describe '#empty?' do
67
85
  subject(:empty?) do
68
86
  described_class.new(JSON.parse(fixture(sobject_fixture)), client).empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.3
4
+ version: 5.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Rogers
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-17 00:00:00.000000000 Z
12
+ date: 2022-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -170,6 +170,7 @@ files:
170
170
  - spec/fixtures/sobject/get_deleted_success_response.json
171
171
  - spec/fixtures/sobject/get_updated_success_response.json
172
172
  - spec/fixtures/sobject/list_sobjects_success_response.json
173
+ - spec/fixtures/sobject/list_view_results_success_response.json
173
174
  - spec/fixtures/sobject/org_query_response.json
174
175
  - spec/fixtures/sobject/query_aggregate_success_response.json
175
176
  - spec/fixtures/sobject/query_empty_response.json
@@ -254,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
255
  - !ruby/object:Gem::Version
255
256
  version: '0'
256
257
  requirements: []
257
- rubygems_version: 3.2.22
258
+ rubygems_version: 3.3.3
258
259
  signing_key:
259
260
  specification_version: 4
260
261
  summary: A lightweight Ruby client for the Salesforce REST API
@@ -273,6 +274,7 @@ test_files:
273
274
  - spec/fixtures/sobject/get_deleted_success_response.json
274
275
  - spec/fixtures/sobject/get_updated_success_response.json
275
276
  - spec/fixtures/sobject/list_sobjects_success_response.json
277
+ - spec/fixtures/sobject/list_view_results_success_response.json
276
278
  - spec/fixtures/sobject/org_query_response.json
277
279
  - spec/fixtures/sobject/query_aggregate_success_response.json
278
280
  - spec/fixtures/sobject/query_empty_response.json