mashape 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/http_client.rb +16 -13
  2. metadata +3 -3
data/lib/http_client.rb CHANGED
@@ -5,6 +5,9 @@ require File.join(File.dirname(__FILE__), "/authentication/mashape_authenticatio
5
5
  require File.join(File.dirname(__FILE__), "/authentication/custom_header_authentication.rb")
6
6
  require File.join(File.dirname(__FILE__), "/authentication/query_authentication.rb")
7
7
  require File.join(File.dirname(__FILE__), "/authentication/basic_authentication.rb")
8
+ require File.join(File.dirname(__FILE__), "/authentication/oauth_authentication.rb")
9
+ require File.join(File.dirname(__FILE__), "/authentication/oauth10a_authentication.rb")
10
+ require File.join(File.dirname(__FILE__), "/authentication/oauth2_authentication.rb")
8
11
  require File.join(File.dirname(__FILE__), "/http_utils.rb")
9
12
  require File.join(File.dirname(__FILE__), "/mashape_exception.rb")
10
13
 
@@ -45,20 +48,20 @@ module Mashape
45
48
  headers = headers.merge(handler.handleHeader)
46
49
  elsif handler.kind_of? Mashape::QueryAuthentication
47
50
  parameters = parameters.merge(handler.handleParams)
48
- # elsif handler.kind_of? Mashape::OAuth10aAuthentication
49
- # if handler.handleParams[:access_token] == nil || handler.handleParams[:access_secret] == nil
50
- # raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authenticate_oauth('access_token','access_secret') with not null values")
51
- # end
51
+ elsif handler.kind_of? Mashape::OAuth10aAuthentication
52
+ if handler.handleParams[:access_token] == nil || handler.handleParams[:access_secret] == nil
53
+ raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authorize('access_token','access_secret') with not null values")
54
+ end
52
55
  # These headers will be processed by the proxy to sign the request
53
- # headers["X-Mashape-OAuth-ConsumerKey"] = handler.handleParams[:consumer_key]
54
- # headers["X-Mashape-OAuth-ConsumerSecret"] = handler.handleParams[:consumer_secret]
55
- # headers["X-Mashape-OAuth-AccessToken"] = handler.handleParams[:access_token]
56
- # headers["X-Mashape-OAuth-AccessSecret"] = handler.handleParams[:access_secret]
57
- # elsif handler.kind_of? Mashape::OAuth2Authentication
58
- # if handler.handleParams[:access_token] == nil
59
- # raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authenticate_oauth('access_token') with a not null value")
60
- # end
61
- # parameters = parameters.merge({"access_token" => handler.handleParams[:access_token]})
56
+ headers["x-mashape-oauth-consumerkey"] = handler.handleParams[:consumer_key]
57
+ headers["x-mashape-oauth-consumersecret"] = handler.handleParams[:consumer_secret]
58
+ headers["x-mashape-oauth-accesstoken"] = handler.handleParams[:access_token]
59
+ headers["x-mashape-oauth-accesssecret"] = handler.handleParams[:access_secret]
60
+ elsif handler.kind_of? Mashape::OAuth2Authentication
61
+ if handler.handleParams[:access_token] == nil
62
+ raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authorize('access_token') with a not null value")
63
+ end
64
+ parameters = parameters.merge({"access_token" => handler.handleParams[:access_token]})
62
65
  end
63
66
  end
64
67
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 0
9
- version: 2.0.0
8
+ - 1
9
+ version: 2.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mashape
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-09-21 00:00:00 -07:00
17
+ date: 2012-09-27 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency