restforce-db 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/restforce/db/accumulator.rb +13 -0
  3. data/lib/restforce/db/field_processor.rb +70 -0
  4. data/lib/restforce/db/instances/salesforce.rb +10 -0
  5. data/lib/restforce/db/record_types/salesforce.rb +2 -2
  6. data/lib/restforce/db/synchronizer.rb +2 -1
  7. data/lib/restforce/db/version.rb +1 -1
  8. data/lib/restforce/db.rb +1 -0
  9. data/test/cassettes/Restforce_DB_Associator/_run/given_a_BelongsTo_association/given_another_record_for_association/when_the_Salesforce_association_is_out_of_date/updates_the_association_ID_in_Salesforce.yml +135 -82
  10. data/test/cassettes/Restforce_DB_Associator/_run/given_a_BelongsTo_association/given_another_record_for_association/when_the_database_association_is_out_of_date/updates_the_associated_record_in_the_database.yml +152 -99
  11. data/test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_mapping_has_no_conditions/does_not_drop_the_synchronized_database_record.yml +120 -0
  12. data/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 +34 -36
  13. data/test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_record_meets_the_mapping_conditions/does_not_drop_the_synchronized_database_record.yml +35 -37
  14. data/test/cassettes/Restforce_DB_Initializer/_run/given_an_existing_database_record/for_an_Always_strategy/populates_Salesforce_with_the_new_record.yml +96 -44
  15. data/test/cassettes/Restforce_DB_Instances_Salesforce/_update_/updates_the_local_record_with_the_passed_attributes.yml +88 -35
  16. data/test/cassettes/Restforce_DB_Instances_Salesforce/_update_/updates_the_record_in_Salesforce_with_the_passed_attributes.yml +96 -43
  17. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_create_/creates_a_record_in_Salesforce_from_the_passed_database_record_s_attributes.yml +81 -28
  18. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_create_/updates_the_database_record_with_the_Salesforce_record_s_ID.yml +81 -28
  19. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/updates_the_database_record.yml +88 -35
  20. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/updates_the_salesforce_record.yml +96 -43
  21. data/test/lib/restforce/db/accumulator_test.rb +16 -0
  22. data/test/lib/restforce/db/cleaner_test.rb +15 -9
  23. data/test/lib/restforce/db/collector_test.rb +13 -15
  24. data/test/lib/restforce/db/field_processor_test.rb +51 -0
  25. data/test/lib/restforce/db/initializer_test.rb +10 -13
  26. data/test/lib/restforce/db/runner_cache_test.rb +1 -0
  27. data/test/support/utilities.rb +1 -0
  28. metadata +5 -3
  29. data/test/cassettes/Restforce_DB_Instances_Salesforce/_copy_/updates_the_record_with_the_attributes_from_the_copied_object.yml +0 -194
