canvas_oauth_engine 2.1.1 → 2.2.0

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: b10222793a636d66701b987776c13f86d568ff7db074c3444f5cb9d1b01cd180
4
- data.tar.gz: 1349d736705163172c3e2fd860530bb3f2ab22cee75ae257ef0e163db2cfbf66
3
+ metadata.gz: b2a88f4ee3820d12421b7cc83434d3fc908744397716172d224e21af37470fd2
4
+ data.tar.gz: 6a42eef65c2013ef374c66e698b552dfc1cacb57493804c7cadf11ab8f879705
5
5
  SHA512:
6
- metadata.gz: 3e40c881d9e0872d0e97b3eb6d73b0ed2336ed78427d276fd377e3043fdd57d8d65f8876fc70c806313390b9892db66c4b0a3a343ce73739b1a895134eac1cc5
7
- data.tar.gz: 4fdeb5ec04e2149c839c6234b2f6244e33a45aa11122e8eaa4e00714ecb73cbe2e25c284f704402e7b134b53fbd1546d321404625e7bfa9416e928712ada0e85
6
+ metadata.gz: 12b6b3965bc0bde82bce922c0faebab6bbaff31b71314db70d58f246687cdbd284934f081e938ac47585f2aacc386e7749d8d6d9f05c3ad7b82353cd1012f54b
7
+ data.tar.gz: b232dd7bb61ed83ea6d30dac284b8fd05114823dfb735174db06d27cded7fe565a96a0b3bfa417485b4e41f99e368c9c68a7401b976e340fcda2c054f1fc943b
@@ -74,7 +74,7 @@ module CanvasOauth
74
74
  if report['status'] == 'complete'
75
75
  file_id = report['file_url'].match(/files\/([0-9]+)\/download/)[1]
76
76
  file = get_file(file_id)
77
- return hash_csv(self.class.get(file['url'], limit: 15).parsed_response)
77
+ return hash_csv(self.class.get(file['url'], limit: 15, parser: DefaultUTF8Parser).parsed_response)
78
78
  else
79
79
  return report
80
80
  end
@@ -195,6 +195,10 @@ module CanvasOauth
195
195
  authenticated_post "/api/v1/courses/#{course_id}/assignments", { body: { assignment: params } }
196
196
  end
197
197
 
198
+ def update_assignment(course_id, assignment_id, params)
199
+ authenticated_put "/api/v1/courses/#{course_id}/assignments/#{assignment_id}", { body: { assignment: params } }
200
+ end
201
+
198
202
  def grade_assignment(course_id, assignment_id, user_id, params)
199
203
  authenticated_put "/api/v1/courses/#{course_id}/assignments/#{assignment_id}/submissions/#{user_id}", { body: params }
200
204
  end
@@ -0,0 +1,13 @@
1
+ module CanvasOauth
2
+ # We get into a weird case with the CDN with canvas where the Content-Type for a CSV comes back as text/csv, but there
3
+ # is no associated charset with it. HTTParty will default to treating it as binary (aka ASCII-8BIT) data which causes
4
+ # issues downstream when the data gets combined with local application data. In cases where we can reasonably know
5
+ # it'll be a UTF-8 compatible file (i.e any csv file from canvas) we'll force an encoding of UTF-8 if ruby thinks its
6
+ # ASCII-8BIT
7
+ class DefaultUTF8Parser < HTTParty::Parser
8
+ def parse
9
+ body.force_encoding("UTF-8") if body&.encoding == Encoding::ASCII_8BIT
10
+ super
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module CanvasOauth
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
data/lib/canvas_oauth.rb CHANGED
@@ -8,6 +8,7 @@ require "canvas_oauth/canvas_application"
8
8
  require 'canvas_oauth/canvas_api'
9
9
  require 'canvas_oauth/canvas_api_extensions'
10
10
  require 'canvas_oauth/canvas_config'
11
+ require 'canvas_oauth/default_utf8_parser'
11
12
 
12
13
  module CanvasOauth
13
14
  mattr_accessor :app_root
@@ -43,8 +43,6 @@ module Dummy
43
43
  # like if you have constraints or database-specific column types
44
44
  # config.active_record.schema_format = :sql
45
45
 
46
- config.active_record.sqlite3.represent_boolean_as_integer = true
47
-
48
46
  # Enable the asset pipeline
49
47
  config.assets.enabled = true
50
48
 
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
2
+  (3.7ms) SELECT sqlite_version(*)
3
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
4
+  (1.2ms) SELECT sqlite_version(*)
5
+  (0.1ms) SELECT sqlite_version(*)
6
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
7
+  (1.6ms) SELECT sqlite_version(*)
8
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
9
+  (1.3ms) SELECT sqlite_version(*)
10
+  (0.1ms) SELECT sqlite_version(*)
11
+  (0.0ms) SELECT sqlite_version(*)
12
+  (0.1ms) SELECT sqlite_version(*)
13
+  (0.1ms) DROP TABLE IF EXISTS "canvas_oauth_authorizations"
14
+  (1.3ms) CREATE TABLE "canvas_oauth_authorizations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "canvas_user_id" integer(8), "tool_consumer_instance_guid" varchar NOT NULL, "token" varchar, "last_used_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
15
+  (1.0ms) CREATE INDEX "index_canvas_oauth_auths_on_user_id_and_tciguid" ON "canvas_oauth_authorizations" ("canvas_user_id", "tool_consumer_instance_guid")
16
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
17
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
18
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES (20121121005358)
19
+  (1.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
20
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
21
+ TRANSACTION (0.0ms) begin transaction
22
+ ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2022-03-21 15:32:41.317911"], ["updated_at", "2022-03-21 15:32:41.317911"]]
23
+ TRANSACTION (0.7ms) commit transaction
24
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
25
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "schema_sha1"], ["LIMIT", 1]]
26
+ TRANSACTION (0.0ms) begin transaction
27
+ ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "schema_sha1"], ["value", "fc30e804ce934e09ede366066915736ad77cf98d"], ["created_at", "2022-03-21 15:32:41.321862"], ["updated_at", "2022-03-21 15:32:41.321862"]]
28
+ TRANSACTION (0.8ms) commit transaction
29
+  (0.0ms) SELECT sqlite_version(*)
30
+  (0.1ms) DROP TABLE IF EXISTS "canvas_oauth_authorizations"
31
+  (1.1ms) CREATE TABLE "canvas_oauth_authorizations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "canvas_user_id" integer(8), "tool_consumer_instance_guid" varchar NOT NULL, "token" varchar, "last_used_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
32
+  (1.0ms) CREATE INDEX "index_canvas_oauth_auths_on_user_id_and_tciguid" ON "canvas_oauth_authorizations" ("canvas_user_id", "tool_consumer_instance_guid")
33
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
34
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
35
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES (20121121005358)
36
+  (1.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
37
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
38
+ TRANSACTION (0.0ms) begin transaction
39
+ ActiveRecord::InternalMetadata Create (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2022-03-21 15:32:41.332974"], ["updated_at", "2022-03-21 15:32:41.332974"]]
40
+ TRANSACTION (0.7ms) commit transaction
41
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
42
+ TRANSACTION (0.0ms) begin transaction
43
+ ActiveRecord::InternalMetadata Update (0.4ms) UPDATE "ar_internal_metadata" SET "value" = ?, "updated_at" = ? WHERE "ar_internal_metadata"."key" = ? [["value", "test"], ["updated_at", "2022-03-21 15:32:41.335498"], ["key", "environment"]]
44
+ TRANSACTION (0.8ms) commit transaction
45
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "schema_sha1"], ["LIMIT", 1]]
46
+ TRANSACTION (0.0ms) begin transaction
47
+ ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "schema_sha1"], ["value", "fc30e804ce934e09ede366066915736ad77cf98d"], ["created_at", "2022-03-21 15:32:41.338507"], ["updated_at", "2022-03-21 15:32:41.338507"]]
48
+ TRANSACTION (0.6ms) commit transaction
49
+  (0.1ms) SELECT sqlite_version(*)
@@ -0,0 +1,382 @@
1
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
2
+  (1.6ms) SELECT sqlite_version(*)
3
+ TRANSACTION (0.0ms) begin transaction
4
+ TRANSACTION (0.0ms) rollback transaction
5
+ TRANSACTION (0.0ms) begin transaction
6
+ TRANSACTION (0.0ms) rollback transaction
7
+ TRANSACTION (0.0ms) begin transaction
8
+ TRANSACTION (0.0ms) rollback transaction
9
+ TRANSACTION (0.0ms) begin transaction
10
+ Processing by CanvasOauth::CanvasController#oauth as HTML
11
+ Parameters: {"code"=>"valid", "state"=>"zzyyxx"}
12
+ Rendering text template
13
+ Rendered text template (Duration: 0.0ms | Allocations: 3)
14
+ Completed 200 OK in 10ms (Views: 3.6ms | ActiveRecord: 0.0ms | Allocations: 2549)
15
+ TRANSACTION (0.0ms) rollback transaction
16
+ TRANSACTION (0.0ms) begin transaction
17
+ Processing by CanvasOauth::CanvasController#oauth as HTML
18
+ Parameters: {"code"=>"valid"}
19
+ Rendering text template
20
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
21
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 153)
22
+ TRANSACTION (0.0ms) rollback transaction
23
+ TRANSACTION (0.0ms) begin transaction
24
+ Processing by CanvasOauth::CanvasController#oauth as HTML
25
+ Parameters: {"code"=>"valid"}
26
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.1ms | Allocations: 400)
27
+ TRANSACTION (0.0ms) rollback transaction
28
+ TRANSACTION (0.0ms) begin transaction
29
+ Processing by CanvasOauth::CanvasController#oauth as HTML
30
+ Parameters: {"code"=>"valid"}
31
+ Rendering text template
32
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
33
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 315)
34
+ TRANSACTION (0.0ms) rollback transaction
35
+ TRANSACTION (0.0ms) begin transaction
36
+ Processing by CanvasOauth::CanvasController#oauth as HTML
37
+ Parameters: {"code"=>"invalid"}
38
+ Rendering text template
39
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
40
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 246)
41
+ TRANSACTION (0.0ms) rollback transaction
42
+ TRANSACTION (0.0ms) begin transaction
43
+ Processing by CanvasOauth::CanvasController#oauth as HTML
44
+ Parameters: {"code"=>"valid", "state"=>"mismatch"}
45
+ Rendering text template
46
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
47
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 153)
48
+ TRANSACTION (0.0ms) rollback transaction
49
+ TRANSACTION (0.0ms) begin transaction
50
+ Processing by CanvasOauth::CanvasController#oauth as HTML
51
+ Parameters: {"code"=>"valid", "state"=>"zzyyxx"}
52
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.1ms | Allocations: 282)
53
+ TRANSACTION (0.0ms) rollback transaction
54
+ TRANSACTION (0.0ms) begin transaction
55
+ Processing by CanvasOauth::CanvasController#oauth as HTML
56
+ Rendering text template
57
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
58
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 185)
59
+ TRANSACTION (0.0ms) rollback transaction
60
+ TRANSACTION (0.0ms) begin transaction
61
+ TRANSACTION (0.0ms) rollback transaction
62
+ TRANSACTION (0.0ms) begin transaction
63
+ TRANSACTION (0.0ms) rollback transaction
64
+ TRANSACTION (0.0ms) begin transaction
65
+ TRANSACTION (0.0ms) rollback transaction
66
+ TRANSACTION (0.0ms) begin transaction
67
+ TRANSACTION (0.0ms) rollback transaction
68
+ TRANSACTION (0.0ms) begin transaction
69
+ TRANSACTION (0.0ms) rollback transaction
70
+ TRANSACTION (0.0ms) begin transaction
71
+ TRANSACTION (0.0ms) rollback transaction
72
+ TRANSACTION (0.0ms) begin transaction
73
+ TRANSACTION (0.0ms) rollback transaction
74
+ TRANSACTION (0.0ms) begin transaction
75
+ TRANSACTION (0.0ms) rollback transaction
76
+ TRANSACTION (0.0ms) begin transaction
77
+ TRANSACTION (0.0ms) rollback transaction
78
+ TRANSACTION (0.0ms) begin transaction
79
+ TRANSACTION (0.0ms) rollback transaction
80
+ TRANSACTION (0.0ms) begin transaction
81
+ TRANSACTION (0.0ms) rollback transaction
82
+ TRANSACTION (0.0ms) begin transaction
83
+ TRANSACTION (0.0ms) rollback transaction
84
+ TRANSACTION (0.0ms) begin transaction
85
+ TRANSACTION (0.0ms) rollback transaction
86
+ TRANSACTION (0.0ms) begin transaction
87
+ TRANSACTION (0.0ms) rollback transaction
88
+ TRANSACTION (0.0ms) begin transaction
89
+ TRANSACTION (0.0ms) rollback transaction
90
+ TRANSACTION (0.0ms) begin transaction
91
+ TRANSACTION (0.0ms) rollback transaction
92
+ TRANSACTION (0.0ms) begin transaction
93
+ TRANSACTION (0.0ms) rollback transaction
94
+ TRANSACTION (0.0ms) begin transaction
95
+ TRANSACTION (0.0ms) rollback transaction
96
+ TRANSACTION (0.0ms) begin transaction
97
+ TRANSACTION (0.0ms) rollback transaction
98
+ TRANSACTION (0.0ms) begin transaction
99
+ TRANSACTION (0.0ms) rollback transaction
100
+ TRANSACTION (0.0ms) begin transaction
101
+ TRANSACTION (0.0ms) rollback transaction
102
+ TRANSACTION (0.0ms) begin transaction
103
+ TRANSACTION (0.0ms) rollback transaction
104
+ TRANSACTION (0.0ms) begin transaction
105
+ TRANSACTION (0.0ms) rollback transaction
106
+ TRANSACTION (0.0ms) begin transaction
107
+ TRANSACTION (0.0ms) rollback transaction
108
+ TRANSACTION (0.0ms) begin transaction
109
+ TRANSACTION (0.0ms) rollback transaction
110
+ TRANSACTION (0.0ms) begin transaction
111
+ TRANSACTION (0.0ms) rollback transaction
112
+ TRANSACTION (0.0ms) begin transaction
113
+ TRANSACTION (0.0ms) rollback transaction
114
+ TRANSACTION (0.0ms) begin transaction
115
+ TRANSACTION (0.0ms) rollback transaction
116
+ TRANSACTION (0.0ms) begin transaction
117
+ TRANSACTION (0.0ms) rollback transaction
118
+ TRANSACTION (0.0ms) begin transaction
119
+ TRANSACTION (0.0ms) rollback transaction
120
+ TRANSACTION (0.0ms) begin transaction
121
+ TRANSACTION (0.0ms) rollback transaction
122
+ TRANSACTION (0.1ms) begin transaction
123
+ TRANSACTION (0.0ms) rollback transaction
124
+ TRANSACTION (0.0ms) begin transaction
125
+ TRANSACTION (0.0ms) rollback transaction
126
+ TRANSACTION (0.0ms) begin transaction
127
+ TRANSACTION (0.1ms) rollback transaction
128
+ TRANSACTION (0.1ms) begin transaction
129
+ TRANSACTION (0.0ms) rollback transaction
130
+ TRANSACTION (0.0ms) begin transaction
131
+ TRANSACTION (0.1ms) rollback transaction
132
+ TRANSACTION (0.1ms) begin transaction
133
+ API call (0.06ms): get ["/api/v1/courses/123/assignments", {:query=>{:per_page=>50}, :headers=>{}}]
134
+ TRANSACTION (0.0ms) rollback transaction
135
+ TRANSACTION (0.1ms) begin transaction
136
+ TRANSACTION (0.1ms) rollback transaction
137
+ TRANSACTION (0.0ms) begin transaction
138
+ API call (0.04ms): get ["/api/v1/courses/123", {:headers=>{}}]
139
+ TRANSACTION (0.0ms) rollback transaction
140
+ TRANSACTION (0.0ms) begin transaction
141
+ API call (0.04ms): get ["/api/v1/accounts/1/courses", {:query=>{:per_page=>50}, :headers=>{}}]
142
+ TRANSACTION (0.0ms) rollback transaction
143
+ TRANSACTION (0.0ms) begin transaction
144
+ TRANSACTION (0.1ms) rollback transaction
145
+ TRANSACTION (0.1ms) begin transaction
146
+ API call (0.06ms): get ["/api/v1/accounts/1/users", {:query=>{:per_page=>50}, :headers=>{}}]
147
+ TRANSACTION (0.0ms) rollback transaction
148
+ TRANSACTION (0.0ms) begin transaction
149
+ TRANSACTION (0.0ms) rollback transaction
150
+ TRANSACTION (0.1ms) begin transaction
151
+ TRANSACTION (0.0ms) rollback transaction
152
+ TRANSACTION (0.0ms) begin transaction
153
+ API call (0.03ms): get ["/api/v1/courses/123/students", {:query=>{:per_page=>50}, :headers=>{}}]
154
+ TRANSACTION (0.0ms) rollback transaction
155
+ TRANSACTION (0.0ms) begin transaction
156
+ API call (0.04ms): get ["/api/v1/courses", {:query=>{:per_page=>50}, :headers=>{}}]
157
+ TRANSACTION (0.0ms) rollback transaction
158
+ TRANSACTION (0.0ms) begin transaction
159
+ API call (0.03ms): get ["/api/v1/courses/123/sections", {:query=>{:include=>["students", "avatar_url", "enrollments"], :per_page=>50}, :headers=>{}}]
160
+ TRANSACTION (0.0ms) rollback transaction
161
+ TRANSACTION (0.0ms) begin transaction
162
+ TRANSACTION (0.0ms) rollback transaction
163
+ TRANSACTION (0.0ms) begin transaction
164
+ TRANSACTION (0.0ms) rollback transaction
165
+ TRANSACTION (0.0ms) begin transaction
166
+ API call (0.03ms): put ["/api/v1/courses/123/assignments/345", {:body=>{:assignment=>{:omit_from_final_grade=>true}}, :headers=>{}}]
167
+ TRANSACTION (0.0ms) rollback transaction
168
+ TRANSACTION (0.0ms) begin transaction
169
+ API call (0.03ms): post ["/api/v1/courses/123/assignments", {:body=>{:assignment=>{:name=>"Assignment"}}, :headers=>{}}]
170
+ TRANSACTION (0.0ms) rollback transaction
171
+ TRANSACTION (0.0ms) begin transaction
172
+ TRANSACTION (0.0ms) rollback transaction
173
+ TRANSACTION (0.0ms) begin transaction
174
+ API call (0.03ms): get ["/api/v1/users/123/profile", {:headers=>{}}]
175
+ TRANSACTION (0.0ms) rollback transaction
176
+ TRANSACTION (0.0ms) begin transaction
177
+ API call (0.03ms): put ["/api/v1/courses/1/assignments/2/submissions/3", {:body=>{}, :headers=>{}}]
178
+ TRANSACTION (0.0ms) rollback transaction
179
+ TRANSACTION (0.0ms) begin transaction
180
+ TRANSACTION (0.0ms) rollback transaction
181
+ TRANSACTION (0.0ms) begin transaction
182
+ API call (0.04ms): get ["/path", {:headers=>{}}]
183
+ TRANSACTION (0.0ms) rollback transaction
184
+ TRANSACTION (0.0ms) begin transaction
185
+ API call (0.03ms): get ["/path", {:headers=>{}}]
186
+ TRANSACTION (0.0ms) rollback transaction
187
+ TRANSACTION (0.0ms) begin transaction
188
+ API call (0.03ms): get ["/path", {:query=>"stuff", :headers=>{}}]
189
+ TRANSACTION (0.0ms) rollback transaction
190
+ TRANSACTION (0.0ms) begin transaction
191
+ TRANSACTION (0.0ms) rollback transaction
192
+ Initializing Canvas using configuration in /Users/murilo.paiva/Desktop/www/Instructure/canvas_oauth_engine/spec/dummy/config/canvas.yml
193
+  (1.7ms) SELECT sqlite_version(*)
194
+ TRANSACTION (0.0ms) begin transaction
195
+ TRANSACTION (0.0ms) rollback transaction
196
+ TRANSACTION (0.0ms) begin transaction
197
+ TRANSACTION (0.0ms) rollback transaction
198
+ TRANSACTION (0.0ms) begin transaction
199
+ TRANSACTION (0.0ms) rollback transaction
200
+ TRANSACTION (0.0ms) begin transaction
201
+ TRANSACTION (0.0ms) rollback transaction
202
+ TRANSACTION (0.0ms) begin transaction
203
+ TRANSACTION (0.0ms) rollback transaction
204
+ TRANSACTION (0.0ms) begin transaction
205
+ TRANSACTION (0.0ms) rollback transaction
206
+ TRANSACTION (0.0ms) begin transaction
207
+ TRANSACTION (0.0ms) rollback transaction
208
+ TRANSACTION (0.0ms) begin transaction
209
+ TRANSACTION (0.0ms) rollback transaction
210
+ TRANSACTION (0.0ms) begin transaction
211
+ TRANSACTION (0.0ms) rollback transaction
212
+ TRANSACTION (0.0ms) begin transaction
213
+ TRANSACTION (0.0ms) rollback transaction
214
+ TRANSACTION (0.0ms) begin transaction
215
+ API call (0.03ms): get ["/api/v1/courses/123/assignments", {:query=>{:per_page=>50}, :headers=>{}}]
216
+ TRANSACTION (0.0ms) rollback transaction
217
+ TRANSACTION (0.0ms) begin transaction
218
+ TRANSACTION (0.0ms) rollback transaction
219
+ TRANSACTION (0.0ms) begin transaction
220
+ API call (0.02ms): get ["/api/v1/courses", {:query=>{:per_page=>50}, :headers=>{}}]
221
+ TRANSACTION (0.0ms) rollback transaction
222
+ TRANSACTION (0.0ms) begin transaction
223
+ API call (0.02ms): get ["/api/v1/courses/123/students", {:query=>{:per_page=>50}, :headers=>{}}]
224
+ TRANSACTION (0.0ms) rollback transaction
225
+ TRANSACTION (0.0ms) begin transaction
226
+ TRANSACTION (0.0ms) rollback transaction
227
+ TRANSACTION (0.0ms) begin transaction
228
+ TRANSACTION (0.0ms) rollback transaction
229
+ TRANSACTION (0.0ms) begin transaction
230
+ API call (0.02ms): get ["/api/v1/users/123/profile", {:headers=>{}}]
231
+ TRANSACTION (0.0ms) rollback transaction
232
+ TRANSACTION (0.0ms) begin transaction
233
+ API call (0.02ms): put ["/api/v1/courses/1/assignments/2/submissions/3", {:body=>{}, :headers=>{}}]
234
+ TRANSACTION (0.0ms) rollback transaction
235
+ TRANSACTION (0.0ms) begin transaction
236
+ TRANSACTION (0.0ms) rollback transaction
237
+ TRANSACTION (0.0ms) begin transaction
238
+ API call (0.02ms): post ["/api/v1/courses/123/assignments", {:body=>{:assignment=>{:name=>"Assignment"}}, :headers=>{}}]
239
+ TRANSACTION (0.0ms) rollback transaction
240
+ TRANSACTION (0.0ms) begin transaction
241
+ TRANSACTION (0.0ms) rollback transaction
242
+ TRANSACTION (0.0ms) begin transaction
243
+ TRANSACTION (0.0ms) rollback transaction
244
+ TRANSACTION (0.0ms) begin transaction
245
+ API call (0.02ms): put ["/api/v1/courses/123/assignments/345", {:body=>{:assignment=>{:omit_from_final_grade=>true}}, :headers=>{}}]
246
+ TRANSACTION (0.0ms) rollback transaction
247
+ TRANSACTION (0.0ms) begin transaction
248
+ API call (0.02ms): get ["/api/v1/accounts/1/courses", {:query=>{:per_page=>50}, :headers=>{}}]
249
+ TRANSACTION (0.0ms) rollback transaction
250
+ TRANSACTION (0.0ms) begin transaction
251
+ TRANSACTION (0.0ms) rollback transaction
252
+ TRANSACTION (0.0ms) begin transaction
253
+ API call (0.02ms): get ["/api/v1/courses/123", {:headers=>{}}]
254
+ TRANSACTION (0.0ms) rollback transaction
255
+ TRANSACTION (0.0ms) begin transaction
256
+ API call (0.03ms): get ["/api/v1/accounts/1/users", {:query=>{:per_page=>50}, :headers=>{}}]
257
+ TRANSACTION (0.0ms) rollback transaction
258
+ TRANSACTION (0.0ms) begin transaction
259
+ TRANSACTION (0.0ms) rollback transaction
260
+ TRANSACTION (0.0ms) begin transaction
261
+ API call (0.07ms): get ["/api/v1/courses/123/sections", {:query=>{:include=>["students", "avatar_url", "enrollments"], :per_page=>50}, :headers=>{}}]
262
+ TRANSACTION (0.0ms) rollback transaction
263
+ TRANSACTION (0.1ms) begin transaction
264
+ TRANSACTION (0.0ms) rollback transaction
265
+ TRANSACTION (0.0ms) begin transaction
266
+ API call (0.05ms): get ["/path", {:query=>"stuff", :headers=>{}}]
267
+ TRANSACTION (0.0ms) rollback transaction
268
+ TRANSACTION (0.0ms) begin transaction
269
+ API call (0.06ms): get ["/path", {:headers=>{}}]
270
+ TRANSACTION (0.0ms) rollback transaction
271
+ TRANSACTION (0.0ms) begin transaction
272
+ API call (0.06ms): get ["/path", {:headers=>{}}]
273
+ TRANSACTION (0.0ms) rollback transaction
274
+ TRANSACTION (0.0ms) begin transaction
275
+ TRANSACTION (0.1ms) rollback transaction
276
+ TRANSACTION (0.1ms) begin transaction
277
+ TRANSACTION (0.1ms) rollback transaction
278
+ TRANSACTION (0.0ms) begin transaction
279
+ TRANSACTION (0.0ms) rollback transaction
280
+ TRANSACTION (0.0ms) begin transaction
281
+ TRANSACTION (0.1ms) rollback transaction
282
+ TRANSACTION (0.1ms) begin transaction
283
+ TRANSACTION (0.0ms) rollback transaction
284
+ TRANSACTION (0.0ms) begin transaction
285
+ TRANSACTION (0.0ms) rollback transaction
286
+ TRANSACTION (0.0ms) begin transaction
287
+ TRANSACTION (0.0ms) rollback transaction
288
+ TRANSACTION (0.0ms) begin transaction
289
+ TRANSACTION (0.0ms) rollback transaction
290
+ TRANSACTION (0.0ms) begin transaction
291
+ TRANSACTION (0.0ms) rollback transaction
292
+ TRANSACTION (0.0ms) begin transaction
293
+ TRANSACTION (0.0ms) rollback transaction
294
+ TRANSACTION (0.0ms) begin transaction
295
+ TRANSACTION (0.1ms) rollback transaction
296
+ TRANSACTION (0.0ms) begin transaction
297
+ TRANSACTION (0.0ms) rollback transaction
298
+ TRANSACTION (0.0ms) begin transaction
299
+ TRANSACTION (0.0ms) rollback transaction
300
+ TRANSACTION (0.0ms) begin transaction
301
+ TRANSACTION (0.0ms) rollback transaction
302
+ TRANSACTION (0.0ms) begin transaction
303
+ TRANSACTION (0.1ms) rollback transaction
304
+ TRANSACTION (0.0ms) begin transaction
305
+ TRANSACTION (0.0ms) rollback transaction
306
+ TRANSACTION (0.0ms) begin transaction
307
+ TRANSACTION (0.0ms) rollback transaction
308
+ TRANSACTION (0.0ms) begin transaction
309
+ Processing by CanvasOauth::CanvasController#oauth as HTML
310
+ Parameters: {"code"=>"invalid"}
311
+ Rendering text template
312
+ Rendered text template (Duration: 0.0ms | Allocations: 3)
313
+ Completed 200 OK in 12ms (Views: 4.5ms | ActiveRecord: 0.0ms | Allocations: 2642)
314
+ TRANSACTION (0.0ms) rollback transaction
315
+ TRANSACTION (0.0ms) begin transaction
316
+ Processing by CanvasOauth::CanvasController#oauth as HTML
317
+ Parameters: {"code"=>"valid"}
318
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.1ms | Allocations: 399)
319
+ TRANSACTION (0.0ms) rollback transaction
320
+ TRANSACTION (0.0ms) begin transaction
321
+ Processing by CanvasOauth::CanvasController#oauth as HTML
322
+ Parameters: {"code"=>"valid"}
323
+ Rendering text template
324
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
325
+ Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 312)
326
+ TRANSACTION (0.0ms) rollback transaction
327
+ TRANSACTION (0.0ms) begin transaction
328
+ Processing by CanvasOauth::CanvasController#oauth as HTML
329
+ Rendering text template
330
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
331
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 185)
332
+ TRANSACTION (0.0ms) rollback transaction
333
+ TRANSACTION (0.0ms) begin transaction
334
+ Processing by CanvasOauth::CanvasController#oauth as HTML
335
+ Parameters: {"code"=>"valid", "state"=>"mismatch"}
336
+ Rendering text template
337
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
338
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 153)
339
+ TRANSACTION (0.1ms) rollback transaction
340
+ TRANSACTION (0.0ms) begin transaction
341
+ Processing by CanvasOauth::CanvasController#oauth as HTML
342
+ Parameters: {"code"=>"valid", "state"=>"zzyyxx"}
343
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.1ms | Allocations: 282)
344
+ TRANSACTION (0.0ms) rollback transaction
345
+ TRANSACTION (0.0ms) begin transaction
346
+ Processing by CanvasOauth::CanvasController#oauth as HTML
347
+ Parameters: {"code"=>"valid", "state"=>"zzyyxx"}
348
+ Rendering text template
349
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
350
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 153)
351
+ TRANSACTION (0.0ms) rollback transaction
352
+ TRANSACTION (0.0ms) begin transaction
353
+ Processing by CanvasOauth::CanvasController#oauth as HTML
354
+ Parameters: {"code"=>"valid"}
355
+ Rendering text template
356
+ Rendered text template (Duration: 0.0ms | Allocations: 1)
357
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 153)
358
+ TRANSACTION (0.0ms) rollback transaction
359
+ TRANSACTION (0.0ms) begin transaction
360
+ TRANSACTION (0.0ms) rollback transaction
361
+ TRANSACTION (0.0ms) begin transaction
362
+ TRANSACTION (0.0ms) rollback transaction
363
+ TRANSACTION (0.0ms) begin transaction
364
+ TRANSACTION (0.0ms) rollback transaction
365
+ TRANSACTION (0.0ms) begin transaction
366
+ TRANSACTION (0.0ms) rollback transaction
367
+ TRANSACTION (0.0ms) begin transaction
368
+ TRANSACTION (0.1ms) rollback transaction
369
+ TRANSACTION (0.1ms) begin transaction
370
+ TRANSACTION (0.1ms) rollback transaction
371
+ TRANSACTION (0.1ms) begin transaction
372
+ TRANSACTION (0.0ms) rollback transaction
373
+ TRANSACTION (0.0ms) begin transaction
374
+ TRANSACTION (0.0ms) rollback transaction
375
+ TRANSACTION (0.0ms) begin transaction
376
+ TRANSACTION (0.0ms) rollback transaction
377
+ TRANSACTION (0.0ms) begin transaction
378
+ TRANSACTION (0.0ms) rollback transaction
379
+ TRANSACTION (0.0ms) begin transaction
380
+ TRANSACTION (0.0ms) rollback transaction
381
+ TRANSACTION (0.0ms) begin transaction
382
+ TRANSACTION (0.0ms) rollback transaction
@@ -174,6 +174,20 @@ describe CanvasOauth::CanvasApi do
174
174
  end
175
175
  end
176
176
 
177
+ describe "update_assignment" do
178
+ it "puts to /api/v1/courses/:course_id/assignments/:id" do
179
+ expect(CanvasOauth::CanvasApi).to receive(:put).with('/api/v1/courses/123/assignments/345', anything())
180
+ canvas.update_assignment('123', '345', omit_from_final_grade: true)
181
+ end
182
+
183
+ it "sets the body of the request to the assignment params" do
184
+ expect(canvas).to receive(:authenticated_put).
185
+ with(anything(), { body: { assignment: { omit_from_final_grade: true }}})
186
+
187
+ canvas.update_assignment('123', '345', omit_from_final_grade: true)
188
+ end
189
+ end
190
+
177
191
  describe "grade_assignment" do
178
192
  it "puts to /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:id" do
179
193
  expect(CanvasOauth::CanvasApi).to receive(:put).with('/api/v1/courses/1/assignments/2/submissions/3', anything())
@@ -257,6 +271,13 @@ describe CanvasOauth::CanvasApi do
257
271
  expect(canvas).to receive(:authenticated_get).exactly(3).times.and_return(created, running, aborted)
258
272
  canvas.get_report(1, :provisioning_csv, params)
259
273
  end
274
+
275
+ it "uses the default UTF 8 parser it its get call" do
276
+ allow(canvas).to receive(:authenticated_get).and_return(complete)
277
+ expect(canvas).to receive(:authenticated_post).with("/api/v1/accounts/1/reports/provisioning_csv", { body: params })
278
+ expect(CanvasOauth::CanvasApi).to receive(:get).with(file['url'], hash_including(parser: CanvasOauth::DefaultUTF8Parser)).and_return(response)
279
+ canvas.get_report(1, :provisioning_csv, params)
280
+ end
260
281
  end
261
282
  end
262
283
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe CanvasOauth::DefaultUTF8Parser do
4
+ describe "#parse" do
5
+ it "forces the body passed in to UTF-8 if it is ASCII_8BIT" do
6
+ body = String.new("I am some text", encoding: Encoding::ASCII_8BIT)
7
+
8
+ parser = CanvasOauth::DefaultUTF8Parser.new(body, "text/plain")
9
+ expect(body).to receive(:force_encoding).with("UTF-8")
10
+ parser.parse
11
+ end
12
+
13
+ it "does not force the body passed in to UTF-8 if not ASCII_8BIT" do
14
+ body = String.new("I am some text", encoding: Encoding::US_ASCII)
15
+
16
+ parser = CanvasOauth::DefaultUTF8Parser.new(body, "text/plain")
17
+ expect(body).not_to receive(:force_encoding)
18
+ parser.parse
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_oauth_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Donahue
8
8
  - Adam Anderson
9
9
  - Simon Williams
10
- autorequire:
10
+ - Keith Garner
11
+ autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2019-08-09 00:00:00.000000000 Z
14
+ date: 2022-03-22 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rails
@@ -19,9 +20,9 @@ dependencies:
19
20
  - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: '4.2'
22
- - - "<"
23
+ - - "<="
23
24
  - !ruby/object:Gem::Version
24
- version: '5.3'
25
+ version: 6.1.4.2
25
26
  type: :runtime
26
27
  prerelease: false
27
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,23 +30,23 @@ dependencies:
29
30
  - - ">="
30
31
  - !ruby/object:Gem::Version
31
32
  version: '4.2'
32
- - - "<"
33
+ - - "<="
33
34
  - !ruby/object:Gem::Version
34
- version: '5.3'
35
+ version: 6.1.4.2
35
36
  - !ruby/object:Gem::Dependency
36
37
  name: httparty
37
38
  requirement: !ruby/object:Gem::Requirement
38
39
  requirements:
39
40
  - - ">="
40
41
  - !ruby/object:Gem::Version
41
- version: 0.9.0
42
+ version: 0.17.0
42
43
  type: :runtime
43
44
  prerelease: false
44
45
  version_requirements: !ruby/object:Gem::Requirement
45
46
  requirements:
46
47
  - - ">="
47
48
  - !ruby/object:Gem::Version
48
- version: 0.9.0
49
+ version: 0.17.0
49
50
  - !ruby/object:Gem::Dependency
50
51
  name: link_header
51
52
  requirement: !ruby/object:Gem::Requirement
@@ -60,6 +61,20 @@ dependencies:
60
61
  - - '='
61
62
  - !ruby/object:Gem::Version
62
63
  version: 0.0.8
64
+ - !ruby/object:Gem::Dependency
65
+ name: sprockets
66
+ requirement: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '='
69
+ - !ruby/object:Gem::Version
70
+ version: 3.7.2
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 3.7.2
63
78
  - !ruby/object:Gem::Dependency
64
79
  name: sqlite3
65
80
  requirement: !ruby/object:Gem::Requirement
@@ -186,6 +201,20 @@ dependencies:
186
201
  - - "~>"
187
202
  - !ruby/object:Gem::Version
188
203
  version: 3.0.6
204
+ - !ruby/object:Gem::Dependency
205
+ name: sprockets
206
+ requirement: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - "~>"
209
+ - !ruby/object:Gem::Version
210
+ version: '3.0'
211
+ type: :development
212
+ prerelease: false
213
+ version_requirements: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - "~>"
216
+ - !ruby/object:Gem::Version
217
+ version: '3.0'
189
218
  - !ruby/object:Gem::Dependency
190
219
  name: rb-fsevent
191
220
  requirement: !ruby/object:Gem::Requirement
@@ -214,10 +243,10 @@ dependencies:
214
243
  - - ">="
215
244
  - !ruby/object:Gem::Version
216
245
  version: '0'
217
- description:
246
+ description:
218
247
  email:
219
- - adam.anderson@12spokes.com
220
248
  - simon@instructure.com
249
+ - kgarner@instructure.com
221
250
  executables: []
222
251
  extensions: []
223
252
  extra_rdoc_files: []
@@ -237,6 +266,7 @@ files:
237
266
  - lib/canvas_oauth/canvas_application.rb
238
267
  - lib/canvas_oauth/canvas_config.rb
239
268
  - lib/canvas_oauth/config.rb
269
+ - lib/canvas_oauth/default_utf8_parser.rb
240
270
  - lib/canvas_oauth/engine.rb
241
271
  - lib/canvas_oauth/version.rb
242
272
  - lib/tasks/canvas_oauth_tasks.rake
@@ -262,8 +292,12 @@ files:
262
292
  - spec/dummy/config/initializers/wrap_parameters.rb
263
293
  - spec/dummy/config/locales/en.yml
264
294
  - spec/dummy/config/routes.rb
295
+ - spec/dummy/db/development.sqlite3
265
296
  - spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
266
297
  - spec/dummy/db/schema.rb
298
+ - spec/dummy/db/test.sqlite3
299
+ - spec/dummy/log/development.log
300
+ - spec/dummy/log/test.log
267
301
  - spec/dummy/public/404.html
268
302
  - spec/dummy/public/422.html
269
303
  - spec/dummy/public/500.html
@@ -272,12 +306,13 @@ files:
272
306
  - spec/dummy/script/rails
273
307
  - spec/lib/canvas_oauth/canvas_api_extensions_spec.rb
274
308
  - spec/lib/canvas_oauth/canvas_api_spec.rb
309
+ - spec/lib/canvas_oauth/default_utf8_parser_spec.rb
275
310
  - spec/models/canvas_oauth/authorization_spec.rb
276
311
  - spec/spec_helper.rb
277
312
  homepage: ''
278
313
  licenses: []
279
314
  metadata: {}
280
- post_install_message:
315
+ post_install_message:
281
316
  rdoc_options: []
282
317
  require_paths:
283
318
  - lib
@@ -292,9 +327,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
327
  - !ruby/object:Gem::Version
293
328
  version: '0'
294
329
  requirements: []
295
- rubyforge_project:
296
- rubygems_version: 2.7.6
297
- signing_key:
330
+ rubygems_version: 3.0.3
331
+ signing_key:
298
332
  specification_version: 4
299
333
  summary: CanvasOauth is a mountable engine for handling the oauth workflow with canvas
300
334
  and making api calls from your rails app.
@@ -327,9 +361,14 @@ test_files:
327
361
  - spec/dummy/public/404.html
328
362
  - spec/dummy/public/robots.txt
329
363
  - spec/dummy/db/schema.rb
364
+ - spec/dummy/db/test.sqlite3
330
365
  - spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
366
+ - spec/dummy/db/development.sqlite3
367
+ - spec/dummy/log/test.log
368
+ - spec/dummy/log/development.log
331
369
  - spec/dummy/README.rdoc
332
370
  - spec/models/canvas_oauth/authorization_spec.rb
333
371
  - spec/lib/canvas_oauth/canvas_api_extensions_spec.rb
372
+ - spec/lib/canvas_oauth/default_utf8_parser_spec.rb
334
373
  - spec/lib/canvas_oauth/canvas_api_spec.rb
335
374
  - spec/controllers/canvas_oauth/canvas_controller_spec.rb