tito 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tito/base.rb +4 -0
- data/lib/tito/oauth2_middleware.rb +4 -3
- data/lib/tito/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 483e40092182ff4404978eb36a57948fccce7e29
|
4
|
+
data.tar.gz: 7bb411122530628861021608ae127009638738c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12a28e82d98da8d4e112e9d079ae027f0c6a0d94a82dd44b40acf82b2e4350d202070a8e749e80ed807685f2f41a77ea77462a8be30ffbea01a5d9bfb1e7f3fd
|
7
|
+
data.tar.gz: 42fdb2a5b4a5a868fbb0645164969a6c6f711219fc7508ab2908e530a304d572cd685e099b4a7059e9434a1b6078b8eda54c019d5886992a7ea9befce077e627
|
data/lib/tito/base.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
module Tito
|
2
2
|
class OAuth2Middleware < FaradayMiddleware::OAuth2
|
3
3
|
def call(env)
|
4
|
-
|
4
|
+
params = query_params(env[:url])
|
5
|
+
|
6
|
+
token = params.delete(:api_key) || params.delete('api_key')
|
7
|
+
token ||= if @token.is_a?(Proc)
|
5
8
|
@token.call(env)
|
6
9
|
else
|
7
10
|
@token
|
@@ -9,8 +12,6 @@ module Tito
|
|
9
12
|
|
10
13
|
token ||= Tito.api_key
|
11
14
|
|
12
|
-
params = query_params(env[:url])
|
13
|
-
|
14
15
|
if token.respond_to?(:empty?) && !token.empty?
|
15
16
|
env[:url].query = build_query params
|
16
17
|
env[:request_headers][AUTH_HEADER] ||= %(Bearer #{token})
|
data/lib/tito/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|