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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6feed8139403106b15ec1bc8fa20e5e294ca922e
4
- data.tar.gz: 34b7a32ad0b28af669a02623bfd671555a9ab6ea
3
+ metadata.gz: 6dcc4eaec9460dd9ebdf3a11e812819837008517
4
+ data.tar.gz: 48a91049b544dcb27229e862e8565af6367aad49
5
5
  SHA512:
6
- metadata.gz: 8e343315e2e832c221fbb8439f93ed377bb57b8486e46ca6b7ed850f092394436af7628c8db888eb8582d9b3443f4a78e569c38fc491cf3a87fd29529b2c40ef
7
- data.tar.gz: 9a50049435e9884a5f14c85e26278aea48dc641571f2c7c903c8272c4614f441d7fb1331603efababe0272cbad3f1e28fe10ad29e6f070f3b6f26db143f1f4c7
6
+ metadata.gz: 9d3a1e81af53898f19f097c3ce339b209b8269a1a6884dc14e492f50cd4341f1020d4a7f4c75f63edff6d10102ae3428959d13df14b663649caa6a5d2e957dd5
7
+ data.tar.gz: d8e3bca366eeea86c852da7bb5cc2901fa2623cee3ed458213cb209b6f9022581b862af06747c16b5e4676d8daace6c93fde35e4474cfc507327081cae630372
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Rakefile CHANGED
@@ -1,10 +1 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
9
-
10
- task :default => :test
@@ -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 "rake", "~> 10.0"
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
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
2
  module Panoptes
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  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.2.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: 2016-01-26 00:00:00.000000000 Z
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: minitest
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: pry
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.4.6
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