@@ -1,194 +0,0 @@
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
- - Thu, 26 Mar 2015 10:20:12 GMT
25
- Set-Cookie:
26
- - BrowserId=MlfkPJb4S1WI8GgWxOdmGA;Path=/;Domain=.salesforce.com;Expires=Mon,
27
- 25-May-2015 10:20:12 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":"1427365212460","token_type":"Bearer","instance_url":"https://<host>","signature":"TC/Ci2YBbhdj2C72eU314/8jdoSy9QDD+JOCKRbkOJk=","access_token":"00D1a000000H3O9!AQ4AQFqDs34WtnS6RDwxyGdLSPYE_cFTuNjjnDvX2HbNhGMu917m6JyqchGFbdiOruyd5Z.w7uN.ogsJF4_8TMMzdt2fw7OZ"}'
41
- http_version:
42
- recorded_at: Thu, 26 Mar 2015 10:20:12 GMT
43
- - request:
44
- method: post
45
- uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c
46
- body:
47
- encoding: UTF-8
48
- string: '{"Name":"Sample object"}'
49
- headers:
50
- User-Agent:
51
- - Faraday v0.9.1
52
- Content-Type:
53
- - application/json
54
- Authorization:
55
- - OAuth 00D1a000000H3O9!AQ4AQFqDs34WtnS6RDwxyGdLSPYE_cFTuNjjnDvX2HbNhGMu917m6JyqchGFbdiOruyd5Z.w7uN.ogsJF4_8TMMzdt2fw7OZ
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
- - Thu, 26 Mar 2015 10:20:13 GMT
67
- Set-Cookie:
68
- - BrowserId=wpzlVRKiQsqeuDI7ZuvGaQ;Path=/;Domain=.salesforce.com;Expires=Mon,
69
- 25-May-2015 10:20:13 GMT
70
- Expires:
71
- - Thu, 01 Jan 1970 00:00:00 GMT
72
- Sforce-Limit-Info:
73
- - api-usage=3/15000
74
- Location:
75
- - "/services/data/v26.0/sobjects/CustomObject__c/a001a000001J1AbAAK"
76
- Content-Type:
77
- - application/json;charset=UTF-8
78
- Transfer-Encoding:
79
- - chunked
80
- body:
81
- encoding: ASCII-8BIT
82
- string: '{"id":"a001a000001J1AbAAK","success":true,"errors":[]}'
83
- http_version:
84
- recorded_at: Thu, 26 Mar 2015 10:20:13 GMT
85
- - request:
86
- method: get
87
- uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001J1AbAAK%27
88
- body:
89
- encoding: US-ASCII
90
- string: ''
91
- headers:
92
- User-Agent:
93
- - Faraday v0.9.1
94
- Authorization:
95
- - OAuth 00D1a000000H3O9!AQ4AQFqDs34WtnS6RDwxyGdLSPYE_cFTuNjjnDvX2HbNhGMu917m6JyqchGFbdiOruyd5Z.w7uN.ogsJF4_8TMMzdt2fw7OZ
96
- Accept-Encoding:
97
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
98
- Accept:
99
- - "*/*"
100
- response:
101
- status:
102
- code: 200
103
- message: OK
104
- headers:
105
- Date:
106
- - Thu, 26 Mar 2015 10:20:14 GMT
107
- Set-Cookie:
108
- - BrowserId=9vz5JPGfRiiCr-fZ2Mq2lw;Path=/;Domain=.salesforce.com;Expires=Mon,
109
- 25-May-2015 10:20:14 GMT
110
- Expires:
111
- - Thu, 01 Jan 1970 00:00:00 GMT
112
- Sforce-Limit-Info:
113
- - api-usage=3/15000
114
- Content-Type:
115
- - application/json;charset=UTF-8
116
- Transfer-Encoding:
117
- - chunked
118
- body:
119
- encoding: ASCII-8BIT
120
- string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001J1AbAAK"},"Id":"a001a000001J1AbAAK","SystemModstamp":"2015-03-26T10:20:13.000+0000","Name":"Sample
121
- object","Example_Field__c":null}]}'
122
- http_version:
123
- recorded_at: Thu, 26 Mar 2015 10:20:14 GMT
124
- - request:
125
- method: patch
126
- uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001J1AbAAK
127
- body:
128
- encoding: UTF-8
129
- string: '{"Example_Field__c":"Copied text"}'
130
- headers:
131
- User-Agent:
132
- - Faraday v0.9.1
133
- Content-Type:
134
- - application/json
135
- Authorization:
136
- - OAuth 00D1a000000H3O9!AQ4AQFqDs34WtnS6RDwxyGdLSPYE_cFTuNjjnDvX2HbNhGMu917m6JyqchGFbdiOruyd5Z.w7uN.ogsJF4_8TMMzdt2fw7OZ
137
- Accept-Encoding:
138
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
139
- Accept:
140
- - "*/*"
141
- response:
142
- status:
143
- code: 204
144
- message: No Content
145
- headers:
146
- Date:
147
- - Thu, 26 Mar 2015 10:20:15 GMT
148
- Set-Cookie:
149
- - BrowserId=3pCnzs1GSe-sOl7lo-oUIw;Path=/;Domain=.salesforce.com;Expires=Mon,
150
- 25-May-2015 10:20:15 GMT
151
- Expires:
152
- - Thu, 01 Jan 1970 00:00:00 GMT
153
- Sforce-Limit-Info:
154
- - api-usage=3/15000
155
- body:
156
- encoding: UTF-8
157
- string: ''
158
- http_version:
159
- recorded_at: Thu, 26 Mar 2015 10:20:15 GMT
160
- - request:
161
- method: delete
162
- uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001J1AbAAK
163
- body:
164
- encoding: US-ASCII
165
- string: ''
166
- headers:
167
- User-Agent:
168
- - Faraday v0.9.1
169
- Authorization:
170
- - OAuth 00D1a000000H3O9!AQ4AQFqDs34WtnS6RDwxyGdLSPYE_cFTuNjjnDvX2HbNhGMu917m6JyqchGFbdiOruyd5Z.w7uN.ogsJF4_8TMMzdt2fw7OZ
171
- Accept-Encoding:
172
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
173
- Accept:
174
- - "*/*"
175
- response:
176
- status:
177
- code: 204
178
- message: No Content
179
- headers:
180
- Date:
181
- - Thu, 26 Mar 2015 10:20:16 GMT
182
- Set-Cookie:
183
- - BrowserId=KKBZeBoNQqOUXipcOuz7QQ;Path=/;Domain=.salesforce.com;Expires=Mon,
184
- 25-May-2015 10:20:16 GMT
185
- Expires:
186
- - Thu, 01 Jan 1970 00:00:00 GMT
187
- Sforce-Limit-Info:
188
- - api-usage=3/15000
189
- body:
190
- encoding: UTF-8
191
- string: ''
192
- http_version:
193
- recorded_at: Thu, 26 Mar 2015 10:20:16 GMT
194
- recorded_with: VCR 2.9.3