bearcat 1.3.36 → 1.3.37

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94f93958149eef71ce9e198f8c0d565405123777b1d13b72bad4d47b00d34f7a
4
- data.tar.gz: bcfb1094fc6877188d7b791f9acf5c6c0ccdd519a242b14edc0f6519a150e31d
3
+ metadata.gz: 6f276685c4b57737d725263680f095756e05cedc3b690b1f6a680a4cedb610c7
4
+ data.tar.gz: 451bc4c22312b0802260bad468ece4e1c49660c0ef2cbf2c8a0cc22ee98eb4f6
5
5
  SHA512:
6
- metadata.gz: cbb9bfd9a452cf7752bf2f078cc6a8c0f2bf816b1a7c2bbd51a01199c7c421c7d5344425a064b50e73acaba41b2028e51b193a8ea883c17a5b7599f05341487c
7
- data.tar.gz: f6da162dfdf2bab92bcd16811791e882dabe414089577dcb6b0a849b6316179728e750449089f8c3393b58670bc03962d44e71cd15f4ff92473578c13f06f109
6
+ metadata.gz: 6a10afbfd1d0718c1dd80e2af6cda6e3cc06d133db78ecc332724fe75fe6649b1f07964fa45f1bc7aa6dd5ee89eb9d760b2d988546bbb01d74762f5fb15d6134
7
+ data.tar.gz: ee0be0d8181e37c19753e82a5162c71adc76157285e3f4db72b093e0856dec456faeb0e257685881aa2aaa42907c41f8cc953efbe660844f7f4adaf20e8bcd93
@@ -32,6 +32,7 @@ module Bearcat
32
32
  require 'bearcat/client/pages'
33
33
  require 'bearcat/client/files'
34
34
  require 'bearcat/client/folders'
35
+ require 'bearcat/client/graph_ql'
35
36
  require 'bearcat/client/analytics'
36
37
  require 'bearcat/client/module_items'
37
38
  require 'bearcat/client/content_migrations'
@@ -70,6 +71,7 @@ module Bearcat
70
71
  include Pages
71
72
  include Files
72
73
  include Folders
74
+ include GraphQL
73
75
  include ModuleItems
74
76
  include ContentMigrations
75
77
  include ContentExports
@@ -0,0 +1,12 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ # Request body format should be: { query: "query string" }. More info in README.md
4
+ module GraphQL
5
+
6
+ def graphql_query(query)
7
+ post('/api/graphql', query)
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.36' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.37' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -0,0 +1,35 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::GraphQL do
4
+
5
+ let(:url) { '/api/graphql' }
6
+ before do
7
+ @client = Bearcat::Client.new(prefix: 'http://canvas.instructure.com', token: 'test_token')
8
+ end
9
+
10
+ it 'returns scores for an assignment group' do
11
+ query = {
12
+ query: "{
13
+ assignmentGroup(id: \"29\") {
14
+ id
15
+ name
16
+ gradesConnection {
17
+ nodes {
18
+ finalGrade
19
+ finalScore
20
+ enrollment{
21
+ _id
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }"
27
+ }
28
+ stub_post(@client, url).with(body: query).to_return(json_response('graph_ql_scores.json'))
29
+ res = @client.graphql_query(query)
30
+ res['data']['assignmentGroup']['gradesConnection']['nodes'].count.should eq 3
31
+ res['data']['assignmentGroup']['name'].should eq 'Assignments'
32
+ res['data']['assignmentGroup']['gradesConnection']['nodes'][0]['currentScore'].should eq 100
33
+ end
34
+
35
+ end
@@ -0,0 +1,33 @@
1
+ {
2
+ "data": {
3
+ "assignmentGroup": {
4
+ "id": "QXNzaWdubWVudEdyb3VwLTI5",
5
+ "name": "Assignments",
6
+ "gradesConnection": {
7
+ "nodes": [
8
+ {
9
+ "finalGrade": null,
10
+ "currentScore": 100,
11
+ "enrollment": {
12
+ "_id": "63"
13
+ }
14
+ },
15
+ {
16
+ "finalGrade": null,
17
+ "currentScore": 50,
18
+ "enrollment": {
19
+ "_id": "62"
20
+ }
21
+ },
22
+ {
23
+ "finalGrade": null,
24
+ "currentScore": null,
25
+ "enrollment": {
26
+ "_id": "64"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ }
33
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bearcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.36
4
+ version: 1.3.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
@@ -153,6 +153,7 @@ files:
153
153
  - lib/bearcat/client/file_helper.rb
154
154
  - lib/bearcat/client/files.rb
155
155
  - lib/bearcat/client/folders.rb
156
+ - lib/bearcat/client/graph_ql.rb
156
157
  - lib/bearcat/client/group_categories.rb
157
158
  - lib/bearcat/client/group_memberships.rb
158
159
  - lib/bearcat/client/groups.rb
@@ -190,6 +191,7 @@ files:
190
191
  - spec/bearcat/client/external_tools_spec.rb
191
192
  - spec/bearcat/client/files_spec.rb
192
193
  - spec/bearcat/client/folders_spec.rb
194
+ - spec/bearcat/client/graph_ql_spec.rb
193
195
  - spec/bearcat/client/group_categories_spec.rb
194
196
  - spec/bearcat/client/group_membership_spec.rb
195
197
  - spec/bearcat/client/groups_spec.rb
@@ -294,6 +296,7 @@ files:
294
296
  - spec/fixtures/external_tools.json
295
297
  - spec/fixtures/file.csv
296
298
  - spec/fixtures/gradebook_history.json
299
+ - spec/fixtures/graph_ql_scores.json
297
300
  - spec/fixtures/group.json
298
301
  - spec/fixtures/group_categories.json
299
302
  - spec/fixtures/group_category.json
@@ -389,6 +392,7 @@ test_files:
389
392
  - spec/bearcat/client/modules_spec.rb
390
393
  - spec/bearcat/client/discussions_spec.rb
391
394
  - spec/bearcat/client/files_spec.rb
395
+ - spec/bearcat/client/graph_ql_spec.rb
392
396
  - spec/bearcat/client/group_categories_spec.rb
393
397
  - spec/bearcat/client/rubric_assessment_spec.rb
394
398
  - spec/bearcat/client/submissions_spec.rb
@@ -537,6 +541,7 @@ test_files:
537
541
  - spec/fixtures/group_category_groups.json
538
542
  - spec/fixtures/created_group_membership.json
539
543
  - spec/fixtures/user_avatars.json
544
+ - spec/fixtures/graph_ql_scores.json
540
545
  - spec/fixtures/custom_gradebook_columns/custom_gradebook_column.json
541
546
  - spec/fixtures/custom_gradebook_columns/custom_gradebook_columns.json
542
547
  - spec/fixtures/custom_gradebook_columns/column_data.json