faraday-panoptes 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Rakefile +0 -9
- data/faraday-panoptes.gemspec +5 -2
- data/lib/faraday/panoptes/client_credentials_authentication.rb +7 -0
- data/lib/faraday/panoptes/version.rb +1 -1
- metadata +48 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcc4eaec9460dd9ebdf3a11e812819837008517
|
4
|
+
data.tar.gz: 48a91049b544dcb27229e862e8565af6367aad49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3a1e81af53898f19f097c3ce339b209b8269a1a6884dc14e492f50cd4341f1020d4a7f4c75f63edff6d10102ae3428959d13df14b663649caa6a5d2e957dd5
|
7
|
+
data.tar.gz: d8e3bca366eeea86c852da7bb5cc2901fa2623cee3ed458213cb209b6f9022581b862af06747c16b5e4676d8daace6c93fde35e4474cfc507327081cae630372
|
data/.rspec
ADDED
data/Rakefile
CHANGED
data/faraday-panoptes.gemspec
CHANGED
@@ -23,7 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency 'faraday_middleware', '~> 0.10'
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.10"
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "minitest"
|
26
|
+
spec.add_development_dependency "openssl"
|
28
27
|
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "vcr"
|
31
|
+
spec.add_development_dependency "webmock"
|
29
32
|
end
|
@@ -3,6 +3,10 @@ require 'faraday_middleware'
|
|
3
3
|
|
4
4
|
module Faraday
|
5
5
|
module Panoptes
|
6
|
+
|
7
|
+
class CredentialsOAuthError < StandardError
|
8
|
+
end
|
9
|
+
|
6
10
|
class ClientCredentialsAuthentication < Faraday::Middleware
|
7
11
|
dependency do
|
8
12
|
require 'json' unless defined?(::JSON)
|
@@ -13,6 +17,7 @@ module Faraday
|
|
13
17
|
@client_id = client_id
|
14
18
|
@client_secret = client_secret
|
15
19
|
@conn = Faraday.new(url: url)
|
20
|
+
@current_token = nil
|
16
21
|
end
|
17
22
|
|
18
23
|
def call(env)
|
@@ -45,6 +50,8 @@ module Faraday
|
|
45
50
|
grant_type: 'client_credentials',
|
46
51
|
client_id: @client_id,
|
47
52
|
client_secret: @client_secret)
|
53
|
+
|
54
|
+
raise CredentialsOAuthError.new "Failed to obtain access token" if result.status == 401 or result.status == 422 or result.body.empty?
|
48
55
|
JSON.parse(result.body)
|
49
56
|
end
|
50
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-panoptes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: openssl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +95,7 @@ dependencies:
|
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '10.0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
98
|
+
name: rspec
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - ">="
|
@@ -81,7 +109,21 @@ dependencies:
|
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
129
|
- - ">="
|
@@ -103,6 +145,7 @@ extensions: []
|
|
103
145
|
extra_rdoc_files: []
|
104
146
|
files:
|
105
147
|
- ".gitignore"
|
148
|
+
- ".rspec"
|
106
149
|
- ".travis.yml"
|
107
150
|
- CHANGELOG.md
|
108
151
|
- CODE_OF_CONDUCT.md
|
@@ -138,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
181
|
version: '0'
|
139
182
|
requirements: []
|
140
183
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.5.2
|
142
185
|
signing_key:
|
143
186
|
specification_version: 4
|
144
187
|
summary: Faraday middleware for talking to the Panoptes API
|