bearcat 1.5.29 → 1.5.31

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
  SHA256:
3
- metadata.gz: 54fa926a7e7360746861b93d221113f639cda551d8a562c2c726727356bb8efd
4
- data.tar.gz: 307c85063c02cf501e34c83707f92b30a060480ee84dcb841aab70dc8bad05ec
3
+ metadata.gz: 4b10d663c599a6bd34475252cf2a090b5e98f915b901bb62cd3ce43421c8e9bb
4
+ data.tar.gz: d6e9db6335e62628d25f6b6eceeabd84db20e8da3d356229645110b2884c219e
5
5
  SHA512:
6
- metadata.gz: 42efb018808e63b32a8f3c43756d2f3565b11e480c423e10a627573ecd54fa7da4c046338d66a3830fd21b9559ca31c380ddb60aacda0574c75de960344fcc03
7
- data.tar.gz: d652d5fa3e96067f12807701df68843940cc7f82b0af528497dbed228799c74c947493758c121752752cb795d2bcc64e596277aa73ccbd53d0fd893a09950180
6
+ metadata.gz: 819b082be161f73a7d4501788b2e67a9490b44bdda94b06641b65040251903facaebafe83335f4dfaa2cddc3682aa8465c0ad7c8b5457ad24de35915b89da8d0
7
+ data.tar.gz: df897865ae64a6b3e576e4e8787537f86073ad772523264c32e966078325a7155265db99cdffae10efec8505febe579085b2272ac0c0c32e36556ad6d8865bac
@@ -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
@@ -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
- response = connection.send(method, &block)
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
- response = connection.send(method, &block)
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, "o/token", tok_params)
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
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bearcat
4
+ class Client < Footrest::Client
5
+ module AccountNotifications
6
+ extend ClientModule
7
+
8
+ prefix "/api/v1/accounts/:account_id/account_notifications/" do
9
+ get :global_notifications_for_user
10
+ post :create_global_notification
11
+ prefix ":id/" do
12
+ get :global_notification
13
+ put :update_global_notification
14
+ delete :close_global_notification_for_user
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.5.29' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.5.31' unless defined?(Bearcat::VERSION)
3
3
  end
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.29
4
+ version: 1.5.31
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-17 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -172,6 +172,7 @@ files:
172
172
  - lib/bearcat.rb
173
173
  - lib/bearcat/api_array.rb
174
174
  - lib/bearcat/client.rb
175
+ - lib/bearcat/client/account_notifications.rb
175
176
  - lib/bearcat/client/account_reports.rb
176
177
  - lib/bearcat/client/accounts.rb
177
178
  - lib/bearcat/client/analytics.rb