bearcat 1.5.29 → 1.5.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/badgrcat/client/methods.rb +22 -0
- data/lib/badgrcat/client.rb +23 -4
- data/lib/bearcat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8f8b63caed1ff5f931ed35d4d7612cc95b1a55ef320b2ea62d6c37cd58d7961
|
4
|
+
data.tar.gz: e4d46c06cc72391ca389cd8e988aea15daab9d849d34b43f8da836cea7baa0d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4692fb709e0bda0e0e7090bc58173be51a7583f540b1da2d725215f0254733fd62fdc376790cbc09fdcbec4d47765cdd3a83e4ad1e67bc5ad63193acf8fa330a
|
7
|
+
data.tar.gz: 6898bcfbb4f30848164b1ea84588821f4a3736378df6e50fd20037f36e3d8e008d9ebb43e75cc67728df84f5230ca59c985246a806a03f4b5676dc0f5adab12b
|
@@ -3,6 +3,28 @@ module Badgrcat
|
|
3
3
|
module Methods
|
4
4
|
extend Bearcat::Client::ClientModule
|
5
5
|
|
6
|
+
prefix "v1" do
|
7
|
+
prefix "/orgs" do
|
8
|
+
prefix "/:organization" do
|
9
|
+
prefix "/pathways" do
|
10
|
+
get :pathways
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
prefix "/pathways" do
|
16
|
+
prefix "/:pathway" do
|
17
|
+
get :pathway
|
18
|
+
|
19
|
+
prefix "/progress" do
|
20
|
+
prefix "/recipient?recipientId=:recepientId" do
|
21
|
+
get :user_pathway_progress
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
6
28
|
prefix "/v2/issuers" do
|
7
29
|
get :issuers
|
8
30
|
post :create_issuer
|
data/lib/badgrcat/client.rb
CHANGED
@@ -12,20 +12,36 @@ module Badgrcat
|
|
12
12
|
|
13
13
|
# Override Footrest request for ApiArray support
|
14
14
|
def request(method, &block)
|
15
|
-
begin
|
16
|
-
|
15
|
+
response = begin
|
16
|
+
connection.send(method, &block)
|
17
|
+
rescue Footrest::HttpError::NotFound => e
|
18
|
+
raise e unless connection.headers[:authorization].nil?
|
19
|
+
|
20
|
+
# Reauthenticate and retry if authorization header is nil
|
21
|
+
authenticate!
|
22
|
+
connection.send(method, &block)
|
17
23
|
rescue Footrest::HttpError::Unauthorized
|
18
24
|
# Reauthenticate and retry
|
19
25
|
authenticate!
|
20
|
-
|
26
|
+
connection.send(method, &block)
|
21
27
|
end
|
22
28
|
|
23
29
|
Badgrcat::ApiArray.process_response(response, self)
|
24
30
|
end
|
25
31
|
|
32
|
+
# Override Footrest request for sending params in body as json
|
33
|
+
def request_with_params_in_body(method, path, options)
|
34
|
+
request(method) do |r|
|
35
|
+
r.path = fullpath(path)
|
36
|
+
r.body = options.to_json unless options.empty?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
26
40
|
def authenticate!
|
27
41
|
connection.headers[:authorization] = nil
|
28
42
|
|
43
|
+
auth_url = config[:auth_url]
|
44
|
+
|
29
45
|
tok_params = {
|
30
46
|
scope: config[:scope],
|
31
47
|
client_id: config[:client_id],
|
@@ -47,11 +63,14 @@ module Badgrcat
|
|
47
63
|
})
|
48
64
|
end
|
49
65
|
|
50
|
-
authresp = connection.send(:post,
|
66
|
+
authresp = connection.send(:post, auth_url, tok_params)
|
51
67
|
authdata = authresp.body
|
52
68
|
|
53
69
|
@refresh_token = authdata["refresh_token"].presence || @refresh_token
|
54
70
|
connection.headers[:authorization] = "#{authdata['token_type']} #{authdata['access_token']}"
|
71
|
+
|
72
|
+
# Set content type as application/json
|
73
|
+
connection.headers['Content-Type'] = "application/json"
|
55
74
|
end
|
56
75
|
end
|
57
76
|
end
|
data/lib/bearcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure CustomDev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|