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 CHANGED
@@ -3,4 +3,9 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - ree
9
+ - rbx-18mode
10
+ - rbx-19mode
6
11
  script: bundle exec rake
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in restforce.gemspec
4
4
  gemspec
5
+
6
+ gem 'jruby-openssl', :platforms => :jruby
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
- encryped_secret, payload = message.split('.')
34
+ signature, payload = message.split('.')
35
+ signature = Base64.decode64(signature)
35
36
  digest = OpenSSL::Digest::Digest.new('sha256')
36
- signature = Base64.encode64(OpenSSL::HMAC.hexdigest(digest, client_secret, payload))
37
- JSON.parse(Base64.decode64(payload)) if encryped_secret == signature
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
 
@@ -1,3 +1,3 @@
1
1
  module Restforce
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
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
@@ -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.hexdigest(digest, client_secret, data))
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
@@ -3,6 +3,7 @@ SimpleCov.start
3
3
 
4
4
  require 'bundler/setup'
5
5
  Bundler.require :default, :test
6
+ require 'faye' unless RUBY_PLATFORM == 'java'
6
7
 
7
8
  require 'webmock/rspec'
8
9
 
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.7
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-31 00:00:00.000000000 Z
12
+ date: 2012-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake