restforce-db 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/restforce/db/associator.rb +1 -1
  3. data/lib/restforce/db/initializer.rb +2 -2
  4. data/lib/restforce/db/instances/active_record.rb +18 -8
  5. data/lib/restforce/db/instances/salesforce.rb +9 -0
  6. data/lib/restforce/db/synchronization_error.rb +40 -0
  7. data/lib/restforce/db/synchronizer.rb +15 -9
  8. data/lib/restforce/db/version.rb +1 -1
  9. data/lib/restforce/db.rb +9 -0
  10. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml +55 -55
  11. data/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 +40 -40
  12. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_already_been_persisted/assigns_the_existing_record.yml +59 -59
  13. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml +59 -59
  14. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_association_is_non-building/proceeds_without_constructing_any_records.yml +50 -50
  15. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/with_an_unrelated_association_mapping/proceeds_without_raising_an_error.yml +59 -59
  16. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_lookups/returns_a_hash_of_the_associated_records_lookup_IDs.yml +41 -41
  17. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_lookups/when_there_is_currently_no_associated_record/and_the_underlying_association_is_one-to-many/still_returns_a_nil_lookup_value_in_the_hash.yml +20 -20
  18. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_lookups/when_there_is_currently_no_associated_record/returns_a_nil_lookup_value_in_the_hash.yml +23 -23
  19. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +58 -58
  20. data/test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +58 -58
  21. data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/builds_a_number_of_associated_records_from_the_data_in_Salesforce.yml +98 -98
  22. data/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 +40 -40
  23. data/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 +98 -98
  24. data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_associated_records_have_been_cached/uses_the_cached_records.yml +98 -98
  25. data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_association_is_non-building/proceeds_without_constructing_any_records.yml +32 -32
  26. data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +98 -98
  27. data/test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +40 -40
  28. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/and_a_nested_association_on_the_associated_mapping/recursively_builds_all_associations.yml +86 -86
  29. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml +59 -59
  30. data/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 +40 -40
  31. 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 +59 -59
  32. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_associated_record_has_been_cached/uses_the_cached_record.yml +59 -59
  33. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/when_the_association_is_non-building/proceeds_without_constructing_any_records.yml +50 -50
  34. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml +59 -59
  35. data/test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml +59 -59
  36. 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 +103 -103
  37. 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 +112 -112
  38. 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 +23 -23
  39. data/test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_record_does_not_meet_the_mapping_conditions/but_meets_conditions_for_a_parallel_mapping/does_not_drop_the_synchronized_database_record.yml +43 -45
  40. data/test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_record_does_not_meet_the_mapping_conditions/drops_the_synchronized_database_record.yml +41 -41
  41. data/test/cassettes/Restforce_DB_Cleaner/_run/given_a_synchronized_Salesforce_record/when_the_record_has_been_deleted_in_Salesforce/drops_the_synchronized_database_record.yml +20 -20
  42. 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 +41 -41
  43. data/test/cassettes/Restforce_DB_Collector/_run/given_a_Salesforce_record_with_an_associated_database_record/returns_the_attributes_from_both_records.yml +41 -41
  44. data/test/cassettes/Restforce_DB_Collector/_run/given_an_existing_Salesforce_record/returns_the_attributes_from_the_Salesforce_record.yml +41 -41
  45. data/test/cassettes/Restforce_DB_Collector/_run/given_an_existing_database_record/returns_the_attributes_from_the_database_record.yml +15 -15
  46. data/test/cassettes/Restforce_DB_Initializer/_run/given_an_existing_Salesforce_record/for_a_Passive_strategy/does_not_create_a_database_record.yml +23 -23
  47. data/test/cassettes/Restforce_DB_Initializer/_run/given_an_existing_Salesforce_record/for_an_Always_strategy/creates_a_matching_database_record.yml +32 -33
  48. data/test/cassettes/Restforce_DB_Initializer/_run/given_an_existing_database_record/for_an_Always_strategy/populates_Salesforce_with_the_new_record.yml +59 -59
  49. data/test/cassettes/Restforce_DB_Instances_Salesforce/_synced_/when_a_matching_database_record_exists/returns_true.yml +32 -32
  50. data/test/cassettes/Restforce_DB_Instances_Salesforce/_synced_/when_no_matching_database_record_exists/returns_false.yml +32 -32
  51. data/test/cassettes/Restforce_DB_Instances_Salesforce/_update_/updates_the_local_record_with_the_passed_attributes.yml +49 -49
  52. data/test/cassettes/Restforce_DB_Instances_Salesforce/_update_/updates_the_record_in_Salesforce_with_the_passed_attributes.yml +58 -58
  53. data/test/cassettes/Restforce_DB_Instances_Salesforce/_updated_internally_/when_another_user_made_the_last_change/returns_false.yml +119 -0
  54. data/test/cassettes/Restforce_DB_Instances_Salesforce/_updated_internally_/when_our_client_made_the_last_change/returns_true.yml +158 -0
  55. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_all/returns_a_list_of_the_existing_records_in_Salesforce.yml +32 -32
  56. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_create_/creates_a_record_in_Salesforce_from_the_passed_database_record_s_attributes.yml +41 -41
  57. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_create_/updates_the_database_record_with_the_Salesforce_record_s_ID.yml +41 -41
  58. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/finds_existing_records_in_Salesforce.yml +32 -32
  59. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/given_a_set_of_mapping_conditions/when_a_record_does_not_meet_the_conditions/does_not_find_the_record.yml +31 -31
  60. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/given_a_set_of_mapping_conditions/when_a_record_meets_the_conditions/finds_the_record.yml +32 -32
  61. data/test/cassettes/Restforce_DB_RecordTypes_Salesforce/_find/returns_nil_when_no_matching_record_exists.yml +14 -14
  62. data/test/cassettes/Restforce_DB_Strategies_Always/_build_/given_a_Salesforce_record/wants_to_build_a_new_matching_record.yml +32 -32
  63. data/test/cassettes/Restforce_DB_Strategies_Always/_build_/given_a_Salesforce_record/with_a_corresponding_database_record/does_not_want_to_build_a_new_record.yml +32 -32
  64. data/test/cassettes/Restforce_DB_Strategies_Associated/_build_/given_an_inverse_mapping/with_a_synchronized_association_record/wants_to_build_a_new_record.yml +59 -59
  65. 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 +50 -50
  66. 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 +59 -59
  67. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/updates_the_database_record.yml +125 -49
  68. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/updates_the_salesforce_record.yml +58 -58
  69. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_the_change_timestamp_is_stale/does_not_update_the_database_record.yml +125 -36
  70. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_the_change_timestamp_is_stale/does_not_update_the_salesforce_record.yml +44 -44
  71. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_the_changes_are_current/updates_the_database_record.yml +323 -0
  72. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_an_associated_database_record/when_the_changes_are_current/updates_the_salesforce_record.yml +286 -0
  73. data/test/cassettes/Restforce_DB_Synchronizer/_run/given_a_Salesforce_record_with_no_associated_database_record/does_nothing_for_this_specific_mapping.yml +41 -41
  74. data/test/lib/restforce/db/instances/active_record_test.rb +44 -0
  75. data/test/lib/restforce/db/instances/salesforce_test.rb +20 -0
  76. data/test/lib/restforce/db/synchronizer_test.rb +25 -13
  77. metadata +7 -2
@@ -0,0 +1,286 @@
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
+ - Mon, 08 Jun 2015 22:42:51 GMT
25
+ Set-Cookie:
26
+ - BrowserId=iSnrTfFsS_iYv-2EY4TKnQ;Path=/;Domain=.salesforce.com;Expires=Fri,
27
+ 07-Aug-2015 22:42:51 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":"1433803371519","token_type":"Bearer","instance_url":"https://<host>","signature":"9PtVYLeiEUB7sjOujiGfMl+Hs2C7n/NS5R3QTqlHkc4=","access_token":"00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz"}'
41
+ http_version:
42
+ recorded_at: Mon, 08 Jun 2015 22:42:53 GMT
43
+ - request:
44
+ method: post
45
+ uri: https://<host>/services/data/<api_version>/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!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
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
+ - Mon, 08 Jun 2015 22:42:51 GMT
67
+ Set-Cookie:
68
+ - BrowserId=7dYwV-Z7QsCzGabZnWz_bQ;Path=/;Domain=.salesforce.com;Expires=Fri,
69
+ 07-Aug-2015 22:42:51 GMT
70
+ Expires:
71
+ - Thu, 01 Jan 1970 00:00:00 GMT
72
+ Sforce-Limit-Info:
73
+ - api-usage=316/15000
74
+ Location:
75
+ - "/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cFoTAAU"
76
+ Content-Type:
77
+ - application/json;charset=UTF-8
78
+ Transfer-Encoding:
79
+ - chunked
80
+ body:
81
+ encoding: ASCII-8BIT
82
+ string: '{"id":"a001a000001cFoTAAU","success":true,"errors":[]}'
83
+ http_version:
84
+ recorded_at: Mon, 08 Jun 2015 22:42:53 GMT
85
+ - request:
86
+ method: get
87
+ uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20LastModifiedById,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001cFoTAAU%27
88
+ body:
89
+ encoding: US-ASCII
90
+ string: ''
91
+ headers:
92
+ User-Agent:
93
+ - Faraday v0.9.1
94
+ Authorization:
95
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
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
+ - Mon, 08 Jun 2015 22:42:51 GMT
107
+ Set-Cookie:
108
+ - BrowserId=O5ztTGhqREqoY4WvmNO0aQ;Path=/;Domain=.salesforce.com;Expires=Fri,
109
+ 07-Aug-2015 22:42:51 GMT
110
+ Expires:
111
+ - Thu, 01 Jan 1970 00:00:00 GMT
112
+ Sforce-Limit-Info:
113
+ - api-usage=315/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/<api_version>/sobjects/CustomObject__c/a001a000001cFoTAAU"},"Id":"a001a000001cFoTAAU","SystemModstamp":"2015-06-08T22:42:51.000+0000","LastModifiedById":"0051a000000UGT8AAO","Name":"Custom
121
+ object","Example_Field__c":"Some sample text"}]}'
122
+ http_version:
123
+ recorded_at: Mon, 08 Jun 2015 22:42:53 GMT
124
+ - request:
125
+ method: get
126
+ uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c/describe
127
+ body:
128
+ encoding: US-ASCII
129
+ string: ''
130
+ headers:
131
+ User-Agent:
132
+ - Faraday v0.9.1
133
+ Authorization:
134
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
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: 200
142
+ message: OK
143
+ headers:
144
+ Date:
145
+ - Mon, 08 Jun 2015 22:42:52 GMT
146
+ Set-Cookie:
147
+ - BrowserId=qv7ABCdLQBmLqy2oNVnBEg;Path=/;Domain=.salesforce.com;Expires=Fri,
148
+ 07-Aug-2015 22:42:52 GMT
149
+ Expires:
150
+ - Thu, 01 Jan 1970 00:00:00 GMT
151
+ Sforce-Limit-Info:
152
+ - api-usage=316/15000
153
+ Org.eclipse.jetty.server.include.etag:
154
+ - 7057c783
155
+ Last-Modified:
156
+ - Wed, 01 Apr 2015 17:47:03 GMT
157
+ Content-Type:
158
+ - application/json;charset=UTF-8
159
+ Etag:
160
+ - 7057c78-gzip"
161
+ Transfer-Encoding:
162
+ - chunked
163
+ body:
164
+ encoding: ASCII-8BIT
165
+ string: '{"activateable":false,"childRelationships":[{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","relationshipName":null,"restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContentVersion","deprecatedAndHidden":false,"field":"FirstPublishLocationId","relationshipName":null,"restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CustomObjectDetail__c","deprecatedAndHidden":false,"field":"CustomObject__c","relationshipName":"CustomObjectDetails__r","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"FeedComment","deprecatedAndHidden":false,"field":"ParentId","relationshipName":null,"restrictedDelete":false},{"cascadeDelete":true,"childSObject":"FeedItem","deprecatedAndHidden":false,"field":"ParentId","relationshipName":null,"restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","relationshipName":"TopicAssignments","restrictedDelete":false}],"compactLayoutable":true,"createable":true,"custom":true,"customSetting":false,"deletable":true,"deprecatedAndHidden":false,"feedEnabled":false,"fields":[{"autoNumber":false,"byteLength":18,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":true,"inlineHelpText":null,"label":"Record
166
+ ID","length":18,"name":"Id","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"tns:ID","sortable":true,"type":"id","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":18,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":true,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Owner
167
+ ID","length":18,"name":"OwnerId","nameField":false,"namePointing":true,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":["Group","User"],"relationshipName":"Owner","relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"tns:ID","sortable":true,"type":"reference","unique":false,"updateable":true,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":0,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Deleted","length":0,"name":"IsDeleted","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:boolean","sortable":true,"type":"boolean","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":240,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":true,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":true,"inlineHelpText":null,"label":"CustomObject
168
+ Name","length":80,"name":"Name","nameField":true,"namePointing":false,"nillable":true,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:string","sortable":true,"type":"string","unique":false,"updateable":true,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":0,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":false,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Created
169
+ Date","length":0,"name":"CreatedDate","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:dateTime","sortable":true,"type":"datetime","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":18,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Created
170
+ By ID","length":18,"name":"CreatedById","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":["User"],"relationshipName":"CreatedBy","relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"tns:ID","sortable":true,"type":"reference","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":0,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":false,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Last
171
+ Modified Date","length":0,"name":"LastModifiedDate","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:dateTime","sortable":true,"type":"datetime","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":18,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Last
172
+ Modified By ID","length":18,"name":"LastModifiedById","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":["User"],"relationshipName":"LastModifiedBy","relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"tns:ID","sortable":true,"type":"reference","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":0,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":false,"custom":false,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":false,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"System
173
+ Modstamp","length":0,"name":"SystemModstamp","nameField":false,"namePointing":false,"nillable":false,"permissionable":false,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:dateTime","sortable":true,"type":"datetime","unique":false,"updateable":false,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":765,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":true,"custom":true,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":false,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Example
174
+ Field","length":255,"name":"Example_Field__c","nameField":false,"namePointing":false,"nillable":true,"permissionable":true,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:string","sortable":true,"type":"string","unique":false,"updateable":true,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":18,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":true,"custom":true,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":false,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Friend","length":18,"name":"Friend__c","nameField":false,"namePointing":false,"nillable":true,"permissionable":true,"picklistValues":[],"precision":0,"referenceTo":["Contact"],"relationshipName":"Friend__r","relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"tns:ID","sortable":true,"type":"reference","unique":false,"updateable":true,"writeRequiresMasterRead":false},{"autoNumber":false,"byteLength":0,"calculated":false,"calculatedFormula":null,"cascadeDelete":false,"caseSensitive":false,"controllerName":null,"createable":true,"custom":true,"defaultValue":null,"defaultValueFormula":null,"defaultedOnCreate":true,"dependentPicklist":false,"deprecatedAndHidden":false,"digits":0,"displayLocationInDecimal":false,"externalId":false,"filterable":true,"groupable":true,"htmlFormatted":false,"idLookup":false,"inlineHelpText":null,"label":"Visible","length":0,"name":"Visible__c","nameField":false,"namePointing":false,"nillable":false,"permissionable":true,"picklistValues":[],"precision":0,"referenceTo":[],"relationshipName":null,"relationshipOrder":null,"restrictedDelete":false,"restrictedPicklist":false,"scale":0,"soapType":"xsd:boolean","sortable":true,"type":"boolean","unique":false,"updateable":true,"writeRequiresMasterRead":false}],"keyPrefix":"a00","label":"CustomObject","labelPlural":"CustomObjects","layoutable":true,"listviewable":null,"lookupLayoutable":null,"mergeable":false,"name":"CustomObject__c","queryable":true,"recordTypeInfos":[{"available":true,"defaultRecordTypeMapping":true,"name":"Master","recordTypeId":"012000000000000AAA","urls":{"layout":"/services/data/<api_version>/sobjects/CustomObject__c/describe/layouts/012000000000000AAA"}}],"replicateable":true,"retrieveable":true,"searchLayoutable":true,"searchable":true,"triggerable":true,"undeletable":true,"updateable":true,"urls":{"uiEditTemplate":"https://<host>/{ID}/e","sobject":"/services/data/<api_version>/sobjects/CustomObject__c","quickActions":"/services/data/<api_version>/sobjects/CustomObject__c/quickActions","uiDetailTemplate":"https://<host>/{ID}","describe":"/services/data/<api_version>/sobjects/CustomObject__c/describe","rowTemplate":"/services/data/<api_version>/sobjects/CustomObject__c/{ID}","layouts":"/services/data/<api_version>/sobjects/CustomObject__c/describe/layouts","compactLayouts":"/services/data/<api_version>/sobjects/CustomObject__c/describe/compactLayouts","uiNewRecord":"https://<host>/a00/e"}}'
175
+ http_version:
176
+ recorded_at: Mon, 08 Jun 2015 22:42:53 GMT
177
+ - request:
178
+ method: patch
179
+ uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cFoTAAU
180
+ body:
181
+ encoding: UTF-8
182
+ string: '{"Name":"Some new name","Example_Field__c":"New sample text"}'
183
+ headers:
184
+ User-Agent:
185
+ - Faraday v0.9.1
186
+ Content-Type:
187
+ - application/json
188
+ Authorization:
189
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
190
+ Accept-Encoding:
191
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
192
+ Accept:
193
+ - "*/*"
194
+ response:
195
+ status:
196
+ code: 204
197
+ message: No Content
198
+ headers:
199
+ Date:
200
+ - Mon, 08 Jun 2015 22:42:52 GMT
201
+ Set-Cookie:
202
+ - BrowserId=z1zczRTBQbyWffgRowSvKA;Path=/;Domain=.salesforce.com;Expires=Fri,
203
+ 07-Aug-2015 22:42:52 GMT
204
+ Expires:
205
+ - Thu, 01 Jan 1970 00:00:00 GMT
206
+ Sforce-Limit-Info:
207
+ - api-usage=315/15000
208
+ body:
209
+ encoding: UTF-8
210
+ string: ''
211
+ http_version:
212
+ recorded_at: Mon, 08 Jun 2015 22:42:53 GMT
213
+ - request:
214
+ method: get
215
+ uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20LastModifiedById,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001cFoTAAU%27
216
+ body:
217
+ encoding: US-ASCII
218
+ string: ''
219
+ headers:
220
+ User-Agent:
221
+ - Faraday v0.9.1
222
+ Authorization:
223
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
224
+ Accept-Encoding:
225
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
226
+ Accept:
227
+ - "*/*"
228
+ response:
229
+ status:
230
+ code: 200
231
+ message: OK
232
+ headers:
233
+ Date:
234
+ - Mon, 08 Jun 2015 22:42:52 GMT
235
+ Set-Cookie:
236
+ - BrowserId=inhP3vErToS89ZKvIAKA8w;Path=/;Domain=.salesforce.com;Expires=Fri,
237
+ 07-Aug-2015 22:42:52 GMT
238
+ Expires:
239
+ - Thu, 01 Jan 1970 00:00:00 GMT
240
+ Sforce-Limit-Info:
241
+ - api-usage=315/15000
242
+ Content-Type:
243
+ - application/json;charset=UTF-8
244
+ Transfer-Encoding:
245
+ - chunked
246
+ body:
247
+ encoding: ASCII-8BIT
248
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cFoTAAU"},"Id":"a001a000001cFoTAAU","SystemModstamp":"2015-06-08T22:42:52.000+0000","LastModifiedById":"0051a000000UGT8AAO","Name":"Some
249
+ new name","Example_Field__c":"New sample text"}]}'
250
+ http_version:
251
+ recorded_at: Mon, 08 Jun 2015 22:42:54 GMT
252
+ - request:
253
+ method: delete
254
+ uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cFoTAAU
255
+ body:
256
+ encoding: US-ASCII
257
+ string: ''
258
+ headers:
259
+ User-Agent:
260
+ - Faraday v0.9.1
261
+ Authorization:
262
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
263
+ Accept-Encoding:
264
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
265
+ Accept:
266
+ - "*/*"
267
+ response:
268
+ status:
269
+ code: 204
270
+ message: No Content
271
+ headers:
272
+ Date:
273
+ - Mon, 08 Jun 2015 22:42:52 GMT
274
+ Set-Cookie:
275
+ - BrowserId=-myIAmnaRcSL5fxa59Twvw;Path=/;Domain=.salesforce.com;Expires=Fri,
276
+ 07-Aug-2015 22:42:52 GMT
277
+ Expires:
278
+ - Thu, 01 Jan 1970 00:00:00 GMT
279
+ Sforce-Limit-Info:
280
+ - api-usage=317/15000
281
+ body:
282
+ encoding: UTF-8
283
+ string: ''
284
+ http_version:
285
+ recorded_at: Mon, 08 Jun 2015 22:42:54 GMT
286
+ recorded_with: VCR 2.9.3
@@ -21,10 +21,10 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Fri, 10 Apr 2015 18:16:05 GMT
24
+ - Mon, 08 Jun 2015 22:12:19 GMT
25
25
  Set-Cookie:
26
- - BrowserId=pcw4QakVSumA7tABeMs79A;Path=/;Domain=.salesforce.com;Expires=Tue,
27
- 09-Jun-2015 18:16:05 GMT
26
+ - BrowserId=bfcKIwigRaCCAUYsRqbrJA;Path=/;Domain=.salesforce.com;Expires=Fri,
27
+ 07-Aug-2015 22:12:19 GMT
28
28
  Expires:
29
29
  - Thu, 01 Jan 1970 00:00:00 GMT
30
30
  Pragma:
@@ -37,9 +37,9 @@ http_interactions:
37
37
  - chunked
38
38
  body:
39
39
  encoding: ASCII-8BIT
40
- string: '{"id":"https://login.salesforce.com/id/00D1a000000H3O9EAK/0051a000000UGT8AAO","issued_at":"1428689765521","token_type":"Bearer","instance_url":"https://<host>","signature":"iVn8K79ySw/26GQM8/ZHlQ7tE1l2EUH+WGphHVWkQFg=","access_token":"00D1a000000H3O9!AQ4AQO48p7VCPJTqs85KtBx3kEBjPhP.lCvkGK3ayiFCcg2H2nbFwdKZaBetwWzVAndOSywkSvoT7_YZEmwLnhtbJ1A3E5NZ"}'
41
- http_version:
42
- recorded_at: Fri, 10 Apr 2015 18:16:05 GMT
40
+ string: '{"id":"https://login.salesforce.com/id/00D1a000000H3O9EAK/0051a000000UGT8AAO","issued_at":"1433801539774","token_type":"Bearer","instance_url":"https://<host>","signature":"zuuyrTiCjqR3OlEVII57V+9sykZ8S2+APFACft4wui0=","access_token":"00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz"}'
41
+ http_version:
42
+ recorded_at: Mon, 08 Jun 2015 22:12:21 GMT
43
43
  - request:
44
44
  method: post
45
45
  uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c
@@ -52,7 +52,7 @@ http_interactions:
52
52
  Content-Type:
53
53
  - application/json
54
54
  Authorization:
55
- - OAuth 00D1a000000H3O9!AQ4AQO48p7VCPJTqs85KtBx3kEBjPhP.lCvkGK3ayiFCcg2H2nbFwdKZaBetwWzVAndOSywkSvoT7_YZEmwLnhtbJ1A3E5NZ
55
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
56
56
  Accept-Encoding:
57
57
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
58
58
  Accept:
@@ -63,28 +63,28 @@ http_interactions:
63
63
  message: Created
64
64
  headers:
65
65
  Date:
66
- - Fri, 10 Apr 2015 18:16:05 GMT
66
+ - Mon, 08 Jun 2015 22:12:19 GMT
67
67
  Set-Cookie:
68
- - BrowserId=I0vlITthQ-GdMURdX_Eu4A;Path=/;Domain=.salesforce.com;Expires=Tue,
69
- 09-Jun-2015 18:16:05 GMT
68
+ - BrowserId=6Wf1sZNMQxO8NW99U3oF3A;Path=/;Domain=.salesforce.com;Expires=Fri,
69
+ 07-Aug-2015 22:12:19 GMT
70
70
  Expires:
