bearcat 1.5.38 → 1.6.0
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/bearcat.gemspec +1 -1
- data/lib/bearcat/client/reports.rb +10 -26
- data/lib/bearcat/client.rb +0 -1
- data/lib/bearcat/version.rb +1 -1
- data/lib/bearcat.rb +4 -8
- data/spec/bearcat/client/reports_spec.rb +2 -5
- data/spec/helper.rb +1 -0
- metadata +162 -169
- data/lib/bearcat/redis_connection.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c07b05ef9a13345ec573729530858cfc0572aaf1e81f8b708b7c4e809d16635
|
4
|
+
data.tar.gz: 62f84a5dff7c6f990caff1b026c7756eb7669f60b08a5db9a53d88a2ba70adfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ab1c45eab1f52f7951155926a0286d622b1cc300330e7fc9f467304786bff985f7c37edcd480b6a5db2c271603c50a7cfbd40f3f8aa19b9c957deb60a664b9
|
7
|
+
data.tar.gz: c596d8cc4dfa6af924515e75fc2eaa3184a6e8134375bea0513247afab1900899373de0f94e965ec7b989b5c592afe8b6640a773dd2b38995cd16d2ab7e4991b
|
data/bearcat.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'csv'
|
2
|
-
|
3
1
|
module Bearcat
|
4
2
|
class Client < Footrest::Client
|
5
3
|
module Reports
|
@@ -14,34 +12,20 @@ module Bearcat
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def download_report(url, save_location=nil)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
24
|
-
http.use_ssl = true if url.start_with?('https')
|
25
|
-
response = http.head(uri.to_s)
|
26
|
-
url = response['Location']
|
27
|
-
attempts += 1
|
28
|
-
end while attempts <= 5 && (response.code == '301' || response.code == '302' || response.code == '307')
|
29
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
30
|
-
http.use_ssl = true if uri.to_s.start_with?('https')
|
15
|
+
require 'open-uri'
|
16
|
+
open_uri_stream = URI.open(url, {
|
17
|
+
'User-Agent' => "Bearcat/#{Bearcat::VERSION} (#{RUBY_PLATFORM})",
|
18
|
+
'Authorization' => "Bearer #{config[:token]}"
|
19
|
+
})
|
20
|
+
|
31
21
|
if save_location
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
file.write(segment)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
22
|
+
save_location = save_location.path if save_location.respond_to?(:path)
|
23
|
+
IO.copy_stream(open_uri_stream, save_location)
|
24
|
+
save_location
|
39
25
|
else
|
40
|
-
|
41
|
-
CSV.parse(response.read_body, headers: true)
|
26
|
+
CSV.parse(open_uri_stream.read, headers: true)
|
42
27
|
end
|
43
28
|
end
|
44
|
-
|
45
29
|
end
|
46
30
|
end
|
47
31
|
end
|
data/lib/bearcat/client.rb
CHANGED
data/lib/bearcat/version.rb
CHANGED
data/lib/bearcat.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'bearcat/version'
|
2
2
|
require 'bearcat/client'
|
3
|
-
require 'bearcat/redis_connection'
|
4
3
|
|
5
4
|
module Bearcat
|
6
5
|
class << self
|
@@ -37,15 +36,12 @@ module Bearcat
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def redis_pool
|
40
|
-
require '
|
41
|
-
@redis_pool ||=
|
39
|
+
require 'rediconn'
|
40
|
+
@redis_pool ||= RediConn::RedisConnection.create(env_prefix: "BEARCAT")
|
42
41
|
end
|
43
42
|
|
44
|
-
def redis
|
45
|
-
|
46
|
-
redis_pool.with do |conn|
|
47
|
-
yield conn
|
48
|
-
end
|
43
|
+
def redis(&blk)
|
44
|
+
redis_pool.lazy_with(&blk)
|
49
45
|
end
|
50
46
|
end
|
51
47
|
end
|
@@ -48,7 +48,6 @@ describe Bearcat::Client::Reports do
|
|
48
48
|
it 'downloads a report to disk' do
|
49
49
|
report = IO.read(fixture('file.csv'))
|
50
50
|
tempfile = Tempfile.new('report')
|
51
|
-
stub_request(:head, 'https://canvas.instructure.com/files/1/download?download_frd=1&verifier=string').to_return(status: 200, body: report)
|
52
51
|
stub_request(:get,'https://canvas.instructure.com/files/1/download?download_frd=1&verifier=string').to_return(status: 200, body: report)
|
53
52
|
@client.download_report('https://canvas.instructure.com/files/1/download?download_frd=1&verifier=string', tempfile)
|
54
53
|
csv = CSV.read(tempfile, headers: true)
|
@@ -59,12 +58,10 @@ describe Bearcat::Client::Reports do
|
|
59
58
|
it 'follows redirects' do
|
60
59
|
report = IO.read(fixture('file.csv'))
|
61
60
|
tempfile = Tempfile.new('report')
|
62
|
-
stub_request(:
|
61
|
+
stub_request(:get, 'https://canvas.instructure.com/files/1/download?download_frd=1&verifier=string')
|
63
62
|
.to_return(status: 302, body: 'You are being redirected',headers: {'Location' => 'https://cluster1-files.instructure.com/files/1/download?download_frd=1&sf_verifier=verifier=1478139862&user_id=1&verifier=verifier'})
|
64
|
-
stub_request(:
|
63
|
+
stub_request(:get, 'https://cluster1-files.instructure.com/files/1/download?download_frd=1&sf_verifier=verifier=1478139862&user_id=1&verifier=verifier')
|
65
64
|
.to_return(status: 302, body: 'You are being redirected', headers: {'Location' => 'https://instructure-uploads.s3.amazonaws.com/account_1/attachments/1/assignment_submission.csv'})
|
66
|
-
stub_request(:head, 'https://instructure-uploads.s3.amazonaws.com/account_1/attachments/1/assignment_submission.csv')
|
67
|
-
.to_return(status: 200)
|
68
65
|
stub_request(:get, 'https://instructure-uploads.s3.amazonaws.com/account_1/attachments/1/assignment_submission.csv')
|
69
66
|
.to_return(status: 200, body: report)
|
70
67
|
@client.download_report('https://canvas.instructure.com/files/1/download?download_frd=1&verifier=string', tempfile)
|
data/spec/helper.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.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure CustomDev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -137,25 +137,19 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.2.2
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rediconn
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 2.2.0
|
146
|
-
- - "<"
|
143
|
+
- - "~>"
|
147
144
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
145
|
+
version: 0.1.0
|
149
146
|
type: :runtime
|
150
147
|
prerelease: false
|
151
148
|
version_requirements: !ruby/object:Gem::Requirement
|
152
149
|
requirements:
|
153
|
-
- - "
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: 2.2.0
|
156
|
-
- - "<"
|
150
|
+
- - "~>"
|
157
151
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
152
|
+
version: 0.1.0
|
159
153
|
description: Ruby interface for interacting with the canvas API
|
160
154
|
email:
|
161
155
|
- pseng@instructure.com
|
@@ -224,7 +218,6 @@ files:
|
|
224
218
|
- lib/bearcat/rate_limiting/functions.lua
|
225
219
|
- lib/bearcat/rate_limiting/increment_bucket.lua
|
226
220
|
- lib/bearcat/rate_limiting/redis_script.rb
|
227
|
-
- lib/bearcat/redis_connection.rb
|
228
221
|
- lib/bearcat/spec_helpers.rb
|
229
222
|
- lib/bearcat/version.rb
|
230
223
|
- lib/catalogcat.rb
|
@@ -447,199 +440,199 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
447
440
|
- !ruby/object:Gem::Version
|
448
441
|
version: '0'
|
449
442
|
requirements: []
|
450
|
-
rubygems_version: 3.
|
443
|
+
rubygems_version: 3.1.6
|
451
444
|
signing_key:
|
452
445
|
specification_version: 4
|
453
446
|
summary: Canvas API
|
454
447
|
test_files:
|
448
|
+
- spec/bearcat_spec.rb
|
449
|
+
- spec/bearcat/client_spec.rb
|
455
450
|
- spec/bearcat/api_array_spec.rb
|
456
|
-
- spec/bearcat/
|
457
|
-
- spec/bearcat/
|
458
|
-
- spec/bearcat/client/assignment_groups_spec.rb
|
459
|
-
- spec/bearcat/client/assignments_spec.rb
|
460
|
-
- spec/bearcat/client/blueprint_courses_spec.rb
|
461
|
-
- spec/bearcat/client/calendar_events_spec.rb
|
451
|
+
- spec/bearcat/rate_limiting_spec.rb
|
452
|
+
- spec/bearcat/stub_bearcat_spec.rb
|
462
453
|
- spec/bearcat/client/canvas_files_spec.rb
|
454
|
+
- spec/bearcat/client/folders_spec.rb
|
463
455
|
- spec/bearcat/client/conferences_spec.rb
|
464
|
-
- spec/bearcat/client/content_exports_spec.rb
|
465
|
-
- spec/bearcat/client/content_migrations_spec.rb
|
466
456
|
- spec/bearcat/client/conversations_spec.rb
|
467
|
-
- spec/bearcat/client/
|
468
|
-
- spec/bearcat/client/
|
457
|
+
- spec/bearcat/client/outcome_groups_spec.rb
|
458
|
+
- spec/bearcat/client/assignment_groups_spec.rb
|
459
|
+
- spec/bearcat/client/assignments_spec.rb
|
460
|
+
- spec/bearcat/client/rubric_association_spec.rb
|
461
|
+
- spec/bearcat/client/o_auth2_spec.rb
|
462
|
+
- spec/bearcat/client/search_spec.rb
|
463
|
+
- spec/bearcat/client/calendar_events_spec.rb
|
464
|
+
- spec/bearcat/client/group_memberships_spec.rb
|
465
|
+
- spec/bearcat/client/pages_spec.rb
|
466
|
+
- spec/bearcat/client/modules_spec.rb
|
469
467
|
- spec/bearcat/client/discussions_spec.rb
|
470
|
-
- spec/bearcat/client/enrollments_spec.rb
|
471
|
-
- spec/bearcat/client/external_tools_spec.rb
|
472
468
|
- spec/bearcat/client/files_spec.rb
|
473
|
-
- spec/bearcat/client/
|
469
|
+
- spec/bearcat/client/roles_spec.rb
|
474
470
|
- spec/bearcat/client/graph_ql_spec.rb
|
475
471
|
- spec/bearcat/client/group_categories_spec.rb
|
476
|
-
- spec/bearcat/client/
|
477
|
-
- spec/bearcat/client/
|
478
|
-
- spec/bearcat/client/
|
479
|
-
- spec/bearcat/client/learning_outcomes_spec.rb
|
472
|
+
- spec/bearcat/client/rubric_assessment_spec.rb
|
473
|
+
- spec/bearcat/client/blueprint_courses_spec.rb
|
474
|
+
- spec/bearcat/client/submissions_spec.rb
|
480
475
|
- spec/bearcat/client/module_items_spec.rb
|
481
|
-
- spec/bearcat/client/
|
482
|
-
- spec/bearcat/client/
|
483
|
-
- spec/bearcat/client/
|
476
|
+
- spec/bearcat/client/content_migrations_spec.rb
|
477
|
+
- spec/bearcat/client/custom_gradebook_columns_spec.rb
|
478
|
+
- spec/bearcat/client/enrollments_spec.rb
|
479
|
+
- spec/bearcat/client/analytics_spec.rb
|
480
|
+
- spec/bearcat/client/content_exports_spec.rb
|
481
|
+
- spec/bearcat/client/external_tools_spec.rb
|
482
|
+
- spec/bearcat/client/rubric_spec.rb
|
483
|
+
- spec/bearcat/client/accounts_spec.rb
|
484
|
+
- spec/bearcat/client/learning_outcomes_spec.rb
|
484
485
|
- spec/bearcat/client/outcomes_spec.rb
|
485
|
-
- spec/bearcat/client/
|
486
|
-
- spec/bearcat/client/quizzes_spec.rb
|
486
|
+
- spec/bearcat/client/courses_spec.rb
|
487
487
|
- spec/bearcat/client/reports_spec.rb
|
488
|
-
- spec/bearcat/client/roles_spec.rb
|
489
|
-
- spec/bearcat/client/rubric_assessment_spec.rb
|
490
|
-
- spec/bearcat/client/rubric_association_spec.rb
|
491
|
-
- spec/bearcat/client/rubric_spec.rb
|
492
|
-
- spec/bearcat/client/search_spec.rb
|
493
|
-
- spec/bearcat/client/sections_spec.rb
|
494
|
-
- spec/bearcat/client/submissions_spec.rb
|
495
488
|
- spec/bearcat/client/users_spec.rb
|
496
|
-
- spec/bearcat/
|
497
|
-
- spec/bearcat/
|
498
|
-
- spec/bearcat/
|
499
|
-
- spec/
|
500
|
-
- spec/
|
501
|
-
- spec/fixtures/account_admin_create.json
|
502
|
-
- spec/fixtures/account_admin_delete.json
|
503
|
-
- spec/fixtures/account_admins.json
|
504
|
-
- spec/fixtures/account_courses.json
|
489
|
+
- spec/bearcat/client/sections_spec.rb
|
490
|
+
- spec/bearcat/client/group_membership_spec.rb
|
491
|
+
- spec/bearcat/client/groups_spec.rb
|
492
|
+
- spec/bearcat/client/quizzes_spec.rb
|
493
|
+
- spec/helper.rb
|
505
494
|
- spec/fixtures/account_grading_standards.json
|
506
|
-
- spec/fixtures/account_groups.json
|
507
|
-
- spec/fixtures/account_reports.json
|
508
|
-
- spec/fixtures/account_reports_index.json
|
509
|
-
- spec/fixtures/account_reports_result_success.json
|
510
|
-
- spec/fixtures/account_reports_start_result.json
|
511
|
-
- spec/fixtures/account_role.json
|
512
|
-
- spec/fixtures/account_roles.json
|
513
|
-
- spec/fixtures/account_sis_imports.json
|
514
|
-
- spec/fixtures/account_sub_accounts.json
|
515
|
-
- spec/fixtures/account_user.json
|
516
|
-
- spec/fixtures/account_users.json
|
517
|
-
- spec/fixtures/accounts.json
|
518
495
|
- spec/fixtures/add_custom_user_data.json
|
519
|
-
- spec/fixtures/add_user.json
|
520
|
-
- spec/fixtures/assignment.json
|
521
496
|
- spec/fixtures/assignment_group.json
|
522
|
-
- spec/fixtures/
|
523
|
-
- spec/fixtures/
|
497
|
+
- spec/fixtures/account_groups.json
|
498
|
+
- spec/fixtures/update_outcome.json
|
499
|
+
- spec/fixtures/section_enrollments.json
|
500
|
+
- spec/fixtures/outcome_groups.json
|
524
501
|
- spec/fixtures/assignments.json
|
502
|
+
- spec/fixtures/course_files.json
|
503
|
+
- spec/fixtures/assignment_section_override.json
|
504
|
+
- spec/fixtures/delete_course.json
|
505
|
+
- spec/fixtures/course_folder.json
|
506
|
+
- spec/fixtures/ok.json
|
507
|
+
- spec/fixtures/account_sub_accounts.json
|
508
|
+
- spec/fixtures/course_sections.json
|
509
|
+
- spec/fixtures/merge_user.json
|
525
510
|
- spec/fixtures/bearcat.jpg
|
526
|
-
- spec/fixtures/
|
527
|
-
- spec/fixtures/
|
528
|
-
- spec/fixtures/
|
529
|
-
- spec/fixtures/
|
530
|
-
- spec/fixtures/calendar_event.json
|
531
|
-
- spec/fixtures/calendar_events.json
|
532
|
-
- spec/fixtures/canvas_files/declare_file.json
|
533
|
-
- spec/fixtures/canvas_files/upload_success.json
|
534
|
-
- spec/fixtures/cc.imscc
|
511
|
+
- spec/fixtures/create_group_discussion.json
|
512
|
+
- spec/fixtures/course_enrollments.json
|
513
|
+
- spec/fixtures/account_users.json
|
514
|
+
- spec/fixtures/no_custom_data.json
|
535
515
|
- spec/fixtures/communication_channels.json
|
536
|
-
- spec/fixtures/
|
537
|
-
- spec/fixtures/
|
516
|
+
- spec/fixtures/edited_group_category.json
|
517
|
+
- spec/fixtures/rubric_assessment.json
|
518
|
+
- spec/fixtures/paged_body.json
|
519
|
+
- spec/fixtures/canvas_files/upload_success.json
|
520
|
+
- spec/fixtures/canvas_files/declare_file.json
|
521
|
+
- spec/fixtures/account_reports.json
|
522
|
+
- spec/fixtures/outcomes.json
|
523
|
+
- spec/fixtures/search_find_recipients.json
|
524
|
+
- spec/fixtures/content_migration_files/upload_success.json
|
538
525
|
- spec/fixtures/content_migration_files/content_migration.json
|
539
526
|
- spec/fixtures/content_migration_files/response.json
|
540
|
-
- spec/fixtures/
|
541
|
-
- spec/fixtures/conversation.json
|
542
|
-
- spec/fixtures/course.json
|
527
|
+
- spec/fixtures/created_assignment.json
|
543
528
|
- spec/fixtures/course_conferences.json
|
544
|
-
- spec/fixtures/course_copy.json
|
545
|
-
- spec/fixtures/course_enrollments.json
|
546
|
-
- spec/fixtures/course_files.json
|
547
|
-
- spec/fixtures/course_folder.json
|
548
|
-
- spec/fixtures/course_folders.json
|
549
|
-
- spec/fixtures/course_grading_standards.json
|
550
|
-
- spec/fixtures/course_groups.json
|
551
|
-
- spec/fixtures/course_sections.json
|
552
|
-
- spec/fixtures/course_settings.json
|
553
|
-
- spec/fixtures/course_students.json
|
554
|
-
- spec/fixtures/create_course_discussion.json
|
555
|
-
- spec/fixtures/create_group_discussion.json
|
556
529
|
- spec/fixtures/create_outcome_in_group.json
|
557
|
-
- spec/fixtures/
|
558
|
-
- spec/fixtures/created_assignment.json
|
559
|
-
- spec/fixtures/created_course.json
|
560
|
-
- spec/fixtures/created_group.json
|
530
|
+
- spec/fixtures/delete_custom_data_scope.json
|
561
531
|
- spec/fixtures/created_group_category.json
|
562
|
-
- spec/fixtures/
|
563
|
-
- spec/fixtures/
|
532
|
+
- spec/fixtures/created_course.json
|
533
|
+
- spec/fixtures/assignment_groups.json
|
534
|
+
- spec/fixtures/section.json
|
535
|
+
- spec/fixtures/create_section.json
|
536
|
+
- spec/fixtures/user_page_views.json
|
537
|
+
- spec/fixtures/account_admin_create.json
|
538
|
+
- spec/fixtures/assignment.json
|
539
|
+
- spec/fixtures/calendar_event.json
|
540
|
+
- spec/fixtures/blueprint_subscriptions.json
|
541
|
+
- spec/fixtures/blueprint_update_assocations_success.json
|
542
|
+
- spec/fixtures/course.json
|
543
|
+
- spec/fixtures/rubric_association.json
|
544
|
+
- spec/fixtures/external_tools.json
|
545
|
+
- spec/fixtures/conversation.json
|
546
|
+
- spec/fixtures/external_tool.json
|
547
|
+
- spec/fixtures/course_students.json
|
548
|
+
- spec/fixtures/updated_course.json
|
549
|
+
- spec/fixtures/discussion_topics.json
|
550
|
+
- spec/fixtures/user_enrollments.json
|
551
|
+
- spec/fixtures/account_roles.json
|
552
|
+
- spec/fixtures/add_user.json
|
553
|
+
- spec/fixtures/discussion_entry_replies.json
|
554
|
+
- spec/fixtures/report_history.json
|
555
|
+
- spec/fixtures/gradebook_history.json
|
556
|
+
- spec/fixtures/account_sis_imports.json
|
557
|
+
- spec/fixtures/update_section.json
|
558
|
+
- spec/fixtures/conclude_enrollment.json
|
559
|
+
- spec/fixtures/start_report.json
|
564
560
|
- spec/fixtures/custom_data.json
|
565
|
-
- spec/fixtures/
|
566
|
-
- spec/fixtures/
|
567
|
-
- spec/fixtures/
|
568
|
-
- spec/fixtures/
|
569
|
-
- spec/fixtures/
|
570
|
-
- spec/fixtures/
|
571
|
-
- spec/fixtures/
|
572
|
-
- spec/fixtures/delete_custom_data_scope.json
|
561
|
+
- spec/fixtures/rubric.json
|
562
|
+
- spec/fixtures/account_role.json
|
563
|
+
- spec/fixtures/update_outcome_group.json
|
564
|
+
- spec/fixtures/module_item.json
|
565
|
+
- spec/fixtures/report_status.json
|
566
|
+
- spec/fixtures/enroll_student.json
|
567
|
+
- spec/fixtures/group_category.json
|
573
568
|
- spec/fixtures/delete_group_category.json
|
574
|
-
- spec/fixtures/
|
575
|
-
- spec/fixtures/deleted_conversation.json
|
576
|
-
- spec/fixtures/deleted_group.json
|
577
|
-
- spec/fixtures/department_level_participation.json
|
578
|
-
- spec/fixtures/department_level_statistics.json
|
579
|
-
- spec/fixtures/discussion_entries.json
|
580
|
-
- spec/fixtures/discussion_entry_replies.json
|
581
|
-
- spec/fixtures/discussion_topic.json
|
582
|
-
- spec/fixtures/discussion_topics.json
|
569
|
+
- spec/fixtures/dashboard.json
|
583
570
|
- spec/fixtures/edited_group.json
|
584
|
-
- spec/fixtures/
|
585
|
-
- spec/fixtures/
|
586
|
-
- spec/fixtures/enrollment_terms.json
|
587
|
-
- spec/fixtures/external_tool.json
|
588
|
-
- spec/fixtures/external_tools.json
|
571
|
+
- spec/fixtures/department_level_participation.json
|
572
|
+
- spec/fixtures/outcome_result.json
|
589
573
|
- spec/fixtures/file.csv
|
590
|
-
- spec/fixtures/
|
591
|
-
- spec/fixtures/
|
592
|
-
- spec/fixtures/group.json
|
593
|
-
- spec/fixtures/group_categories.json
|
594
|
-
- spec/fixtures/group_category.json
|
595
|
-
- spec/fixtures/group_category_groups.json
|
596
|
-
- spec/fixtures/group_conferences.json
|
597
|
-
- spec/fixtures/group_membership.json
|
598
|
-
- spec/fixtures/learning_outcome.json
|
599
|
-
- spec/fixtures/link_unlink_outcome.json
|
600
|
-
- spec/fixtures/merge_user.json
|
601
|
-
- spec/fixtures/module.json
|
602
|
-
- spec/fixtures/module_item.json
|
574
|
+
- spec/fixtures/course_copy.json
|
575
|
+
- spec/fixtures/user_logins.json
|
603
576
|
- spec/fixtures/module_item_sequence.json
|
577
|
+
- spec/fixtures/course_settings.json
|
578
|
+
- spec/fixtures/enrollment_terms.json
|
579
|
+
- spec/fixtures/blueprint_migration.json
|
580
|
+
- spec/fixtures/cc.imscc
|
581
|
+
- spec/fixtures/user_profile.json
|
582
|
+
- spec/fixtures/create_course_discussion.json
|
583
|
+
- spec/fixtures/custom_food_data.json
|
584
|
+
- spec/fixtures/created_module.json
|
585
|
+
- spec/fixtures/course_groups.json
|
586
|
+
- spec/fixtures/reactivate_enrollment.json
|
587
|
+
- spec/fixtures/blueprint_template.json
|
588
|
+
- spec/fixtures/account_courses.json
|
589
|
+
- spec/fixtures/calendar_events.json
|
590
|
+
- spec/fixtures/submissions/submission.json
|
591
|
+
- spec/fixtures/link_unlink_outcome.json
|
592
|
+
- spec/fixtures/account_reports_index.json
|
604
593
|
- spec/fixtures/module_items.json
|
605
|
-
- spec/fixtures/
|
606
|
-
- spec/fixtures/
|
607
|
-
- spec/fixtures/
|
594
|
+
- spec/fixtures/access_token.json
|
595
|
+
- spec/fixtures/progress.json
|
596
|
+
- spec/fixtures/module.json
|
597
|
+
- spec/fixtures/group_categories.json
|
598
|
+
- spec/fixtures/course_folders.json
|
599
|
+
- spec/fixtures/department_level_statistics.json
|
600
|
+
- spec/fixtures/account_admin_delete.json
|
601
|
+
- spec/fixtures/account_reports_result_success.json
|
602
|
+
- spec/fixtures/deleted_conversation.json
|
603
|
+
- spec/fixtures/learning_outcome.json
|
604
|
+
- spec/fixtures/user_details.json
|
608
605
|
- spec/fixtures/outcome_group_import.json
|
609
|
-
- spec/fixtures/
|
610
|
-
- spec/fixtures/
|
606
|
+
- spec/fixtures/modules.json
|
607
|
+
- spec/fixtures/group.json
|
611
608
|
- spec/fixtures/outcome_subgroup.json
|
612
609
|
- spec/fixtures/outcome_subgroups.json
|
613
|
-
- spec/fixtures/
|
614
|
-
- spec/fixtures/
|
615
|
-
- spec/fixtures/
|
616
|
-
- spec/fixtures/
|
617
|
-
- spec/fixtures/
|
618
|
-
- spec/fixtures/
|
610
|
+
- spec/fixtures/delete_section.json
|
611
|
+
- spec/fixtures/account_user.json
|
612
|
+
- spec/fixtures/accounts.json
|
613
|
+
- spec/fixtures/account_admins.json
|
614
|
+
- spec/fixtures/report_list.json
|
615
|
+
- spec/fixtures/group_membership.json
|
619
616
|
- spec/fixtures/quizzes/course_quizzes.json
|
617
|
+
- spec/fixtures/quizzes/course_quiz_questions.json
|
620
618
|
- spec/fixtures/quizzes/quiz_assignment_override.json
|
621
619
|
- spec/fixtures/quizzes/quiz_extension.json
|
622
|
-
- spec/fixtures/
|
623
|
-
- spec/fixtures/
|
624
|
-
- spec/fixtures/
|
625
|
-
- spec/fixtures/
|
626
|
-
- spec/fixtures/
|
627
|
-
- spec/fixtures/rubric_assessment.json
|
628
|
-
- spec/fixtures/rubric_association.json
|
629
|
-
- spec/fixtures/search_find_recipients.json
|
630
|
-
- spec/fixtures/section.json
|
631
|
-
- spec/fixtures/section_enrollments.json
|
620
|
+
- spec/fixtures/quizzes/course_quiz.json
|
621
|
+
- spec/fixtures/content_export.json
|
622
|
+
- spec/fixtures/created_group.json
|
623
|
+
- spec/fixtures/pages.json
|
624
|
+
- spec/fixtures/discussion_entries.json
|
632
625
|
- spec/fixtures/single_account.json
|
633
|
-
- spec/fixtures/
|
634
|
-
- spec/fixtures/
|
635
|
-
- spec/fixtures/update_outcome.json
|
636
|
-
- spec/fixtures/update_outcome_group.json
|
637
|
-
- spec/fixtures/update_section.json
|
638
|
-
- spec/fixtures/updated_course.json
|
626
|
+
- spec/fixtures/group_category_groups.json
|
627
|
+
- spec/fixtures/created_group_membership.json
|
639
628
|
- spec/fixtures/user_avatars.json
|
640
|
-
- spec/fixtures/
|
641
|
-
- spec/fixtures/
|
642
|
-
- spec/fixtures/
|
643
|
-
- spec/fixtures/
|
644
|
-
- spec/fixtures/
|
645
|
-
- spec/
|
629
|
+
- spec/fixtures/graph_ql_scores.json
|
630
|
+
- spec/fixtures/custom_gradebook_columns/gradebook_column_progress.json
|
631
|
+
- spec/fixtures/custom_gradebook_columns/custom_gradebook_column.json
|
632
|
+
- spec/fixtures/custom_gradebook_columns/custom_gradebook_columns.json
|
633
|
+
- spec/fixtures/custom_gradebook_columns/column_data.json
|
634
|
+
- spec/fixtures/account_reports_start_result.json
|
635
|
+
- spec/fixtures/course_grading_standards.json
|
636
|
+
- spec/fixtures/group_conferences.json
|
637
|
+
- spec/fixtures/discussion_topic.json
|
638
|
+
- spec/fixtures/deleted_group.json
|
@@ -1,106 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "connection_pool"
|
4
|
-
require "redis"
|
5
|
-
require "uri"
|
6
|
-
|
7
|
-
# Adapted from Sidekiq 6.x Implementation
|
8
|
-
|
9
|
-
module Bearcat
|
10
|
-
module RedisConnection
|
11
|
-
KNOWN_REDIS_URL_ENVS = %w[REDIS_URL REDISTOGO_URL REDISCLOUD_URL].freeze
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def configured?(prefix, explicit: true)
|
15
|
-
determine_redis_provider(prefix: prefix, explicit: explicit).present?
|
16
|
-
end
|
17
|
-
|
18
|
-
def create(options = {})
|
19
|
-
symbolized_options = options.transform_keys(&:to_sym)
|
20
|
-
|
21
|
-
if !symbolized_options[:url] && (u = determine_redis_provider(prefix: options[:env_prefix]))
|
22
|
-
symbolized_options[:url] = u
|
23
|
-
end
|
24
|
-
|
25
|
-
size = if symbolized_options[:size]
|
26
|
-
symbolized_options[:size]
|
27
|
-
elsif symbolized_options[:env_prefix] && (v = ENV["#{symbolized_options[:env_prefix]}_REDIS_POOL_SIZE"])
|
28
|
-
Integer(v)
|
29
|
-
elsif ENV["RAILS_MAX_THREADS"]
|
30
|
-
Integer(ENV["RAILS_MAX_THREADS"])
|
31
|
-
else
|
32
|
-
5
|
33
|
-
end
|
34
|
-
|
35
|
-
pool_timeout = symbolized_options[:pool_timeout] || 1
|
36
|
-
|
37
|
-
ConnectionPool.new(timeout: pool_timeout, size: size) do
|
38
|
-
namespace = symbolized_options[:namespace]
|
39
|
-
client = Redis.new client_opts(symbolized_options)
|
40
|
-
|
41
|
-
if namespace
|
42
|
-
begin
|
43
|
-
require "redis/namespace"
|
44
|
-
Redis::Namespace.new(namespace, redis: client)
|
45
|
-
rescue LoadError
|
46
|
-
Rails.logger.error("Your Redis configuration uses the namespace '#{namespace}' but the redis-namespace gem is not included in the Gemfile." \
|
47
|
-
"Add the gem to your Gemfile to continue using a namespace. Otherwise, remove the namespace parameter.")
|
48
|
-
exit(-127)
|
49
|
-
end
|
50
|
-
else
|
51
|
-
client
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def client_opts(options)
|
59
|
-
opts = options.dup
|
60
|
-
if opts[:namespace]
|
61
|
-
opts.delete(:namespace)
|
62
|
-
end
|
63
|
-
|
64
|
-
opts.delete(:size)
|
65
|
-
opts.delete(:env_prefix)
|
66
|
-
|
67
|
-
if opts[:network_timeout]
|
68
|
-
opts[:timeout] = opts[:network_timeout]
|
69
|
-
opts.delete(:network_timeout)
|
70
|
-
end
|
71
|
-
|
72
|
-
opts[:reconnect_attempts] ||= 1
|
73
|
-
|
74
|
-
opts
|
75
|
-
end
|
76
|
-
|
77
|
-
def determine_redis_provider(prefix: nil, explicit: false)
|
78
|
-
vars = []
|
79
|
-
|
80
|
-
if prefix.present?
|
81
|
-
if (ptr = ENV["#{prefix}_REDIS_PROVIDER"]).present?
|
82
|
-
return ENV[ptr]
|
83
|
-
else
|
84
|
-
vars.push(*KNOWN_REDIS_URL_ENVS.map { |e| ENV["#{prefix}_#{e}"] })
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
if !explicit || !prefix.present?
|
89
|
-
if (ptr = ENV["REDIS_PROVIDER"]).present?
|
90
|
-
vars << ptr # Intentionally not a return
|
91
|
-
else
|
92
|
-
vars.push(*KNOWN_REDIS_URL_ENVS)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
vars.select!(&:present?)
|
97
|
-
|
98
|
-
vars.each do |e|
|
99
|
-
return ENV[e] if ENV[e].present?
|
100
|
-
end
|
101
|
-
|
102
|
-
nil
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|