restforce-db 0.1.6 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/lib/generators/templates/migration.rb.tt +2 -0
- data/lib/restforce/db/command.rb +17 -4
- data/lib/restforce/db/instances/active_record.rb +16 -0
- data/lib/restforce/db/instances/base.rb +12 -2
- data/lib/restforce/db/instances/salesforce.rb +8 -0
- data/lib/restforce/db/record_types/active_record.rb +7 -7
- data/lib/restforce/db/record_types/base.rb +17 -5
- data/lib/restforce/db/record_types/salesforce.rb +2 -1
- data/lib/restforce/db/synchronizer.rb +1 -1
- data/lib/restforce/db/tracker.rb +44 -0
- data/lib/restforce/db/version.rb +1 -1
- data/lib/restforce/db/worker.rb +47 -16
- data/lib/restforce/db.rb +3 -1
- data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_synchronization_is_stale/updates_the_database_record.yml +197 -0
- data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_synchronization_is_up-to-date/does_not_update_the_database_record.yml +234 -0
- data/test/lib/restforce/db/instances/active_record_test.rb +4 -0
- data/test/lib/restforce/db/record_types/active_record_test.rb +12 -8
- data/test/lib/restforce/db/synchronizer_test.rb +45 -14
- data/test/lib/restforce/db/tracker_test.rb +50 -0
- data/test/support/active_record.rb +4 -3
- metadata +6 -3
- data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_existing_record_in_the_database/updates_the_database_record.yml +0 -158
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: 0.
|
4
|
+
version: 0.2.3
|
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-03-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/restforce/db/record_types/base.rb
|
233
233
|
- lib/restforce/db/record_types/salesforce.rb
|
234
234
|
- lib/restforce/db/synchronizer.rb
|
235
|
+
- lib/restforce/db/tracker.rb
|
235
236
|
- lib/restforce/db/version.rb
|
236
237
|
- lib/restforce/db/worker.rb
|
237
238
|
- lib/restforce/extensions.rb
|
@@ -244,7 +245,8 @@ files:
|
|
244
245
|
- test/cassettes/Restforce_DB_RecordTypes_Salesforce/_create_/updates_the_database_record_with_the_Salesforce_record_s_ID.yml
|
245
246
|
- test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/finds_existing_records_in_Salesforce.yml
|
246
247
|
- test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/returns_nil_when_no_matching_record_exists.yml
|
247
|
-
- test/cassettes/Restforce_DB_Synchronizer/_run/
|
248
|
+
- test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_synchronization_is_stale/updates_the_database_record.yml
|
249
|
+
- test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_synchronization_is_up-to-date/does_not_update_the_database_record.yml
|
248
250
|
- test/cassettes/Restforce_DB_Synchronizer/_run/given_an_existing_Salesforce_record/populates_the_database_with_the_new_record.yml
|
249
251
|
- test/cassettes/Restforce_DB_Synchronizer/_run/given_an_existing_database_record/populates_Salesforce_with_the_new_record.yml
|
250
252
|
- test/lib/restforce/db/configuration_test.rb
|
@@ -256,6 +258,7 @@ files:
|
|
256
258
|
- test/lib/restforce/db/record_types/active_record_test.rb
|
257
259
|
- test/lib/restforce/db/record_types/salesforce_test.rb
|
258
260
|
- test/lib/restforce/db/synchronizer_test.rb
|
261
|
+
- test/lib/restforce/db/tracker_test.rb
|
259
262
|
- test/lib/restforce/db_test.rb
|
260
263
|
- test/support/active_record.rb
|
261
264
|
- test/support/database_cleaner.rb
|
@@ -1,158 +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
|
-
- Fri, 20 Mar 2015 20:59:39 GMT
|
25
|
-
Set-Cookie:
|
26
|
-
- BrowserId=uF36AF-_TUy_K6jmfPIc_w;Path=/;Domain=.salesforce.com;Expires=Tue,
|
27
|
-
19-May-2015 20:59:39 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":"1426885179820","token_type":"Bearer","instance_url":"https://<host>","signature":"kaiHQV/T08tk9hkH4w04iaPo5ecEAyOvqNvgKy/CyjQ=","access_token":"00D1a000000H3O9!AQ4AQGLw7kXVL1YKNwYo.72MhTH_JsNiQrcufxWTIkqwVDyMWC2KTKnZXSai5sESPjpz2IjAY1BrBSrja5_PVh3nTEA_uXnP"}'
|
41
|
-
http_version:
|
42
|
-
recorded_at: Fri, 20 Mar 2015 20:59:40 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":"Custom object","Example_Field__c":"Some sample text"}'
|
49
|
-
headers:
|
50
|
-
User-Agent:
|
51
|
-
- Faraday v0.9.1
|
52
|
-
Content-Type:
|
53
|
-
- application/json
|
54
|
-
Authorization:
|
55
|
-
- OAuth 00D1a000000H3O9!AQ4AQGLw7kXVL1YKNwYo.72MhTH_JsNiQrcufxWTIkqwVDyMWC2KTKnZXSai5sESPjpz2IjAY1BrBSrja5_PVh3nTEA_uXnP
|
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, 20 Mar 2015 20:59:41 GMT
|
67
|
-
Set-Cookie:
|
68
|
-
- BrowserId=xIZRRNLeRKuqkfwjkd3imw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
69
|
-
19-May-2015 20:59:41 GMT
|
70
|
-
Expires:
|
71
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
72
|
-
Sforce-Limit-Info:
|
73
|
-
- api-usage=121/15000
|
74
|
-
Location:
|
75
|
-
- "/services/data/v26.0/sobjects/CustomObject__c/a001a000001ECbGAAW"
|
76
|
-
Content-Type:
|
77
|
-
- application/json;charset=UTF-8
|
78
|
-
Transfer-Encoding:
|
79
|
-
- chunked
|
80
|
-
body:
|
81
|
-
encoding: ASCII-8BIT
|
82
|
-
string: '{"id":"a001a000001ECbGAAW","success":true,"errors":[]}'
|
83
|
-
http_version:
|
84
|
-
recorded_at: Fri, 20 Mar 2015 20:59:41 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%20SystemModstamp%20%3C=%202015-03-20T20:59:41Z
|
88
|
-
body:
|
89
|
-
encoding: US-ASCII
|
90
|
-
string: ''
|
91
|
-
headers:
|
92
|
-
User-Agent:
|
93
|
-
- Faraday v0.9.1
|
94
|
-
Authorization:
|
95
|
-
- OAuth 00D1a000000H3O9!AQ4AQGLw7kXVL1YKNwYo.72MhTH_JsNiQrcufxWTIkqwVDyMWC2KTKnZXSai5sESPjpz2IjAY1BrBSrja5_PVh3nTEA_uXnP
|
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
|
-
- Fri, 20 Mar 2015 20:59:42 GMT
|
107
|
-
Set-Cookie:
|
108
|
-
- BrowserId=tY8SAk7XSniaZlF00IBN9Q;Path=/;Domain=.salesforce.com;Expires=Tue,
|
109
|
-
19-May-2015 20:59:42 GMT
|
110
|
-
Expires:
|
111
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
112
|
-
Sforce-Limit-Info:
|
113
|
-
- api-usage=121/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/a001a000001ECbGAAW"},"Id":"a001a000001ECbGAAW","SystemModstamp":"2015-03-20T20:59:41.000+0000","Name":"Custom
|
121
|
-
object","Example_Field__c":"Some sample text"}]}'
|
122
|
-
http_version:
|
123
|
-
recorded_at: Fri, 20 Mar 2015 20:59:42 GMT
|
124
|
-
- request:
|
125
|
-
method: delete
|
126
|
-
uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001ECbGAAW
|
127
|
-
body:
|
128
|
-
encoding: US-ASCII
|
129
|
-
string: ''
|
130
|
-
headers:
|
131
|
-
User-Agent:
|
132
|
-
- Faraday v0.9.1
|
133
|
-
Authorization:
|
134
|
-
- OAuth 00D1a000000H3O9!AQ4AQGLw7kXVL1YKNwYo.72MhTH_JsNiQrcufxWTIkqwVDyMWC2KTKnZXSai5sESPjpz2IjAY1BrBSrja5_PVh3nTEA_uXnP
|
135
|
-
Accept-Encoding:
|
136
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
137
|
-
Accept:
|
138
|
-
- "*/*"
|
139
|
-
response:
|
140
|
-
status:
|
141
|
-
code: 204
|
142
|
-
message: No Content
|
143
|
-
headers:
|
144
|
-
Date:
|
145
|
-
- Fri, 20 Mar 2015 20:59:43 GMT
|
146
|
-
Set-Cookie:
|
147
|
-
- BrowserId=Ue_DPSZDSCyRoCXkP8Hmnw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
148
|
-
19-May-2015 20:59:43 GMT
|
149
|
-
Expires:
|
150
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
151
|
-
Sforce-Limit-Info:
|
152
|
-
- api-usage=121/15000
|
153
|
-
body:
|
154
|
-
encoding: UTF-8
|
155
|
-
string: ''
|
156
|
-
http_version:
|
157
|
-
recorded_at: Fri, 20 Mar 2015 20:59:43 GMT
|
158
|
-
recorded_with: VCR 2.9.3
|