auth_tool 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64d7ddbec2f9ffe6038aa009d72142db863cbee3
4
- data.tar.gz: 9bdfcdf5682e032bbb7bfeabcd51da94998bc276
3
+ metadata.gz: 50647a7619ee11aca94acc9cb48eb8e517f9b2d8
4
+ data.tar.gz: b598d2b0ce0a554fbefb178685794e8e987d125e
5
5
  SHA512:
6
- metadata.gz: 58ae32616d66ecc29f33353ae27f5df50858d4606edd64ed4c78bf1a311c5edec0a92444a38338ecda313865c573b574ad156c751a058aa70fd234f25d6ed60e
7
- data.tar.gz: 5195d8aff6dc86ae110bd72d1ef506592639d1d9ea95b72ac0bf077a1ae6003ec222508899841eafca2e3fef4b19135fda48fe3b32291afc8934ee58334581d2
6
+ metadata.gz: 00b4c0188e4a86796528021e2cec560b47a791308b4ca542d87d6d02a72afd93091d02b3465fc8899a03c0d756afb146ab94503ae9c58622790979b79cfa1b31
7
+ data.tar.gz: 8e1d72a3f334ba3d6bed4587b865fa7c9fd780a448b621f6f2d9dfeec4bf6edf774dae202a86589e4546f7c4ebeaf8c503f828dde4d60b48cca38137b5798588
@@ -10,9 +10,10 @@ module AuthTool
10
10
  # The client_secrets hash for the API
11
11
  #
12
12
  # @return [AuthTool::Client] The client.
13
- def self.get_client client_secrets
13
+ def self.get_client(client_secrets, token = {})
14
14
  raise "Expected Hash, received #{client_secrets.class}" if client_secrets.class != Hash
15
- client = create_client(client_secrets)
15
+ client = create_client(client_secrets) if token == {}
16
+ client = create_client(client_secrets, token) if token != {}
16
17
  return client
17
18
  end
18
19
 
@@ -95,7 +96,12 @@ module AuthTool
95
96
  # Configuration options for the client.
96
97
  #
97
98
  # @return [AuthTool::Client] New client object
98
- def self.create_client options
99
- AuthTool::Client.new options
99
+ def self.create_client(options, *token)
100
+
101
+ if token.length > 0
102
+ AuthTool::Client.new(options,token[0])
103
+ else
104
+ AuthTool::Client.new(options)
105
+ end
100
106
  end
101
107
  end
@@ -19,6 +19,7 @@ module AuthTool
19
19
  self.params = config.delete('params') if @has_params
20
20
  if @oauth_version == 1
21
21
  oauth1 config
22
+ puts 'SSLDKJFKLSDJFKLSDJFKLDSJKLFJDSKLFJDSJFKLDSJFKLDSF'
22
23
  self.signet.token_credential_key = credentials["oauth_token"] if credentials.has_key? "oauth_token"
23
24
  self.signet.token_credential_secret = credentials["oauth_token_secret"] if credentials.has_key? "oauth_token_secret"
24
25
  elsif @oauth_version == 2
@@ -64,13 +64,13 @@ module AuthTool
64
64
  body = params.delete('body') if params.has_key? 'body'
65
65
  conn = Faraday.new(:params => params)
66
66
  options = {:method => http_verb, :header => header, :body => body, :uri => uri, :connection => conn}
67
-
67
+
68
68
  begin
69
69
  response = client.signet.fetch_protected_resource(options)
70
70
  rescue
71
71
  p 'fetch_protected_resource failed'
72
72
  end
73
-
73
+
74
74
  return JSON.parse(response.body)
75
75
  end
76
76
  end
@@ -1,3 +1,3 @@
1
1
  module AuthTool
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Fan