restforce-db 1.2.7 → 1.2.8
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/README.md +16 -6
- data/lib/restforce/db/association_cache.rb +49 -0
- data/lib/restforce/db/associations/base.rb +7 -5
- data/lib/restforce/db/associations/belongs_to.rb +6 -1
- data/lib/restforce/db/associations/has_many.rb +6 -1
- data/lib/restforce/db/associations/has_one.rb +6 -1
- data/lib/restforce/db/version.rb +1 -1
- data/lib/restforce/db.rb +1 -0
- data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/{when_the_associated_record_has_alrady_been_persisted → when_the_associated_record_has_already_been_persisted}/assigns_the_existing_record.yml +0 -0
- data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_associated_records_have_been_cached/uses_the_cached_records.yml +439 -0
- data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_associated_record_has_already_been_persisted/assigns_the_existing_record.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml +271 -0
- data/test/lib/restforce/db/association_cache_test.rb +63 -0
- data/test/lib/restforce/db/associations/belongs_to_test.rb +14 -2
- data/test/lib/restforce/db/associations/has_many_test.rb +17 -1
- data/test/lib/restforce/db/associations/has_one_test.rb +24 -0
- metadata +9 -3
@@ -0,0 +1,271 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://<host>/services/oauth2/token
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: grant_type=password&client_id=<client_id>&client_secret=<client_secret>&username=<username>&password=<password><security_token>
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Content-Type:
|
13
|
+
- application/x-www-form-urlencoded
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Fri, 01 May 2015 16:33:17 GMT
|
25
|
+
Set-Cookie:
|
26
|
+
- BrowserId=LtTu8_z3Sp2cm5mkBgsGTw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
27
|
+
30-Jun-2015 16:33:17 GMT
|
28
|
+
Expires:
|
29
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache, no-store
|
34
|
+
Content-Type:
|
35
|
+
- application/json;charset=UTF-8
|
36
|
+
Transfer-Encoding:
|
37
|
+
- chunked
|
38
|
+
body:
|
39
|
+
encoding: ASCII-8BIT
|
40
|
+
string: '{"id":"https://login.salesforce.com/id/00D1a000000H3O9EAK/0051a000000UGT8AAO","issued_at":"1430497997739","token_type":"Bearer","instance_url":"https://<host>","signature":"f4tQcugKKSE9kjNZgHUkr/ZXGP27pEKiZGfEskeGWgY=","access_token":"00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD"}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Fri, 01 May 2015 16:33:18 GMT
|
43
|
+
- request:
|
44
|
+
method: post
|
45
|
+
uri: https://<host>/services/data/v26.0/sobjects/Contact
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"Email":"somebody@example.com","LastName":"Somebody"}'
|
49
|
+
headers:
|
50
|
+
User-Agent:
|
51
|
+
- Faraday v0.9.1
|
52
|
+
Content-Type:
|
53
|
+
- application/json
|
54
|
+
Authorization:
|
55
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
56
|
+
Accept-Encoding:
|
57
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
58
|
+
Accept:
|
59
|
+
- "*/*"
|
60
|
+
response:
|
61
|
+
status:
|
62
|
+
code: 201
|
63
|
+
message: Created
|
64
|
+
headers:
|
65
|
+
Date:
|
66
|
+
- Fri, 01 May 2015 16:33:17 GMT
|
67
|
+
Set-Cookie:
|
68
|
+
- BrowserId=tLtZK_c5SrWi7_EH1k-1uA;Path=/;Domain=.salesforce.com;Expires=Tue,
|
69
|
+
30-Jun-2015 16:33:17 GMT
|
70
|
+
Expires:
|
71
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
72
|
+
Sforce-Limit-Info:
|
73
|
+
- api-usage=11/15000
|
74
|
+
Location:
|
75
|
+
- "/services/data/v26.0/sobjects/Contact/0031a000002jr5oAAA"
|
76
|
+
Content-Type:
|
77
|
+
- application/json;charset=UTF-8
|
78
|
+
Transfer-Encoding:
|
79
|
+
- chunked
|
80
|
+
body:
|
81
|
+
encoding: ASCII-8BIT
|
82
|
+
string: '{"id":"0031a000002jr5oAAA","success":true,"errors":[]}'
|
83
|
+
http_version:
|
84
|
+
recorded_at: Fri, 01 May 2015 16:33:18 GMT
|
85
|
+
- request:
|
86
|
+
method: post
|
87
|
+
uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c
|
88
|
+
body:
|
89
|
+
encoding: UTF-8
|
90
|
+
string: '{"Friend__c":"0031a000002jr5oAAA"}'
|
91
|
+
headers:
|
92
|
+
User-Agent:
|
93
|
+
- Faraday v0.9.1
|
94
|
+
Content-Type:
|
95
|
+
- application/json
|
96
|
+
Authorization:
|
97
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
98
|
+
Accept-Encoding:
|
99
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
100
|
+
Accept:
|
101
|
+
- "*/*"
|
102
|
+
response:
|
103
|
+
status:
|
104
|
+
code: 201
|
105
|
+
message: Created
|
106
|
+
headers:
|
107
|
+
Date:
|
108
|
+
- Fri, 01 May 2015 16:33:18 GMT
|
109
|
+
Set-Cookie:
|
110
|
+
- BrowserId=jN5M9ObZTi-rz1DyxbAeZw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
111
|
+
30-Jun-2015 16:33:18 GMT
|
112
|
+
Expires:
|
113
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
114
|
+
Sforce-Limit-Info:
|
115
|
+
- api-usage=11/15000
|
116
|
+
Location:
|
117
|
+
- "/services/data/v26.0/sobjects/CustomObject__c/a001a000001TuP2AAK"
|
118
|
+
Content-Type:
|
119
|
+
- application/json;charset=UTF-8
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
body:
|
123
|
+
encoding: ASCII-8BIT
|
124
|
+
string: '{"id":"a001a000001TuP2AAK","success":true,"errors":[]}'
|
125
|
+
http_version:
|
126
|
+
recorded_at: Fri, 01 May 2015 16:33:18 GMT
|
127
|
+
- request:
|
128
|
+
method: get
|
129
|
+
uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Email%20from%20Contact%20where%20Id%20=%20%270031a000002jr5oAAA%27
|
130
|
+
body:
|
131
|
+
encoding: US-ASCII
|
132
|
+
string: ''
|
133
|
+
headers:
|
134
|
+
User-Agent:
|
135
|
+
- Faraday v0.9.1
|
136
|
+
Authorization:
|
137
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
138
|
+
Accept-Encoding:
|
139
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
140
|
+
Accept:
|
141
|
+
- "*/*"
|
142
|
+
response:
|
143
|
+
status:
|
144
|
+
code: 200
|
145
|
+
message: OK
|
146
|
+
headers:
|
147
|
+
Date:
|
148
|
+
- Fri, 01 May 2015 16:33:18 GMT
|
149
|
+
Set-Cookie:
|
150
|
+
- BrowserId=CSF-VoOoS5ChC6rHiA3_Xw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
151
|
+
30-Jun-2015 16:33:18 GMT
|
152
|
+
Expires:
|
153
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
154
|
+
Sforce-Limit-Info:
|
155
|
+
- api-usage=11/15000
|
156
|
+
Content-Type:
|
157
|
+
- application/json;charset=UTF-8
|
158
|
+
Transfer-Encoding:
|
159
|
+
- chunked
|
160
|
+
body:
|
161
|
+
encoding: ASCII-8BIT
|
162
|
+
string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Contact","url":"/services/data/v26.0/sobjects/Contact/0031a000002jr5oAAA"},"Id":"0031a000002jr5oAAA","SystemModstamp":"2015-05-01T16:33:18.000+0000","Email":"somebody@example.com"}]}'
|
163
|
+
http_version:
|
164
|
+
recorded_at: Fri, 01 May 2015 16:33:18 GMT
|
165
|
+
- request:
|
166
|
+
method: get
|
167
|
+
uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c,%20Friend__c%20from%20CustomObject__c%20where%20Friend__c%20=%20%270031a000002jr5oAAA%27
|
168
|
+
body:
|
169
|
+
encoding: US-ASCII
|
170
|
+
string: ''
|
171
|
+
headers:
|
172
|
+
User-Agent:
|
173
|
+
- Faraday v0.9.1
|
174
|
+
Authorization:
|
175
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
176
|
+
Accept-Encoding:
|
177
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
178
|
+
Accept:
|
179
|
+
- "*/*"
|
180
|
+
response:
|
181
|
+
status:
|
182
|
+
code: 200
|
183
|
+
message: OK
|
184
|
+
headers:
|
185
|
+
Date:
|
186
|
+
- Fri, 01 May 2015 16:33:18 GMT
|
187
|
+
Set-Cookie:
|
188
|
+
- BrowserId=SWCHmZA9RwC4OyFZ5smP4g;Path=/;Domain=.salesforce.com;Expires=Tue,
|
189
|
+
30-Jun-2015 16:33:18 GMT
|
190
|
+
Expires:
|
191
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
192
|
+
Sforce-Limit-Info:
|
193
|
+
- api-usage=11/15000
|
194
|
+
Content-Type:
|
195
|
+
- application/json;charset=UTF-8
|
196
|
+
Transfer-Encoding:
|
197
|
+
- chunked
|
198
|
+
body:
|
199
|
+
encoding: ASCII-8BIT
|
200
|
+
string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001TuP2AAK"},"Id":"a001a000001TuP2AAK","SystemModstamp":"2015-05-01T16:33:18.000+0000","Name":"a001a000001TuP2","Example_Field__c":null,"Friend__c":"0031a000002jr5oAAA"}]}'
|
201
|
+
http_version:
|
202
|
+
recorded_at: Fri, 01 May 2015 16:33:19 GMT
|
203
|
+
- request:
|
204
|
+
method: delete
|
205
|
+
uri: https://<host>/services/data/v26.0/sobjects/Contact/0031a000002jr5oAAA
|
206
|
+
body:
|
207
|
+
encoding: US-ASCII
|
208
|
+
string: ''
|
209
|
+
headers:
|
210
|
+
User-Agent:
|
211
|
+
- Faraday v0.9.1
|
212
|
+
Authorization:
|
213
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
214
|
+
Accept-Encoding:
|
215
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
216
|
+
Accept:
|
217
|
+
- "*/*"
|
218
|
+
response:
|
219
|
+
status:
|
220
|
+
code: 204
|
221
|
+
message: No Content
|
222
|
+
headers:
|
223
|
+
Date:
|
224
|
+
- Fri, 01 May 2015 16:33:18 GMT
|
225
|
+
Set-Cookie:
|
226
|
+
- BrowserId=Wu08XNSWRJWJeDbodhrnRw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
227
|
+
30-Jun-2015 16:33:18 GMT
|
228
|
+
Expires:
|
229
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
230
|
+
Sforce-Limit-Info:
|
231
|
+
- api-usage=11/15000
|
232
|
+
body:
|
233
|
+
encoding: UTF-8
|
234
|
+
string: ''
|
235
|
+
http_version:
|
236
|
+
recorded_at: Fri, 01 May 2015 16:33:19 GMT
|
237
|
+
- request:
|
238
|
+
method: delete
|
239
|
+
uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001TuP2AAK
|
240
|
+
body:
|
241
|
+
encoding: US-ASCII
|
242
|
+
string: ''
|
243
|
+
headers:
|
244
|
+
User-Agent:
|
245
|
+
- Faraday v0.9.1
|
246
|
+
Authorization:
|
247
|
+
- OAuth 00D1a000000H3O9!AQ4AQDv3Hk9TRSKHVK.6TQHDjiXPpFDEH7AxoxdK.ytZcKr4gkBGokBh2ZhUcaf0_eFqhFa6YVCzmfP.bUKsz9xIJOy41iQD
|
248
|
+
Accept-Encoding:
|
249
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
250
|
+
Accept:
|
251
|
+
- "*/*"
|
252
|
+
response:
|
253
|
+
status:
|
254
|
+
code: 204
|
255
|
+
message: No Content
|
256
|
+
headers:
|
257
|
+
Date:
|
258
|
+
- Fri, 01 May 2015 16:33:19 GMT
|
259
|
+
Set-Cookie:
|
260
|
+
- BrowserId=NbXpvQcjQ-eN2Vw0MceMMg;Path=/;Domain=.salesforce.com;Expires=Tue,
|
261
|
+
30-Jun-2015 16:33:19 GMT
|
262
|
+
Expires:
|
263
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
264
|
+
Sforce-Limit-Info:
|
265
|
+
- api-usage=11/15000
|
266
|
+
body:
|
267
|
+
encoding: UTF-8
|
268
|
+
string: ''
|
269
|
+
http_version:
|
270
|
+
recorded_at: Fri, 01 May 2015 16:33:19 GMT
|
271
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
describe Restforce::DB::AssociationCache do
|
4
|
+
|
5
|
+
configure!
|
6
|
+
|
7
|
+
let(:cache) { Restforce::DB::AssociationCache.new }
|
8
|
+
let(:database_model) { CustomObject }
|
9
|
+
let(:lookups) { { salesforce_id: "a001a000001E1vREAL" } }
|
10
|
+
let(:record) { database_model.new(lookups) }
|
11
|
+
|
12
|
+
describe "#<<" do
|
13
|
+
before do
|
14
|
+
cache << record
|
15
|
+
end
|
16
|
+
|
17
|
+
it "caches the appended record by class" do
|
18
|
+
expect(cache.cache[database_model]).to_equal [record]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#find" do
|
23
|
+
let(:found) { cache.find(database_model, lookups) }
|
24
|
+
|
25
|
+
describe "when the record has been added to the cache" do
|
26
|
+
before do
|
27
|
+
cache << record
|
28
|
+
end
|
29
|
+
|
30
|
+
it "finds the record" do
|
31
|
+
expect(found).to_equal record
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "when the record has been persisted" do
|
36
|
+
before do
|
37
|
+
record.save!
|
38
|
+
end
|
39
|
+
|
40
|
+
it "finds the persisted record by its lookups" do
|
41
|
+
expect(found).to_equal record
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "when a record of another class has been added with the same lookups" do
|
46
|
+
before do
|
47
|
+
cache << User.new(lookups)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns nil" do
|
51
|
+
expect(found).to_be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "when no record has been added or persisted" do
|
56
|
+
|
57
|
+
it "returns nil" do
|
58
|
+
expect(found).to_be_nil
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -99,8 +99,7 @@ describe Restforce::DB::Associations::BelongsTo do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
describe "when the associated record has
|
103
|
-
let(:database_record) { CustomObject.new }
|
102
|
+
describe "when the associated record has already been persisted" do
|
104
103
|
let(:user) { User.create!(salesforce_id: user_salesforce_id) }
|
105
104
|
|
106
105
|
before { user }
|
@@ -110,6 +109,19 @@ describe Restforce::DB::Associations::BelongsTo do
|
|
110
109
|
expect(database_record.user).to_equal user
|
111
110
|
end
|
112
111
|
end
|
112
|
+
|
113
|
+
describe "when the associated record has been cached" do
|
114
|
+
let(:user) { User.new(salesforce_id: user_salesforce_id) }
|
115
|
+
let(:cache) { Restforce::DB::AssociationCache.new }
|
116
|
+
let(:associated) { association.build(database_record, salesforce_record, cache) }
|
117
|
+
|
118
|
+
before { cache << user }
|
119
|
+
|
120
|
+
it "uses the cached record" do
|
121
|
+
expect(associated).to_be :empty?
|
122
|
+
expect(database_record.user).to_equal user
|
123
|
+
end
|
124
|
+
end
|
113
125
|
end
|
114
126
|
end
|
115
127
|
|
@@ -102,7 +102,6 @@ describe Restforce::DB::Associations::HasMany do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
describe "when the associated records have alrady been persisted" do
|
105
|
-
let(:database_record) { CustomObject.new }
|
106
105
|
let(:details) { detail_salesforce_ids.map { |id| Detail.create!(salesforce_id: id) } }
|
107
106
|
|
108
107
|
before { details }
|
@@ -112,6 +111,23 @@ describe Restforce::DB::Associations::HasMany do
|
|
112
111
|
expect(database_record.details).to_match_array details
|
113
112
|
end
|
114
113
|
end
|
114
|
+
|
115
|
+
describe "when the associated records have been cached" do
|
116
|
+
let(:details) { detail_salesforce_ids.map { |id| Detail.new(salesforce_id: id) } }
|
117
|
+
let(:cache) { Restforce::DB::AssociationCache.new }
|
118
|
+
let(:associated) { association.build(database_record, salesforce_record, cache) }
|
119
|
+
|
120
|
+
before do
|
121
|
+
details.each do |detail|
|
122
|
+
cache << detail
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
it "uses the cached records" do
|
127
|
+
expect(associated).to_be :empty?
|
128
|
+
expect(database_record.details).to_match_array details
|
129
|
+
end
|
130
|
+
end
|
115
131
|
end
|
116
132
|
end
|
117
133
|
end
|
@@ -85,6 +85,30 @@ describe Restforce::DB::Associations::HasOne do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
describe "when the associated record has already been persisted" do
|
89
|
+
let(:object) { CustomObject.create!(salesforce_id: object_salesforce_id) }
|
90
|
+
|
91
|
+
before { object }
|
92
|
+
|
93
|
+
it "assigns the existing record" do
|
94
|
+
expect(associated).to_be :empty?
|
95
|
+
expect(database_record.custom_object).to_equal object
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "when the associated record has been cached" do
|
100
|
+
let(:object) { CustomObject.new(salesforce_id: object_salesforce_id) }
|
101
|
+
let(:cache) { Restforce::DB::AssociationCache.new }
|
102
|
+
let(:associated) { association.build(database_record, salesforce_record, cache) }
|
103
|
+
|
104
|
+
before { cache << object }
|
105
|
+
|
106
|
+
it "uses the cached record" do
|
107
|
+
expect(associated).to_be :empty?
|
108
|
+
expect(database_record.custom_object).to_equal object
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
88
112
|
describe "and a nested association on the associated mapping" do
|
89
113
|
let(:nested_mapping) do
|
90
114
|
Restforce::DB::Mapping.new(Detail, "CustomObjectDetail__c").tap do |map|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce-db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Horner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/generators/templates/script
|
209
209
|
- lib/restforce/db.rb
|
210
210
|
- lib/restforce/db/accumulator.rb
|
211
|
+
- lib/restforce/db/association_cache.rb
|
211
212
|
- lib/restforce/db/associations/base.rb
|
212
213
|
- lib/restforce/db/associations/belongs_to.rb
|
213
214
|
- lib/restforce/db/associations/foreign_key.rb
|
@@ -245,18 +246,22 @@ files:
|
|
245
246
|
- test/cassettes/Restforce_DB/accessing_Salesforce/uses_the_configured_credentials.yml
|
246
247
|
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml
|
247
248
|
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_no_salesforce_record_is_found_for_the_association/proceeds_without_constructing_any_records.yml
|
248
|
-
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/
|
249
|
+
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_already_been_persisted/assigns_the_existing_record.yml
|
250
|
+
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml
|
249
251
|
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/with_an_unrelated_association_mapping/proceeds_without_raising_an_error.yml
|
250
252
|
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml
|
251
253
|
- test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml
|
252
254
|
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/builds_a_number_of_associated_records_from_the_data_in_Salesforce.yml
|
253
255
|
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_no_salesforce_record_is_found_for_the_association/proceeds_without_constructing_any_records.yml
|
254
256
|
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_associated_records_have_alrady_been_persisted/constructs_the_association_from_the_existing_records.yml
|
257
|
+
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_associated_records_have_been_cached/uses_the_cached_records.yml
|
255
258
|
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml
|
256
259
|
- test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml
|
257
260
|
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/and_a_nested_association_on_the_associated_mapping/recursively_builds_all_associations.yml
|
258
261
|
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml
|
259
262
|
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_no_salesforce_record_is_found_for_the_association/proceeds_without_constructing_any_records.yml
|
263
|
+
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_associated_record_has_already_been_persisted/assigns_the_existing_record.yml
|
264
|
+
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml
|
260
265
|
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml
|
261
266
|
- test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml
|
262
267
|
- test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_record_does_not_meet_the_mapping_conditions/for_a_non-Passive_strategy/drops_the_synchronized_database_record.yml
|
@@ -288,6 +293,7 @@ files:
|
|
288
293
|
- test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/updates_the_salesforce_record.yml
|
289
294
|
- test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_no_associated_database_record/does_nothing_for_this_specific_mapping.yml
|
290
295
|
- test/lib/restforce/db/accumulator_test.rb
|
296
|
+
- test/lib/restforce/db/association_cache_test.rb
|
291
297
|
- test/lib/restforce/db/associations/belongs_to_test.rb
|
292
298
|
- test/lib/restforce/db/associations/has_many_test.rb
|
293
299
|
- test/lib/restforce/db/associations/has_one_test.rb
|