mashape 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/http_client.rb +16 -13
- 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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
-
|
9
|
-
version: 2.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-
|
17
|
+
date: 2012-09-27 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|