restforce 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of restforce might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -3
- data/lib/restforce/concerns/api.rb +20 -0
- data/lib/restforce/version.rb +1 -1
- data/spec/fixtures/sobject/get_deleted_success_response.json +11 -0
- data/spec/integration/abstract_client_spec.rb +11 -0
- data/spec/unit/concerns/api_spec.rb +16 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffde6a2ff06c51931a6bab34f4d1f65cca529dab
|
4
|
+
data.tar.gz: fe9a373b83dbfef51434a2045c4dfa698094d0fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2215c530292416152291284e81842411a02cc9e19a29b1e08ce745a63d53abb9fd68cea37f13b52138849e537c57aa255c80562c6a0a78062469541e3b74e2d
|
7
|
+
data.tar.gz: 09a8ae9879b0dca63e789f6bdb8ffdd9d2c92f9a297fcbafe051f240ff5c0a01c58108cf796d2b11791025b8922e34f53c4d61d4350d082d3a91a549b051ae73
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 2.2.1 (Jun 6, 2016)
|
2
|
+
|
3
|
+
* Added support for `get_deleted` call (@adambird)
|
4
|
+
|
1
5
|
## 2.2.0 (Mar 16, 2016)
|
2
6
|
|
3
7
|
* Raise a `Faraday::Error::ClientError` for `300` responses triggered by a conflicting external ID, providing access to the response, which contains an array of the conflicting IDs (@timrogers, @michaelminter)
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ If you're using the gem to interact with a single org (maybe you're building som
|
|
56
56
|
salesforce integration internally?) then you should use the username/password
|
57
57
|
authentication method.
|
58
58
|
|
59
|
-
It is also important to note that the client object should not be reused across different threads, otherwise you may encounter thread-safety issues.
|
59
|
+
It is also important to note that the client object should not be reused across different threads, otherwise you may encounter [thread-safety issues](https://www.youtube.com/watch?v=p5zQOkyCACc).
|
60
60
|
|
61
61
|
#### OAuth token authentication
|
62
62
|
|
@@ -172,7 +172,7 @@ You can change the `api_version` setting from the default either on a per-client
|
|
172
172
|
client = Restforce.new api_version: "32.0" # ...
|
173
173
|
```
|
174
174
|
|
175
|
-
or, you may set it globally for
|
175
|
+
or, you may set it globally for Restforce as a whole:
|
176
176
|
|
177
177
|
```ruby
|
178
178
|
Restforce.configure do |config|
|
@@ -380,6 +380,18 @@ client.get_updated('Account', Time.local(2015,8,18), Time.local(2015,8,19))
|
|
380
380
|
|
381
381
|
* * *
|
382
382
|
|
383
|
+
### get_deleted
|
384
|
+
|
385
|
+
Retrieves the list of IDs and time of deletion for records that have been deleted within the given timespan for the specified object
|
386
|
+
|
387
|
+
```ruby
|
388
|
+
# Get the list of accounts which have been deleted in the last day
|
389
|
+
client.get_deleted('Account', Time.local(2015,8,18), Time.local(2015,8,19))
|
390
|
+
# => { ... }
|
391
|
+
```
|
392
|
+
|
393
|
+
* * *
|
394
|
+
|
383
395
|
### authenticate!
|
384
396
|
|
385
397
|
Performs an authentication and returns the response. In general, calling this
|
@@ -408,7 +420,7 @@ Using the new [Blob Data](http://www.salesforce.com/us/developer/docs/api_rest/C
|
|
408
420
|
client.create 'Document', FolderId: '00lE0000000FJ6H',
|
409
421
|
Description: 'Document test',
|
410
422
|
Name: 'My image',
|
411
|
-
Body: Restforce::UploadIO.new(File.expand_path('image.jpg', __FILE__), 'image/jpeg')
|
423
|
+
Body: Restforce::UploadIO.new(File.expand_path('image.jpg', __FILE__), 'image/jpeg')
|
412
424
|
```
|
413
425
|
|
414
426
|
Using base64 encoded data (37.5mb limit):
|
@@ -84,6 +84,26 @@ module Restforce
|
|
84
84
|
api_get(url).body
|
85
85
|
end
|
86
86
|
|
87
|
+
# Public: Gets the IDs of sobjects of type [sobject]
|
88
|
+
# which have been deleted between startDateTime and endDateTime.
|
89
|
+
#
|
90
|
+
# Examples
|
91
|
+
#
|
92
|
+
# # get deleted sobject Whizbangs between yesterday and today
|
93
|
+
# startDate = Time.new(2002, 10, 31, 2, 2, 2, "+02:00")
|
94
|
+
# endDate = Time.new(2002, 11, 1, 2, 2, 2, "+02:00")
|
95
|
+
# client.get_deleted('Whizbang', startDate, endDate)
|
96
|
+
#
|
97
|
+
# Returns a Restforce::Collection if Restforce.configuration.mashify is true.
|
98
|
+
# Returns an Array of Hash for each record in the result if
|
99
|
+
# Restforce.configuration.mashify is false.
|
100
|
+
def get_deleted(sobject, start_time, end_time)
|
101
|
+
start_time = start_time.utc.iso8601
|
102
|
+
end_time = end_time.utc.iso8601
|
103
|
+
url = "/sobjects/#{sobject}/deleted/?start=#{start_time}&end=#{end_time}"
|
104
|
+
api_get(url).body
|
105
|
+
end
|
106
|
+
|
87
107
|
# Public: Returns a detailed describe result for the specified sobject
|
88
108
|
#
|
89
109
|
# sobject - Stringish name of the sobject (default: nil).
|
data/lib/restforce/version.rb
CHANGED
@@ -45,6 +45,17 @@ shared_examples_for Restforce::AbstractClient do
|
|
45
45
|
it { should be_an Enumerable }
|
46
46
|
end
|
47
47
|
|
48
|
+
describe '.get_deleted' do
|
49
|
+
let(:start_date) { Time.new(2015, 8, 17, 0, 0, 0, "+02:00") }
|
50
|
+
let(:end_date) { Time.new(2016, 8, 19, 0, 0, 0, "+02:00") }
|
51
|
+
end_string = '2016-08-18T22:00:00Z'
|
52
|
+
start_string = '2015-08-16T22:00:00Z'
|
53
|
+
requests "sobjects/Whizbang/deleted/\\?end=#{end_string}&start=#{start_string}",
|
54
|
+
fixture: 'sobject/get_deleted_success_response'
|
55
|
+
subject { client.get_deleted('Whizbang', start_date, end_date) }
|
56
|
+
it { should be_an Enumerable }
|
57
|
+
end
|
58
|
+
|
48
59
|
describe '.search' do
|
49
60
|
requests 'search\?q=FIND%20%7Bbar%7D', fixture: 'sobject/search_success_response'
|
50
61
|
|
@@ -35,6 +35,22 @@ describe Restforce::Concerns::API do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe '.get_deleted' do
|
39
|
+
let(:start_date_time) { Time.new(2002, 10, 31, 2, 2, 2, "+02:00") }
|
40
|
+
let(:end_date_time) { Time.new(2003, 10, 31, 2, 2, 2, "+02:00") }
|
41
|
+
let(:sobject) { 'Whizbang' }
|
42
|
+
subject(:results) { client.get_deleted(sobject, start_date_time, end_date_time) }
|
43
|
+
it 'returns the body' do
|
44
|
+
start_string = '2002-10-31T00:02:02Z'
|
45
|
+
end_string = '2003-10-31T00:02:02Z'
|
46
|
+
url = "/sobjects/Whizbang/deleted/?start=#{start_string}&end=#{end_string}"
|
47
|
+
client.should_receive(:api_get).
|
48
|
+
with(url).
|
49
|
+
and_return(response)
|
50
|
+
expect(results).to eq response.body
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
38
54
|
describe '.list_sobjects' do
|
39
55
|
subject { client.list_sobjects }
|
40
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric J. Holmes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- spec/fixtures/sobject/create_success_response.json
|
222
222
|
- spec/fixtures/sobject/delete_error_response.json
|
223
223
|
- spec/fixtures/sobject/describe_sobjects_success_response.json
|
224
|
+
- spec/fixtures/sobject/get_deleted_success_response.json
|
224
225
|
- spec/fixtures/sobject/get_updated_success_response.json
|
225
226
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
226
227
|
- spec/fixtures/sobject/org_query_response.json
|
@@ -314,6 +315,7 @@ test_files:
|
|
314
315
|
- spec/fixtures/sobject/create_success_response.json
|
315
316
|
- spec/fixtures/sobject/delete_error_response.json
|
316
317
|
- spec/fixtures/sobject/describe_sobjects_success_response.json
|
318
|
+
- spec/fixtures/sobject/get_deleted_success_response.json
|
317
319
|
- spec/fixtures/sobject/get_updated_success_response.json
|
318
320
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
319
321
|
- spec/fixtures/sobject/org_query_response.json
|