stbaldricks 3.0.2 → 4.0.0.alpha.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.
- checksums.yaml +4 -4
- data/lib/stbaldricks/request.rb +0 -1
- data/lib/stbaldricks/version.rb +1 -1
- metadata +5 -6
- data/lib/stbaldricks/api_connector.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22723587b4356d295b04f95fa86e47537c4faa27
|
4
|
+
data.tar.gz: 467dbd133382ce60b5f04084c66bd8d3921ac6f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc66e77705afbdec0f4b148003d3b6cae95918e4ec9fdd49a333828ec0825b3363291b7d6163e35aa037c363b32e01b80cc5410bb3efb875994dcf5755269f8
|
7
|
+
data.tar.gz: 98af80a567f1af4ee3edb119c23bded9fabcb10ae81dd74e252d4b556c4bd85f3badf1b41cccd599e033dd34de0eea3b1bc05764298877d2ab73104d64b893c2
|
data/lib/stbaldricks/request.rb
CHANGED
data/lib/stbaldricks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stbaldricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -76,7 +76,6 @@ files:
|
|
76
76
|
- LICENSE
|
77
77
|
- lib/stbaldricks.rb
|
78
78
|
- lib/stbaldricks/api.rb
|
79
|
-
- lib/stbaldricks/api_connector.rb
|
80
79
|
- lib/stbaldricks/client.rb
|
81
80
|
- lib/stbaldricks/configuration.rb
|
82
81
|
- lib/stbaldricks/default_logger.rb
|
@@ -211,12 +210,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
210
|
version: '0'
|
212
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
212
|
requirements:
|
214
|
-
- - "
|
213
|
+
- - ">"
|
215
214
|
- !ruby/object:Gem::Version
|
216
|
-
version:
|
215
|
+
version: 1.3.1
|
217
216
|
requirements: []
|
218
217
|
rubyforge_project:
|
219
|
-
rubygems_version: 2.6.
|
218
|
+
rubygems_version: 2.6.11
|
220
219
|
signing_key:
|
221
220
|
specification_version: 4
|
222
221
|
summary: St. Baldrick's Foundation Ruby Client Library
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module SBF
|
2
|
-
module APIConnector
|
3
|
-
# Executes API request with attempts to auto login the configured user on the API.
|
4
|
-
def with_auto_connect
|
5
|
-
# Check if we still need to attempt the initial login
|
6
|
-
if SBF::Client::Configuration.user_token.nil?
|
7
|
-
login_response = SBF::Client::User.login!(SBF::APIConnector::Configuration.username, SBF::APIConnector::Configuration.password)
|
8
|
-
error login_response.http_code, login_response.error.to_json if login_response.error?
|
9
|
-
end
|
10
|
-
|
11
|
-
# Yield to the block to execute the request
|
12
|
-
response = yield
|
13
|
-
|
14
|
-
if response.error? && response.http_code == 401
|
15
|
-
# If the user token is expired, try to login and refresh the token and try again
|
16
|
-
SBF::Client::LOG.debug { 'User session has expired attempting re-login.' }
|
17
|
-
login_response = SBF::Client::User.login!(SBF::APIConnector::Configuration.username, SBF::APIConnector::Configuration.password)
|
18
|
-
error login_response.http_code, login_response.error.to_json if login_response.error?
|
19
|
-
|
20
|
-
# Try request again
|
21
|
-
response = yield
|
22
|
-
end
|
23
|
-
|
24
|
-
response
|
25
|
-
end
|
26
|
-
|
27
|
-
class Configuration
|
28
|
-
class << self
|
29
|
-
attr_writer :username, :password
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.username
|
33
|
-
@username || raise(SBF::APIConnector::Configuration::Error.new('username', 'must be set'))
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.password
|
37
|
-
@password || raise(SBF::APIConnector::Configuration::Error.new('password', 'must be set'))
|
38
|
-
end
|
39
|
-
|
40
|
-
class Error < ::StandardError
|
41
|
-
def initialize(setting, message) # :nodoc:
|
42
|
-
super "SBF::APIConnector::Configuration.#{setting} #{message}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|