bearcat 1.4.2 → 1.4.6

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
- SHA1:
3
- metadata.gz: 8d7986f7cb9c9c46c9bf669ec4bad9e8eb4d7f33
4
- data.tar.gz: cc54f03e7e146f71f24d0d80c2342ffa6e662ca2
2
+ SHA256:
3
+ metadata.gz: 5e4c430ee7965a0641d99df75b036d1d86359a12af3a198b2096ae14dfebdeda
4
+ data.tar.gz: 3dbd1ce2b2413cc413f1e0d057b0f2b393275cee9f76377c1c7284fc62ec978c
5
5
  SHA512:
6
- metadata.gz: 44cacec26e61027f954ddeb3700a85a4241cf32738a12e628878a94bc9cf952f93a3f71b5f530cbc9ec38a62de9f8bcc8e13a12b667396ebe27e986709994f20
7
- data.tar.gz: a93d140338dbca79e0e9af138c306d580044f3f62a9639ec8bfe2eb7a0605446e8a3c5b21be62a268066dedcb7a6f71e98a289202a34f077b13fb4c6a80aeed0
6
+ metadata.gz: 62a034fde4753be6b3686b7dff692fdd84c9c69d9e5fe7bdf7e7cf59fd490d0213d20c81a54d7f5e9151e64abb702dc0b94c0cbb5b27d01cb83e6cfd1deed7c4
7
+ data.tar.gz: 3c202a71e4f20170d98baa07a34f73bb62050170417786b7f13a89ae1feade4b9636e0b65a6a352e3a48f098f2c34f15b4eb7f7b45296af3027b24ff44b74b8d
@@ -59,6 +59,14 @@ module Bearcat
59
59
  @link_hash['next'] || @link_hash['prev']
60
60
  end
61
61
 
62
+ def page_count
63
+ return nil unless @link_hash['last']
64
+
65
+ uri = URI.parse(@link_hash['last'])
66
+ params = CGI.parse(uri.query)
67
+ params.dig('page', 0)&.to_i || 1
68
+ end
69
+
62
70
  %w[next prev first last].each do |rel|
63
71
  define_method :"#{rel}_page" do
64
72
  load_page(rel)
@@ -66,6 +74,8 @@ module Bearcat
66
74
  end
67
75
 
68
76
  def each_page(page_count = nil, &block)
77
+ return to_enum(:each_page, page_count) unless block_given?
78
+
69
79
  if pages?
70
80
  iterate_pages(page_count) do |page_response|
71
81
  @members = process_body(page_response)
@@ -78,6 +88,8 @@ module Bearcat
78
88
  end
79
89
 
80
90
  def all_pages_each(page_count = nil, &block)
91
+ return to_enum(:all_pages_each, page_count) unless block_given?
92
+
81
93
  each_page(page_count) do |page|
82
94
  page.each &block
83
95
  end
@@ -44,6 +44,7 @@ module Bearcat
44
44
  require 'bearcat/client/rubric'
45
45
  require 'bearcat/client/rubric_assessment'
46
46
  require 'bearcat/client/rubric_association'
47
+ require 'bearcat/client/progresses'
47
48
 
48
49
  include Assignments
49
50
  include Accounts
@@ -84,6 +85,7 @@ module Bearcat
84
85
  include Rubric
85
86
  include RubricAssessment
86
87
  include RubricAssociation
88
+ include Progresses
87
89
 
88
90
  # Override Footrest request for ApiArray support
89
91
  def request(method, &block)
@@ -2,6 +2,10 @@ module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Folders
4
4
 
5
+ def get_course_folder(course, folder, params = {})
6
+ get("/api/v1/courses/#{course}/folders/#{folder}", params)
7
+ end
8
+
5
9
  def list_course_folders(course, params = {})
6
10
  get("/api/v1/courses/#{course}/folders", params)
7
11
  end
@@ -9,6 +13,30 @@ module Bearcat
9
13
  def create_course_folder(course, params = {})
10
14
  post("/api/v1/courses/#{course}/folders", params)
11
15
  end
16
+
17
+ def get_user_folder(user, folder, params)
18
+ get("/api/v1/users/#{user}/folders/#{folder}", params)
19
+ end
20
+
21
+ def list_user_folders(user, params = {})
22
+ get("/api/v1/users/#{user}/folders", params)
23
+ end
24
+
25
+ def create_user_folder(user, params = {})
26
+ post("/api/v1/users/#{user}/folders", params)
27
+ end
28
+
29
+ def get_group_folder(group, folder, params)
30
+ get("/api/v1/groups/#{group}/folders/#{folder}", params)
31
+ end
32
+
33
+ def list_group_folders(group, params = {})
34
+ get("/api/v1/groups/#{group}/folders", params)
35
+ end
36
+
37
+ def create_group_folder(group, params = {})
38
+ post("/api/v1/groups/#{group}/folders", params)
39
+ end
12
40
  end
13
41
  end
14
42
  end
@@ -0,0 +1,10 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module Progresses
4
+
5
+ def progress(progress, params={})
6
+ get("/api/v1/progress/#{progress}", params)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -29,6 +29,14 @@ module Bearcat
29
29
  def create_quiz(course, params={})
30
30
  post("/api/v1/courses/#{course}/quizzes", params)
31
31
  end
32
+
33
+ def create_quiz_report(course, quiz, params={})
34
+ post("/api/v1/courses/#{course}/quizzes/#{quiz}/reports", params)
35
+ end
36
+
37
+ def get_quiz_report(course, quiz, report, params)
38
+ get("/api/v1/courses/#{course}/quizzes/#{quiz}/reports/#{report}", params)
39
+ end
32
40
  end
33
41
  end
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.4.2' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.4.6' 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.4.2
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-07 00:00:00.000000000 Z
11
+ date: 2021-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,6 +164,7 @@ files:
164
164
  - lib/bearcat/client/outcome_groups.rb
165
165
  - lib/bearcat/client/outcomes.rb
166
166
  - lib/bearcat/client/pages.rb
167
+ - lib/bearcat/client/progresses.rb
167
168
  - lib/bearcat/client/quizzes.rb
168
169
  - lib/bearcat/client/reports.rb
169
170
  - lib/bearcat/client/roles.rb
@@ -362,10 +363,10 @@ files:
362
363
  - spec/fixtures/user_page_views.json
363
364
  - spec/fixtures/user_profile.json
364
365
  - spec/helper.rb
365
- homepage:
366
+ homepage:
366
367
  licenses: []
367
368
  metadata: {}
368
- post_install_message:
369
+ post_install_message:
369
370
  rdoc_options: []
370
371
  require_paths:
371
372
  - lib
@@ -380,9 +381,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  - !ruby/object:Gem::Version
381
382
  version: '0'
382
383
  requirements: []
383
- rubyforge_project:
384
- rubygems_version: 2.6.14.1
385
- signing_key:
384
+ rubygems_version: 3.1.2
385
+ signing_key:
386
386
  specification_version: 4
387
387
  summary: Canvas API
388
388
  test_files: