restforce-db 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -22
- data/lib/restforce/db/associations/base.rb +152 -0
- data/lib/restforce/db/associations/belongs_to.rb +70 -0
- data/lib/restforce/db/associations/foreign_key.rb +80 -0
- data/lib/restforce/db/associations/has_many.rb +37 -0
- data/lib/restforce/db/associations/has_one.rb +33 -0
- data/lib/restforce/db/dsl.rb +25 -13
- data/lib/restforce/db/mapping.rb +2 -3
- data/lib/restforce/db/record_types/active_record.rb +3 -8
- data/lib/restforce/db/record_types/salesforce.rb +23 -8
- data/lib/restforce/db/strategies/associated.rb +58 -0
- data/lib/restforce/db/version.rb +1 -1
- data/lib/restforce/db.rb +6 -1
- data/restforce-db.gemspec +0 -1
- data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/builds_a_number_of_associated_records_from_the_data_in_Salesforce.yml +439 -0
- data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +439 -0
- data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +196 -0
- data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +271 -0
- data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +271 -0
- data/test/cassettes/Restforce_DB_Strategies_Associated/_build_/given_an_inverse_mapping/with_a_synchronized_association_record/wants_to_build_a_new_record.yml +275 -0
- data/test/cassettes/Restforce_DB_Strategies_Associated/_build_/given_an_inverse_mapping/with_an_existing_database_record/does_not_want_to_build_a_new_record.yml +237 -0
- data/test/cassettes/Restforce_DB_Strategies_Associated/_build_/given_an_inverse_mapping/with_no_synchronized_association_record/does_not_want_to_build_a_new_record.yml +275 -0
- data/test/lib/restforce/db/associations/belongs_to_test.rb +82 -0
- data/test/lib/restforce/db/associations/has_many_test.rb +96 -0
- data/test/lib/restforce/db/associations/has_one_test.rb +80 -0
- data/test/lib/restforce/db/dsl_test.rb +22 -3
- data/test/lib/restforce/db/mapping_test.rb +10 -8
- data/test/lib/restforce/db/record_types/active_record_test.rb +12 -5
- data/test/lib/restforce/db/runner_test.rb +2 -3
- data/test/lib/restforce/db/strategies/always_test.rb +2 -2
- data/test/lib/restforce/db/strategies/associated_test.rb +78 -0
- data/test/lib/restforce/db/strategies/passive_test.rb +1 -1
- data/test/lib/restforce/db/tracker_test.rb +0 -2
- data/test/support/active_record.rb +25 -2
- data/test/support/salesforce.rb +1 -1
- data/test/support/utilities.rb +5 -7
- data/test/test_helper.rb +0 -1
- metadata +24 -18
- data/lib/restforce/db/associations/active_record.rb +0 -68
- data/test/lib/restforce/db/associations/active_record_test.rb +0 -43
@@ -0,0 +1,58 @@
|
|
1
|
+
module Restforce
|
2
|
+
|
3
|
+
module DB
|
4
|
+
|
5
|
+
module Strategies
|
6
|
+
|
7
|
+
# Restforce::DB::Strategies::Associated defines an initialization strategy
|
8
|
+
# for a mapping in which newly-discovered records should only be
|
9
|
+
# synchronized into the other system when a specific associated record
|
10
|
+
# has already been synchronized.
|
11
|
+
class Associated
|
12
|
+
|
13
|
+
# Public: Initialize a Restforce::DB::Strategies::Associated for the
|
14
|
+
# passed mapping.
|
15
|
+
#
|
16
|
+
# with - A Symbol name of the association which should be checked.
|
17
|
+
def initialize(with:)
|
18
|
+
@association = with.to_sym
|
19
|
+
end
|
20
|
+
|
21
|
+
# Public: Should the passed record be constructed in the other system?
|
22
|
+
#
|
23
|
+
# record - A Restforce::DB::Instances::Base.
|
24
|
+
#
|
25
|
+
# Returns a Boolean.
|
26
|
+
def build?(record)
|
27
|
+
!record.synced? && target_association(record.mapping).synced_for?(record)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Public: Is this a passive sync strategy?
|
31
|
+
#
|
32
|
+
# Returns false.
|
33
|
+
def passive?
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# Internal: Get the target association for the desired associated record
|
40
|
+
# lookup.
|
41
|
+
#
|
42
|
+
# mapping - A Restforce::DB::Mapping
|
43
|
+
#
|
44
|
+
# Returns a Restforce::DB::Associations::Base.
|
45
|
+
def target_association(mapping)
|
46
|
+
@target_association ||= mapping.associations.detect do |association|
|
47
|
+
association.name == @association
|
48
|
+
end
|
49
|
+
@target_association || raise(ArgumentError, ":with must correspond to a defined association")
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data/lib/restforce/db/version.rb
CHANGED
data/lib/restforce/db.rb
CHANGED
@@ -9,7 +9,11 @@ require "restforce/db/registry"
|
|
9
9
|
require "restforce/db/strategy"
|
10
10
|
require "restforce/db/dsl"
|
11
11
|
|
12
|
-
require "restforce/db/associations/
|
12
|
+
require "restforce/db/associations/base"
|
13
|
+
require "restforce/db/associations/belongs_to"
|
14
|
+
require "restforce/db/associations/foreign_key"
|
15
|
+
require "restforce/db/associations/has_many"
|
16
|
+
require "restforce/db/associations/has_one"
|
13
17
|
|
14
18
|
require "restforce/db/instances/base"
|
15
19
|
require "restforce/db/instances/active_record"
|
@@ -20,6 +24,7 @@ require "restforce/db/record_types/active_record"
|
|
20
24
|
require "restforce/db/record_types/salesforce"
|
21
25
|
|
22
26
|
require "restforce/db/strategies/always"
|
27
|
+
require "restforce/db/strategies/associated"
|
23
28
|
require "restforce/db/strategies/passive"
|
24
29
|
|
25
30
|
require "restforce/db/runner"
|
data/restforce-db.gemspec
CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "bundler", "~> 1.8"
|
32
32
|
spec.add_development_dependency "database_cleaner"
|
33
33
|
spec.add_development_dependency "minitest"
|
34
|
-
spec.add_development_dependency "minitest-bang"
|
35
34
|
spec.add_development_dependency "minitest-spec-expect"
|
36
35
|
spec.add_development_dependency "minitest-vcr"
|
37
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -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, 10 Apr 2015 02:10:27 GMT
|
25
|
+
Set-Cookie:
|
26
|
+
- BrowserId=FY9VBGWDTKOLnfn0YRc09A;Path=/;Domain=.salesforce.com;Expires=Tue,
|
27
|
+
09-Jun-2015 02:10:27 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":"1428631827849","token_type":"Bearer","instance_url":"https://<host>","signature":"BXGR8ydlpCf8EvBey3owrmD+t8H2Xwv4wg5rPNZH7o0=","access_token":"00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW"}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Fri, 10 Apr 2015 02:10:29 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!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:30 GMT
|
67
|
+
Set-Cookie:
|
68
|
+
- BrowserId=6-GstZaCR1uEQGIPRQbjwA;Path=/;Domain=.salesforce.com;Expires=Tue,
|
69
|
+
09-Jun-2015 02:10:30 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/0031a000001y45eAAA"
|
76
|
+
Content-Type:
|
77
|
+
- application/json;charset=UTF-8
|
78
|
+
Transfer-Encoding:
|
79
|
+
- chunked
|
80
|
+
body:
|
81
|
+
encoding: ASCII-8BIT
|
82
|
+
string: '{"id":"0031a000001y45eAAA","success":true,"errors":[]}'
|
83
|
+
http_version:
|
84
|
+
recorded_at: Fri, 10 Apr 2015 02:10:30 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":"0031a000001y45eAAA"}'
|
91
|
+
headers:
|
92
|
+
User-Agent:
|
93
|
+
- Faraday v0.9.1
|
94
|
+
Content-Type:
|
95
|
+
- application/json
|
96
|
+
Authorization:
|
97
|
+
- OAuth 00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:31 GMT
|
109
|
+
Set-Cookie:
|
110
|
+
- BrowserId=ToZfBFxvREKP_xa5EJEGNg;Path=/;Domain=.salesforce.com;Expires=Tue,
|
111
|
+
09-Jun-2015 02:10:31 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/a001a000001LS2EAAW"
|
118
|
+
Content-Type:
|
119
|
+
- application/json;charset=UTF-8
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
body:
|
123
|
+
encoding: ASCII-8BIT
|
124
|
+
string: '{"id":"a001a000001LS2EAAW","success":true,"errors":[]}'
|
125
|
+
http_version:
|
126
|
+
recorded_at: Fri, 10 Apr 2015 02:10:31 GMT
|
127
|
+
- request:
|
128
|
+
method: get
|
129
|
+
uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c,%20Friend__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001LS2EAAW%27
|
130
|
+
body:
|
131
|
+
encoding: US-ASCII
|
132
|
+
string: ''
|
133
|
+
headers:
|
134
|
+
User-Agent:
|
135
|
+
- Faraday v0.9.1
|
136
|
+
Authorization:
|
137
|
+
- OAuth 00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:32 GMT
|
149
|
+
Set-Cookie:
|
150
|
+
- BrowserId=wSa0yGdqRY21w58q9qGeiw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
151
|
+
09-Jun-2015 02:10:32 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":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001LS2EAAW"},"Id":"a001a000001LS2EAAW","SystemModstamp":"2015-04-10T02:10:31.000+0000","Name":"a001a000001LS2E","Example_Field__c":null,"Friend__c":"0031a000001y45eAAA"}]}'
|
163
|
+
http_version:
|
164
|
+
recorded_at: Fri, 10 Apr 2015 02:10:32 GMT
|
165
|
+
- request:
|
166
|
+
method: get
|
167
|
+
uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Email%20from%20Contact%20where%20Id%20=%20%270031a000001y45eAAA%27
|
168
|
+
body:
|
169
|
+
encoding: US-ASCII
|
170
|
+
string: ''
|
171
|
+
headers:
|
172
|
+
User-Agent:
|
173
|
+
- Faraday v0.9.1
|
174
|
+
Authorization:
|
175
|
+
- OAuth 00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:33 GMT
|
187
|
+
Set-Cookie:
|
188
|
+
- BrowserId=wJyFDAF4T3i6yXDBP6z6Jw;Path=/;Domain=.salesforce.com;Expires=Tue,
|
189
|
+
09-Jun-2015 02:10:33 GMT
|
190
|
+
Expires:
|
191
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
192
|
+
Sforce-Limit-Info:
|
193
|
+
- api-usage=12/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":"Contact","url":"/services/data/v26.0/sobjects/Contact/0031a000001y45eAAA"},"Id":"0031a000001y45eAAA","SystemModstamp":"2015-04-10T02:10:30.000+0000","Email":"somebody@example.com"}]}'
|
201
|
+
http_version:
|
202
|
+
recorded_at: Fri, 10 Apr 2015 02:10:33 GMT
|
203
|
+
- request:
|
204
|
+
method: delete
|
205
|
+
uri: https://<host>/services/data/v26.0/sobjects/Contact/0031a000001y45eAAA
|
206
|
+
body:
|
207
|
+
encoding: US-ASCII
|
208
|
+
string: ''
|
209
|
+
headers:
|
210
|
+
User-Agent:
|
211
|
+
- Faraday v0.9.1
|
212
|
+
Authorization:
|
213
|
+
- OAuth 00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:34 GMT
|
225
|
+
Set-Cookie:
|
226
|
+
- BrowserId=oky5yaNtQlSK9UVhJpAnvQ;Path=/;Domain=.salesforce.com;Expires=Tue,
|
227
|
+
09-Jun-2015 02:10:34 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, 10 Apr 2015 02:10:34 GMT
|
237
|
+
- request:
|
238
|
+
method: delete
|
239
|
+
uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001LS2EAAW
|
240
|
+
body:
|
241
|
+
encoding: US-ASCII
|
242
|
+
string: ''
|
243
|
+
headers:
|
244
|
+
User-Agent:
|
245
|
+
- Faraday v0.9.1
|
246
|
+
Authorization:
|
247
|
+
- OAuth 00D1a000000H3O9!AQ4AQNe4R8V.LO2wVndhS1VuuxNtdXS1JCvyNPnzJvH6QSXO9uYDDviw_E1.9iDm2CAsI8PipNylFdpNxUnQrofmMfc7RNsW
|
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, 10 Apr 2015 02:10:35 GMT
|
259
|
+
Set-Cookie:
|
260
|
+
- BrowserId=zymXJDyvSpGTuUi-0iLM_Q;Path=/;Domain=.salesforce.com;Expires=Tue,
|
261
|
+
09-Jun-2015 02:10:35 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, 10 Apr 2015 02:10:35 GMT
|
271
|
+
recorded_with: VCR 2.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
|
+
- Sat, 11 Apr 2015 01:23:50 GMT
|
25
|
+
Set-Cookie:
|
26
|
+
- BrowserId=wxVKkgCtS0iqyMbtQnfpwg;Path=/;Domain=.salesforce.com;Expires=Wed,
|
27
|
+
10-Jun-2015 01:23:50 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":"1428715430707","token_type":"Bearer","instance_url":"https://<host>","signature":"GqowJrZwZnvh/FQmaN/zR2DJsm9BQNYlk+S4ewYO+s4=","access_token":"00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj"}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Sat, 11 Apr 2015 01:23:51 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!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:52 GMT
|
67
|
+
Set-Cookie:
|
68
|
+
- BrowserId=Fw86cXceQQ6uq3NGexsHLw;Path=/;Domain=.salesforce.com;Expires=Wed,
|
69
|
+
10-Jun-2015 01:23:52 GMT
|
70
|
+
Expires:
|
71
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
72
|
+
Sforce-Limit-Info:
|
73
|
+
- api-usage=103/15000
|
74
|
+
Location:
|
75
|
+
- "/services/data/v26.0/sobjects/Contact/0031a000001yZN7AAM"
|
76
|
+
Content-Type:
|
77
|
+
- application/json;charset=UTF-8
|
78
|
+
Transfer-Encoding:
|
79
|
+
- chunked
|
80
|
+
body:
|
81
|
+
encoding: ASCII-8BIT
|
82
|
+
string: '{"id":"0031a000001yZN7AAM","success":true,"errors":[]}'
|
83
|
+
http_version:
|
84
|
+
recorded_at: Sat, 11 Apr 2015 01:23:53 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":"0031a000001yZN7AAM"}'
|
91
|
+
headers:
|
92
|
+
User-Agent:
|
93
|
+
- Faraday v0.9.1
|
94
|
+
Content-Type:
|
95
|
+
- application/json
|
96
|
+
Authorization:
|
97
|
+
- OAuth 00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:54 GMT
|
109
|
+
Set-Cookie:
|
110
|
+
- BrowserId=WTpUCqKNTraZywGUlNicww;Path=/;Domain=.salesforce.com;Expires=Wed,
|
111
|
+
10-Jun-2015 01:23:54 GMT
|
112
|
+
Expires:
|
113
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
114
|
+
Sforce-Limit-Info:
|
115
|
+
- api-usage=104/15000
|
116
|
+
Location:
|
117
|
+
- "/services/data/v26.0/sobjects/CustomObject__c/a001a000001LXgVAAW"
|
118
|
+
Content-Type:
|
119
|
+
- application/json;charset=UTF-8
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
body:
|
123
|
+
encoding: ASCII-8BIT
|
124
|
+
string: '{"id":"a001a000001LXgVAAW","success":true,"errors":[]}'
|
125
|
+
http_version:
|
126
|
+
recorded_at: Sat, 11 Apr 2015 01:23:54 GMT
|
127
|
+
- request:
|
128
|
+
method: get
|
129
|
+
uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c,%20Friend__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001LXgVAAW%27
|
130
|
+
body:
|
131
|
+
encoding: US-ASCII
|
132
|
+
string: ''
|
133
|
+
headers:
|
134
|
+
User-Agent:
|
135
|
+
- Faraday v0.9.1
|
136
|
+
Authorization:
|
137
|
+
- OAuth 00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:55 GMT
|
149
|
+
Set-Cookie:
|
150
|
+
- BrowserId=yLwk0BE-Ss220Wk6te85NQ;Path=/;Domain=.salesforce.com;Expires=Wed,
|
151
|
+
10-Jun-2015 01:23:55 GMT
|
152
|
+
Expires:
|
153
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
154
|
+
Sforce-Limit-Info:
|
155
|
+
- api-usage=105/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":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001LXgVAAW"},"Id":"a001a000001LXgVAAW","SystemModstamp":"2015-04-11T01:23:54.000+0000","Name":"a001a000001LXgV","Example_Field__c":null,"Friend__c":"0031a000001yZN7AAM"}]}'
|
163
|
+
http_version:
|
164
|
+
recorded_at: Sat, 11 Apr 2015 01:23:56 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%20Id%20=%20%27a001a000001LXgVAAW%27
|
168
|
+
body:
|
169
|
+
encoding: US-ASCII
|
170
|
+
string: ''
|
171
|
+
headers:
|
172
|
+
User-Agent:
|
173
|
+
- Faraday v0.9.1
|
174
|
+
Authorization:
|
175
|
+
- OAuth 00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:57 GMT
|
187
|
+
Set-Cookie:
|
188
|
+
- BrowserId=FXOhyMjuTeOqg7AeJJPytw;Path=/;Domain=.salesforce.com;Expires=Wed,
|
189
|
+
10-Jun-2015 01:23:57 GMT
|
190
|
+
Expires:
|
191
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
192
|
+
Sforce-Limit-Info:
|
193
|
+
- api-usage=105/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/a001a000001LXgVAAW"},"Id":"a001a000001LXgVAAW","SystemModstamp":"2015-04-11T01:23:54.000+0000","Name":"a001a000001LXgV","Example_Field__c":null,"Friend__c":"0031a000001yZN7AAM"}]}'
|
201
|
+
http_version:
|
202
|
+
recorded_at: Sat, 11 Apr 2015 01:23:58 GMT
|
203
|
+
- request:
|
204
|
+
method: delete
|
205
|
+
uri: https://<host>/services/data/v26.0/sobjects/Contact/0031a000001yZN7AAM
|
206
|
+
body:
|
207
|
+
encoding: US-ASCII
|
208
|
+
string: ''
|
209
|
+
headers:
|
210
|
+
User-Agent:
|
211
|
+
- Faraday v0.9.1
|
212
|
+
Authorization:
|
213
|
+
- OAuth 00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:58 GMT
|
225
|
+
Set-Cookie:
|
226
|
+
- BrowserId=UBitBTBlSxCu9Zf0gKy-Gg;Path=/;Domain=.salesforce.com;Expires=Wed,
|
227
|
+
10-Jun-2015 01:23:58 GMT
|
228
|
+
Expires:
|
229
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
230
|
+
Sforce-Limit-Info:
|
231
|
+
- api-usage=103/15000
|
232
|
+
body:
|
233
|
+
encoding: UTF-8
|
234
|
+
string: ''
|
235
|
+
http_version:
|
236
|
+
recorded_at: Sat, 11 Apr 2015 01:23:59 GMT
|
237
|
+
- request:
|
238
|
+
method: delete
|
239
|
+
uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001LXgVAAW
|
240
|
+
body:
|
241
|
+
encoding: US-ASCII
|
242
|
+
string: ''
|
243
|
+
headers:
|
244
|
+
User-Agent:
|
245
|
+
- Faraday v0.9.1
|
246
|
+
Authorization:
|
247
|
+
- OAuth 00D1a000000H3O9!AQ4AQKzh13pKuR2SlS.Cq04BnD.sliu.0jLuP2qUQvVfZBc5RaiRknImPjcZu5w_dvIzyN831OnqnR.o9XKdgX14n3l6dNnj
|
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
|
+
- Sat, 11 Apr 2015 01:23:59 GMT
|
259
|
+
Set-Cookie:
|
260
|
+
- BrowserId=i1yP-cSvQdKBCnLItTDKzw;Path=/;Domain=.salesforce.com;Expires=Wed,
|
261
|
+
10-Jun-2015 01:23:59 GMT
|
262
|
+
Expires:
|
263
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
264
|
+
Sforce-Limit-Info:
|
265
|
+
- api-usage=103/15000
|
266
|
+
body:
|
267
|
+
encoding: UTF-8
|
268
|
+
string: ''
|
269
|
+
http_version:
|
270
|
+
recorded_at: Sat, 11 Apr 2015 01:24:00 GMT
|
271
|
+
recorded_with: VCR 2.9.3
|