restforce 0.1.7 → 0.1.8
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.
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/README.md +8 -0
- data/lib/restforce.rb +5 -3
- data/lib/restforce/version.rb +1 -1
- data/restforce.gemspec +1 -1
- data/spec/lib/client_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -98,6 +98,14 @@ Restforce.configure do |config|
|
|
98
98
|
end
|
99
99
|
```
|
100
100
|
|
101
|
+
### Bang methods
|
102
|
+
|
103
|
+
All the CRUD methods (create, update, upsert, destroy) have equivalent methods with
|
104
|
+
a ! at the end (create!, update!, upsert!, destroy!), which can be used if you need
|
105
|
+
to do some custom error handling. The bang methods will raise exceptions, while the
|
106
|
+
non-bang methods will return false in the event that an exception is raised. This
|
107
|
+
works similarly to ActiveRecord.
|
108
|
+
|
101
109
|
* * *
|
102
110
|
|
103
111
|
### query(soql)
|
data/lib/restforce.rb
CHANGED
@@ -31,10 +31,12 @@ module Restforce
|
|
31
31
|
#
|
32
32
|
# Returns the Hash context if the message is valid.
|
33
33
|
def decode_signed_request(message, client_secret)
|
34
|
-
|
34
|
+
signature, payload = message.split('.')
|
35
|
+
signature = Base64.decode64(signature)
|
35
36
|
digest = OpenSSL::Digest::Digest.new('sha256')
|
36
|
-
|
37
|
-
|
37
|
+
hmac = OpenSSL::HMAC.digest(digest, client_secret, payload)
|
38
|
+
return nil if signature != hmac
|
39
|
+
JSON.parse(Base64.decode64(payload))
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
data/lib/restforce/version.rb
CHANGED
data/restforce.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_development_dependency 'rspec'
|
25
25
|
gem.add_development_dependency 'webmock'
|
26
26
|
gem.add_development_dependency 'simplecov'
|
27
|
-
gem.add_development_dependency 'faye', '0.8.3'
|
27
|
+
gem.add_development_dependency 'faye', '0.8.3' unless RUBY_PLATFORM == 'java'
|
28
28
|
end
|
data/spec/lib/client_spec.rb
CHANGED
@@ -378,7 +378,7 @@ shared_examples_for 'methods' do
|
|
378
378
|
let(:data) { Base64.encode64('{ "key": "value" }') }
|
379
379
|
let(:message) do
|
380
380
|
digest = OpenSSL::Digest::Digest.new('sha256')
|
381
|
-
signature = Base64.encode64(OpenSSL::HMAC.
|
381
|
+
signature = Base64.encode64(OpenSSL::HMAC.digest(digest, client_secret, data))
|
382
382
|
"#{signature}.#{data}"
|
383
383
|
end
|
384
384
|
|
@@ -440,7 +440,7 @@ shared_examples_for 'methods' do
|
|
440
440
|
let(:oauth_token) { 'bar' }
|
441
441
|
specify { expect { subject }.to_not raise_error }
|
442
442
|
end
|
443
|
-
end
|
443
|
+
end unless RUBY_PLATFORM == 'java'
|
444
444
|
|
445
445
|
describe 'authentication retries' do
|
446
446
|
context 'when retries reaches 0' do
|
data/spec/spec_helper.rb
CHANGED
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: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10
|
12
|
+
date: 2012-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|