restforce 2.1.0 → 2.1.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 +5 -0
- data/README.md +15 -3
- data/lib/restforce/concerns/api.rb +20 -0
- data/lib/restforce/middleware/authentication.rb +1 -1
- data/lib/restforce/version.rb +1 -1
- data/spec/fixtures/sobject/get_updated_success_response.json +12 -0
- data/spec/integration/abstract_client_spec.rb +11 -0
- data/spec/unit/concerns/api_spec.rb +16 -0
- data/spec/unit/middleware/authentication/password_spec.rb +2 -1
- data/spec/unit/middleware/authentication/token_spec.rb +2 -1
- data/spec/unit/middleware/authentication_spec.rb +12 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c933281225117c041f54a23bd3141f5c8d1f9e8d
|
4
|
+
data.tar.gz: 153b2c10c1dca6035afb0675d5ebeab94ce27df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac6beab45f4f1819edbb8f58195c9a6b9e085cc5dfb9fce2903231fe6bed89a3da30e142053b86860e7636ec7d331424cd0f9c3e5b29b6692bc3a5e1fd1b145
|
7
|
+
data.tar.gz: aa9bcae26b2041087aa53d81ee27b77d3b224f54f8e0732a54b8a0210680aaaf33f174aa35666599646e49cbf96d56d272b43c18b77eb9c2f8caa9b85f531089
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 2.1.1 (Aug 20, 2015)
|
2
|
+
|
3
|
+
* Added support for `get_updated` call (@web-connect)
|
4
|
+
* Respect Faraday adapter option in authentication middleware (@stenlarsson)
|
5
|
+
|
1
6
|
## 2.1.0 (Jun 29, 2015)
|
2
7
|
|
3
8
|
* Added support for `query_all`, `explain` and `limits` API calls (which require a newer `api_version` than the default of 26.0) (@theSteveMitchell, @zenchild)
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Restforce
|
2
2
|
|
3
3
|
[![travis-ci](https://travis-ci.org/ejholmes/restforce.png?branch=master)](https://travis-ci.org/ejholmes/restforce) [![Code Climate](https://codeclimate.com/github/ejholmes/restforce.png)](https://codeclimate.com/github/ejholmes/restforce) [![Dependency Status](https://gemnasium.com/ejholmes/restforce.png)](https://gemnasium.com/ejholmes/restforce)
|
4
|
+
![](https://img.shields.io/gem/dt/restforce.svg)
|
4
5
|
|
5
6
|
Restforce is a ruby gem for the [Salesforce REST api](http://www.salesforce.com/us/developer/docs/api_rest/index.htm).
|
6
7
|
It's meant to be a lighter weight alternative to the [databasedotcom gem](https://github.com/heroku/databasedotcom) that offers
|
@@ -13,6 +14,7 @@ Features include:
|
|
13
14
|
* Support for parent-to-child relationships.
|
14
15
|
* Support for aggregate queries.
|
15
16
|
* Support for the [Streaming API](#streaming)
|
17
|
+
* Support for the GetUpdated API
|
16
18
|
* Support for blob data types.
|
17
19
|
* Support for GZIP compression.
|
18
20
|
* Support for [custom Apex REST endpoints](#custom-apex-rest-endpoints).
|
@@ -345,6 +347,18 @@ limits["DailyApiRequests"]
|
|
345
347
|
|
346
348
|
* * *
|
347
349
|
|
350
|
+
### get_updated
|
351
|
+
|
352
|
+
Retrieves the list of individual record IDs that have been updated (added or changed) within the given timespan for the specified object
|
353
|
+
|
354
|
+
```ruby
|
355
|
+
# Get the ids of all accounts which have been updated in the last day
|
356
|
+
client.get_updated('Account', Time.local(2015,8,18) Time.local(2015,8,19))
|
357
|
+
# => { ... }
|
358
|
+
```
|
359
|
+
|
360
|
+
* * *
|
361
|
+
|
348
362
|
### authenticate!
|
349
363
|
|
350
364
|
Performs an authentication and returns the response. In general, calling this
|
@@ -587,6 +601,4 @@ Using the scripts in `./script` instead of `bundle exec rspec`, `bundle console`
|
|
587
601
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
588
602
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
589
603
|
4. Push to the branch (`git push origin my-new-feature`)
|
590
|
-
5. Create new Pull Request
|
591
|
-
|
592
|
-
[Restforce::Collection]: https://github.com/ejholmes/restforce/blob/master/lib/restforce/collection.rb "Restforce::Collection"
|
604
|
+
5. Create new Pull Request
|
@@ -64,6 +64,26 @@ module Restforce
|
|
64
64
|
version_guard(29.0) { api_get("limits").body }
|
65
65
|
end
|
66
66
|
|
67
|
+
# Public: Gets the IDs of sobjects of type [sobject]
|
68
|
+
# which have changed between startDateTime and endDateTime.
|
69
|
+
#
|
70
|
+
# Examples
|
71
|
+
#
|
72
|
+
# # get changes for sobject Whizbang between yesterday and today
|
73
|
+
# startDate = Time.new(2002, 10, 31, 2, 2, 2, "+02:00")
|
74
|
+
# endDate = Time.new(2002, 11, 1, 2, 2, 2, "+02:00")
|
75
|
+
# client.get_updated('Whizbang', startDate, endDate)
|
76
|
+
#
|
77
|
+
# Returns a Restforce::Collection if Restforce.configuration.mashify is true.
|
78
|
+
# Returns an Array of Hash for each record in the result if
|
79
|
+
# Restforce.configuration.mashify is false.
|
80
|
+
def get_updated(sobject, start_time, end_time)
|
81
|
+
start_time = start_time.utc.iso8601
|
82
|
+
end_time = end_time.utc.iso8601
|
83
|
+
url = "/sobjects/#{sobject}/updated/?start=#{start_time}&end=#{end_time}"
|
84
|
+
api_get(url).body
|
85
|
+
end
|
86
|
+
|
67
87
|
# Public: Returns a detailed describe result for the specified sobject
|
68
88
|
#
|
69
89
|
# sobject - Stringish name of the sobject (default: nil).
|
data/lib/restforce/version.rb
CHANGED
@@ -34,6 +34,17 @@ shared_examples_for Restforce::AbstractClient do
|
|
34
34
|
it { should be_an Enumerable }
|
35
35
|
end
|
36
36
|
|
37
|
+
describe '.get_updated' do
|
38
|
+
let(:start_date) { Time.new(2015, 8, 17, 0, 0, 0, "+02:00") }
|
39
|
+
let(:end_date) { Time.new(2016, 8, 19, 0, 0, 0, "+02:00") }
|
40
|
+
end_string = '2016-08-18T22:00:00Z'
|
41
|
+
start_string = '2015-08-16T22:00:00Z'
|
42
|
+
requests "sobjects/Whizbang/updated/\\?end=#{end_string}&start=#{start_string}",
|
43
|
+
fixture: 'sobject/get_updated_success_response'
|
44
|
+
subject { client.get_updated('Whizbang', start_date, end_date) }
|
45
|
+
it { should be_an Enumerable }
|
46
|
+
end
|
47
|
+
|
37
48
|
describe '.search' do
|
38
49
|
requests 'search\?q=FIND%20%7Bbar%7D', fixture: 'sobject/search_success_response'
|
39
50
|
|
@@ -19,6 +19,22 @@ describe Restforce::Concerns::API do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
describe '.get_updated' do
|
23
|
+
let(:start_date_time) { Time.new(2002, 10, 31, 2, 2, 2, "+02:00") }
|
24
|
+
let(:end_date_time) { Time.new(2003, 10, 31, 2, 2, 2, "+02:00") }
|
25
|
+
let(:sobject) { 'Whizbang' }
|
26
|
+
subject(:results) { client.get_updated(sobject, start_date_time, end_date_time) }
|
27
|
+
it 'returns the body' do
|
28
|
+
start_string = '2002-10-31T00:02:02Z'
|
29
|
+
end_string = '2003-10-31T00:02:02Z'
|
30
|
+
url = "/sobjects/Whizbang/updated/?start=#{start_string}&end=#{end_string}"
|
31
|
+
client.should_receive(:api_get).
|
32
|
+
with(url).
|
33
|
+
and_return(response)
|
34
|
+
expect(results).to eq response.body
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
22
38
|
describe '.list_sobjects' do
|
23
39
|
subject { client.list_sobjects }
|
24
40
|
|
@@ -7,7 +7,8 @@ describe Restforce::Middleware::Authentication::Password do
|
|
7
7
|
password: 'bar',
|
8
8
|
security_token: 'security_token',
|
9
9
|
client_id: 'client_id',
|
10
|
-
client_secret: 'client_secret'
|
10
|
+
client_secret: 'client_secret',
|
11
|
+
adapter: :net_http }
|
11
12
|
end
|
12
13
|
|
13
14
|
it_behaves_like 'authentication middleware' do
|
@@ -5,7 +5,8 @@ describe Restforce::Middleware::Authentication::Token do
|
|
5
5
|
{ host: 'login.salesforce.com',
|
6
6
|
refresh_token: 'refresh_token',
|
7
7
|
client_id: 'client_id',
|
8
|
-
client_secret: 'client_secret'
|
8
|
+
client_secret: 'client_secret',
|
9
|
+
adapter: :net_http }
|
9
10
|
end
|
10
11
|
|
11
12
|
it_behaves_like 'authentication middleware' do
|
@@ -4,7 +4,8 @@ describe Restforce::Middleware::Authentication do
|
|
4
4
|
let(:options) do
|
5
5
|
{ host: 'login.salesforce.com',
|
6
6
|
proxy_uri: 'https://not-a-real-site.com',
|
7
|
-
authentication_retries: retries
|
7
|
+
authentication_retries: retries,
|
8
|
+
adapter: :net_http }
|
8
9
|
end
|
9
10
|
|
10
11
|
describe '.authenticate!' do
|
@@ -69,6 +70,16 @@ describe Restforce::Middleware::Authentication do
|
|
69
70
|
Restforce::Middleware::Logger, Faraday::Adapter::NetHttp
|
70
71
|
}
|
71
72
|
end
|
73
|
+
|
74
|
+
context 'with specified adapter' do
|
75
|
+
before do
|
76
|
+
options[:adapter] = :typhoeus
|
77
|
+
end
|
78
|
+
|
79
|
+
its(:handlers) {
|
80
|
+
should include FaradayMiddleware::ParseJson, Faraday::Adapter::Typhoeus
|
81
|
+
}
|
82
|
+
end
|
72
83
|
end
|
73
84
|
end
|
74
85
|
end
|
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.1.
|
4
|
+
version: 2.1.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: 2015-
|
12
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- spec/fixtures/sobject/create_success_response.json
|
220
220
|
- spec/fixtures/sobject/delete_error_response.json
|
221
221
|
- spec/fixtures/sobject/describe_sobjects_success_response.json
|
222
|
+
- spec/fixtures/sobject/get_updated_success_response.json
|
222
223
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
223
224
|
- spec/fixtures/sobject/org_query_response.json
|
224
225
|
- spec/fixtures/sobject/query_aggregate_success_response.json
|
@@ -311,6 +312,7 @@ test_files:
|
|
311
312
|
- spec/fixtures/sobject/create_success_response.json
|
312
313
|
- spec/fixtures/sobject/delete_error_response.json
|
313
314
|
- spec/fixtures/sobject/describe_sobjects_success_response.json
|
315
|
+
- spec/fixtures/sobject/get_updated_success_response.json
|
314
316
|
- spec/fixtures/sobject/list_sobjects_success_response.json
|
315
317
|
- spec/fixtures/sobject/org_query_response.json
|
316
318
|
- spec/fixtures/sobject/query_aggregate_success_response.json
|
@@ -367,3 +369,4 @@ test_files:
|
|
367
369
|
- spec/unit/signed_request_spec.rb
|
368
370
|
- spec/unit/sobject_spec.rb
|
369
371
|
- spec/unit/tooling/client_spec.rb
|
372
|
+
has_rdoc:
|