71
71
  - Thu, 01 Jan 1970 00:00:00 GMT
72
72
  Sforce-Limit-Info:
73
- - api-usage=58/15000
73
+ - api-usage=6/15000
74
74
  Location:
75
- - "/services/data/<api_version>/sobjects/CustomObject__c/a001a000001LXBfAAO"
75
+ - "/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cF4WAAU"
76
76
  Content-Type:
77
77
  - application/json;charset=UTF-8
78
78
  Transfer-Encoding:
79
79
  - chunked
80
80
  body:
81
81
  encoding: ASCII-8BIT
82
- string: '{"id":"a001a000001LXBfAAO","success":true,"errors":[]}'
83
- http_version:
84
- recorded_at: Fri, 10 Apr 2015 18:16:05 GMT
82
+ string: '{"id":"a001a000001cF4WAAU","success":true,"errors":[]}'
83
+ http_version:
84
+ recorded_at: Mon, 08 Jun 2015 22:12:21 GMT
85
85
  - request:
86
86
  method: get
87
- uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001LXBfAAO%27
87
+ uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20LastModifiedById,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001cF4WAAU%27
88
88
  body:
89
89
  encoding: US-ASCII
90
90
  string: ''
@@ -92,7 +92,7 @@ http_interactions:
92
92
  User-Agent:
93
93
  - Faraday v0.9.1
94
94
  Authorization:
95
- - OAuth 00D1a000000H3O9!AQ4AQO48p7VCPJTqs85KtBx3kEBjPhP.lCvkGK3ayiFCcg2H2nbFwdKZaBetwWzVAndOSywkSvoT7_YZEmwLnhtbJ1A3E5NZ
95
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
96
96
  Accept-Encoding:
97
97
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
98
98
  Accept:
@@ -103,27 +103,27 @@ http_interactions:
103
103
  message: OK
104
104
  headers:
105
105
  Date:
106
- - Fri, 10 Apr 2015 18:16:05 GMT
106
+ - Mon, 08 Jun 2015 22:12:20 GMT
107
107
  Set-Cookie:
108
- - BrowserId=KoiOz0-gSYiQzd8NJ4uMRQ;Path=/;Domain=.salesforce.com;Expires=Tue,
109
- 09-Jun-2015 18:16:05 GMT
108
+ - BrowserId=ZUuh75WBTc2uJK9qLmI_Jw;Path=/;Domain=.salesforce.com;Expires=Fri,
109
+ 07-Aug-2015 22:12:20 GMT
110
110
  Expires:
111
111
  - Thu, 01 Jan 1970 00:00:00 GMT
112
112
  Sforce-Limit-Info:
113
- - api-usage=58/15000
113
+ - api-usage=8/15000
114
114
  Content-Type:
115
115
  - application/json;charset=UTF-8
116
116
  Transfer-Encoding:
117
117
  - chunked
118
118
  body:
119
119
  encoding: ASCII-8BIT
120
- string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/<api_version>/sobjects/CustomObject__c/a001a000001LXBfAAO"},"Id":"a001a000001LXBfAAO","SystemModstamp":"2015-04-10T18:16:05.000+0000","Name":"Custom
120
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cF4WAAU"},"Id":"a001a000001cF4WAAU","SystemModstamp":"2015-06-08T22:12:19.000+0000","LastModifiedById":"0051a000000UGT8AAO","Name":"Custom
121
121
  object","Example_Field__c":"Some sample text"}]}'
122
- http_version:
123
- recorded_at: Fri, 10 Apr 2015 18:16:05 GMT
122
+ http_version:
123
+ recorded_at: Mon, 08 Jun 2015 22:12:21 GMT
124
124
  - request:
125
125
  method: get
126
- uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001LXBfAAO%27
126
+ uri: https://<host>/services/data/<api_version>/query?q=select%20Id,%20SystemModstamp,%20LastModifiedById,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001cF4WAAU%27
127
127
  body:
128
128
  encoding: US-ASCII
129
129
  string: ''
@@ -131,7 +131,7 @@ http_interactions:
131
131
  User-Agent:
132
132
  - Faraday v0.9.1
133
133
  Authorization:
134
- - OAuth 00D1a000000H3O9!AQ4AQO48p7VCPJTqs85KtBx3kEBjPhP.lCvkGK3ayiFCcg2H2nbFwdKZaBetwWzVAndOSywkSvoT7_YZEmwLnhtbJ1A3E5NZ
134
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
135
135
  Accept-Encoding:
136
136
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
137
137
  Accept:
@@ -142,27 +142,27 @@ http_interactions:
142
142
  message: OK
143
143
  headers:
144
144
  Date:
145
- - Fri, 10 Apr 2015 18:16:06 GMT
145
+ - Mon, 08 Jun 2015 22:12:20 GMT
146
146
  Set-Cookie:
147
- - BrowserId=GS8k_s93SVmx-JpXvfVjPQ;Path=/;Domain=.salesforce.com;Expires=Tue,
148
- 09-Jun-2015 18:16:06 GMT
147
+ - BrowserId=vCkQaDr4SOG6fPNGhW82Ew;Path=/;Domain=.salesforce.com;Expires=Fri,
148
+ 07-Aug-2015 22:12:20 GMT
149
149
  Expires:
150
150
  - Thu, 01 Jan 1970 00:00:00 GMT
151
151
  Sforce-Limit-Info:
152
- - api-usage=58/15000
152
+ - api-usage=6/15000
153
153
  Content-Type:
154
154
  - application/json;charset=UTF-8
155
155
  Transfer-Encoding:
156
156
  - chunked
157
157
  body:
158
158
  encoding: ASCII-8BIT
159
- string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/<api_version>/sobjects/CustomObject__c/a001a000001LXBfAAO"},"Id":"a001a000001LXBfAAO","SystemModstamp":"2015-04-10T18:16:05.000+0000","Name":"Custom
159
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cF4WAAU"},"Id":"a001a000001cF4WAAU","SystemModstamp":"2015-06-08T22:12:19.000+0000","LastModifiedById":"0051a000000UGT8AAO","Name":"Custom
160
160
  object","Example_Field__c":"Some sample text"}]}'
161
- http_version:
162
- recorded_at: Fri, 10 Apr 2015 18:16:06 GMT
161
+ http_version:
162
+ recorded_at: Mon, 08 Jun 2015 22:12:21 GMT
163
163
  - request:
164
164
  method: delete
165
- uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c/a001a000001LXBfAAO
165
+ uri: https://<host>/services/data/<api_version>/sobjects/CustomObject__c/a001a000001cF4WAAU
166
166
  body:
167
167
  encoding: US-ASCII
168
168
  string: ''
@@ -170,7 +170,7 @@ http_interactions:
170
170
  User-Agent:
171
171
  - Faraday v0.9.1
172
172
  Authorization:
173
- - OAuth 00D1a000000H3O9!AQ4AQO48p7VCPJTqs85KtBx3kEBjPhP.lCvkGK3ayiFCcg2H2nbFwdKZaBetwWzVAndOSywkSvoT7_YZEmwLnhtbJ1A3E5NZ
173
+ - OAuth 00D1a000000H3O9!AQ4AQH0rZGqBVji7vO4sB8J1_YW.g5S2vIbe9IaUgwHpwLPEdpfIcj9Ngpc2CndFvJZMwVIIp15.yQQOil19Qc2MuedbnlQz
174
174
  Accept-Encoding:
175
175
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
176
176
  Accept:
@@ -181,17 +181,17 @@ http_interactions:
181
181
  message: No Content
182
182
  headers:
183
183
  Date:
184
- - Fri, 10 Apr 2015 18:16:09 GMT
184
+ - Mon, 08 Jun 2015 22:12:20 GMT
185
185
  Set-Cookie:
186
- - BrowserId=KJPi4MJTQ0mr8dA2ahBjEw;Path=/;Domain=.salesforce.com;Expires=Tue,
187
- 09-Jun-2015 18:16:09 GMT
186
+ - BrowserId=mRxeH9KIQomK7xd4NS4Zjg;Path=/;Domain=.salesforce.com;Expires=Fri,
187
+ 07-Aug-2015 22:12:20 GMT
188
188
  Expires:
189
189
  - Thu, 01 Jan 1970 00:00:00 GMT
190
190
  Sforce-Limit-Info:
191
- - api-usage=58/15000
191
+ - api-usage=7/15000
192
192
  body:
193
193
  encoding: UTF-8
194
194
  string: ''
195
- http_version:
196
- recorded_at: Fri, 10 Apr 2015 18:16:09 GMT
195
+ http_version:
196
+ recorded_at: Mon, 08 Jun 2015 22:12:22 GMT
197
197
  recorded_with: VCR 2.9.3
@@ -10,6 +10,27 @@ describe Restforce::DB::Instances::ActiveRecord do
10
10
  Restforce::DB::Instances::ActiveRecord.new(database_model, record, mapping)
11
11
  end
12
12
 
13
+ describe "#id" do
14
+
15
+ describe "when the record has no synchronized Salesforce ID" do
16
+
17
+ it "returns the record's ID" do
18
+ expect(instance.id).to_equal "CustomObject::#{record.id}"
19
+ end
20
+ end
21
+
22
+ describe "when the record has a synchronized Salesforce ID" do
23
+ let(:salesforce_id) { "a001a000001E1vREAL" }
24
+ before do
25
+ record.update!(salesforce_id: salesforce_id)
26
+ end
27
+
28
+ it "returns the Salesforce ID" do
29
+ expect(instance.id).to_equal salesforce_id
30
+ end
31
+ end
32
+ end
33
+
13
34
  describe "#update!" do
14
35
  let(:text) { "Some new text" }
15
36
 
@@ -29,4 +50,27 @@ describe Restforce::DB::Instances::ActiveRecord do
29
50
  expect(record.reload.synchronized_at).to_not_be_nil
30
51
  end
31
52
  end
53
+
54
+ describe "#updated_internally?" do
55
+
56
+ describe "when updated_at exceeds synchronized_at" do
57
+ before do
58
+ record.update!(synchronized_at: Time.now - 2)
59
+ end
60
+
61
+ it "returns false" do
62
+ expect(instance).to_not_be :updated_internally?
63
+ end
64
+ end
65
+
66
+ describe "when synchronized_at meets or exceeds updated_at" do
67
+ before do
68
+ record.touch(:synchronized_at)
69
+ end
70
+
71
+ it "returns true" do
72
+ expect(instance).to_be :updated_internally?
73
+ end
74
+ end
75
+ end
32
76
  end
@@ -54,4 +54,24 @@ describe Restforce::DB::Instances::Salesforce do
54
54
  end
55
55
  end
56
56
 
57
+ describe "#updated_internally?", :vcr do
58
+
59
+ describe "when our client made the last change" do
60
+
61
+ it "returns true" do
62
+ expect(instance).to_be :updated_internally?
63
+ end
64
+ end
65
+
66
+ describe "when another user made the last change" do
67
+ let(:user_id) { "a001a000001E1vFAKE" }
68
+ let(:record) { Struct.new(:LastModifiedById).new(user_id) }
69
+ let(:instance) { Restforce::DB::Instances::Salesforce.new(salesforce_model, record) }
70
+
71
+ it "returns false" do
72
+ expect(instance).to_not_be :updated_internally?
73
+ end
74
+ end
75
+ end
76
+
57
77
  end
@@ -53,23 +53,25 @@ describe Restforce::DB::Synchronizer do
53
53
  database_model.create!(database_attributes.merge(salesforce_id: salesforce_id))
54
54
  end
55
55
 
56
- before do
57
- database_record
58
- synchronizer.run(changes)
59
- end
56
+ describe "when the changes are current" do
57
+ before do
58
+ database_record
59
+ synchronizer.run(changes)
60
+ end
60
61
 
61
- it "updates the database record" do
62
- record = database_record.reload
62
+ it "updates the database record" do
63
+ record = database_record.reload
63
64
 
64
- expect(record.name).to_equal new_attributes["Name"]
65
- expect(record.example).to_equal new_attributes["Example_Field__c"]
66
- end
65
+ expect(record.name).to_equal new_attributes["Name"]
66
+ expect(record.example).to_equal new_attributes["Example_Field__c"]
67
+ end
67
68
 
68
- it "updates the salesforce record" do
69
- record = mapping.salesforce_record_type.find(salesforce_id).record
69
+ it "updates the salesforce record" do
70
+ record = mapping.salesforce_record_type.find(salesforce_id).record
70
71
 
71
- expect(record.Name).to_equal new_attributes["Name"]
72
- expect(record.Example_Field__c).to_equal new_attributes["Example_Field__c"]
72
+ expect(record.Name).to_equal new_attributes["Name"]
73
+ expect(record.Example_Field__c).to_equal new_attributes["Example_Field__c"]
74
+ end
73
75
  end
74
76
 
75
77
  describe "when the change timestamp is stale" do
@@ -77,6 +79,16 @@ describe Restforce::DB::Synchronizer do
77
79
  mapping.salesforce_record_type.find(salesforce_id).last_update - 1
78
80
  end
79
81
 
82
+ before do
83
+ database_record
84
+
85
+ Restforce::DB::Instances::ActiveRecord.stub_any_instance(:updated_internally?, false) do
86
+ Restforce::DB::Instances::Salesforce.stub_any_instance(:updated_internally?, false) do
87
+ synchronizer.run(changes)
88
+ end
89
+ end
90
+ end
91
+
80
92
  it "does not update the database record" do
81
93
  record = database_record.reload
82
94