lms-api 1.6.0 → 1.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8531b2746cf8dd2e661317425da76bfe75e3ce388d7ff74afcd85a2adf4f19fe
4
- data.tar.gz: 6897217f3d26d867f7cbd544aa0eb9de9b9a13e3d962cf9fdd6962a6d681111e
3
+ metadata.gz: cfdadf2200be462a012cdccd773efee7ff0ce566cc40ba7d8062f246f9b5d76b
4
+ data.tar.gz: 12a5fa4ed4c48d9a6d57d44ec9da53eb32acb254d7d410d728e615ab3208407c
5
5
  SHA512:
6
- metadata.gz: 684e94fb5bb340b9cd3bb681019f7a7181cbfbba71124a835d02d8be73196d84b045e84234c47c26298e1d9376784fb2591535d7e665fd3b2caa19f8acb42c23
7
- data.tar.gz: 82147cf030d0d1c0728ab23c40e05fa97b0f41e78e2d869cb4a4f9e5ea6c1c50f3aa4a690495af7a1c20d6e67434e6dcc75b1f75d6b2e22477f7279ee1bb1c44
6
+ metadata.gz: f2f7ca6d901355ab2ff3937a5303ed27442250b5da4603d26108e17153947aaba327000a51722d3a185873e18e49f124273f040244adf1d5aa90d60ef143b699
7
+ data.tar.gz: c0b472cf81cd8ebabddfb957ab6849c3d5f124d796bdc15716b49b433c845a127753437878f51e2e6c6ad3608f2abfb04a6d7d3d8722aa2b2cb3d5eb3dd0aa5b
data/lib/lms/canvas.rb CHANGED
@@ -177,7 +177,7 @@ module LMS
177
177
  result = HTTParty.post(url, headers: headers, body: payload)
178
178
  code = result.response.code.to_i
179
179
  unless [200, 201].include?(code)
180
- raise LMS::Canvas::RefreshTokenFailedException.new(api_error(result), code, result)
180
+ raise LMS::Canvas::RefreshTokenFailedException.new(api_error(result), code, result, @authentication)
181
181
  end
182
182
  result["access_token"]
183
183
  end
@@ -188,7 +188,7 @@ module LMS
188
188
  return result if [200, 201, 202, 203, 204, 205, 206].include?(code)
189
189
 
190
190
  if code == 401 && result.headers["www-authenticate"] == 'Bearer realm="canvas-lms"'
191
- raise LMS::Canvas::RefreshTokenRequired.new("", nil, @authentication)
191
+ raise LMS::Canvas::RefreshTokenRequired.new("", nil, result, @authentication)
192
192
  end
193
193
 
194
194
  raise LMS::Canvas::InvalidAPIRequestException.new(api_error(result), code, result)
@@ -387,19 +387,22 @@ module LMS
387
387
  end
388
388
  end
389
389
 
390
- class RefreshTokenRequired < CanvasException
390
+ class TokenException < CanvasException
391
391
  attr_reader :auth
392
392
 
393
- def initialize(msg = "", status = nil, auth = nil)
394
- super(msg, status)
393
+ def initialize(message = "", status = nil, result = nil, auth = nil)
394
+ super(message, status, result)
395
395
  @auth = auth
396
396
  end
397
397
  end
398
398
 
399
- class InvalidRefreshOptionsException < CanvasException
399
+ class RefreshTokenRequired < TokenException
400
+ end
401
+
402
+ class RefreshTokenFailedException < TokenException
400
403
  end
401
404
 
402
- class RefreshTokenFailedException < CanvasException
405
+ class InvalidRefreshOptionsException < CanvasException
403
406
  end
404
407
 
405
408
  class InvalidAPIRequestException < CanvasException
@@ -17,7 +17,7 @@ module LMS
17
17
  "GET_SINGLE_ACCOUNT" => { uri: ->(id:) { "accounts/#{id}" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"id", "type"=>"string", "format"=>nil, "required"=>true}] },
18
18
  "PERMISSIONS" => { uri: ->(account_id:) { "accounts/#{account_id}/permissions" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}, {"paramType"=>"query", "name"=>"permissions", "type"=>"array", "format"=>nil, "required"=>false, "items"=>{"type"=>"string"}}] },
19
19
  "GET_SUB_ACCOUNTS_OF_ACCOUNT" => { uri: ->(account_id:) { "accounts/#{account_id}/sub_accounts" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}, {"paramType"=>"query", "name"=>"recursive", "type"=>"boolean", "format"=>nil, "required"=>false}] },
20
- "RETURNS_TERMS_OF_SERVICE_FOR_THAT_ACCOUNT" => { uri: ->(account_id:) { "accounts/#{account_id}/terms_of_service" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}] },
20
+ "GET_TERMS_OF_SERVICE" => { uri: ->(account_id:) { "accounts/#{account_id}/terms_of_service" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}] },
21
21
  "LIST_ACTIVE_COURSES_IN_ACCOUNT" => { uri: ->(account_id:) { "accounts/#{account_id}/courses" }, method: "GET", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}, {"paramType"=>"query", "name"=>"with_enrollments", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"enrollment_type", "type"=>"array", "format"=>nil, "required"=>false, "enum"=>["teacher", "student", "ta", "observer", "designer"], "items"=>{"type"=>"string"}}, {"paramType"=>"query", "name"=>"published", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"completed", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"blueprint", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"blueprint_associated", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"by_teachers", "type"=>"array", "format"=>"int64", "required"=>false, "items"=>{"type"=>"integer"}}, {"paramType"=>"query", "name"=>"by_subaccounts", "type"=>"array", "format"=>"int64", "required"=>false, "items"=>{"type"=>"integer"}}, {"paramType"=>"query", "name"=>"hide_enrollmentless_courses", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"state", "type"=>"array", "format"=>nil, "required"=>false, "enum"=>["created", "claimed", "available", "completed", "deleted", "all"], "items"=>{"type"=>"string"}}, {"paramType"=>"query", "name"=>"enrollment_term_id", "type"=>"integer", "format"=>"int64", "required"=>false}, {"paramType"=>"query", "name"=>"search_term", "type"=>"string", "format"=>nil, "required"=>false}, {"paramType"=>"query", "name"=>"include", "type"=>"array", "format"=>nil, "required"=>false, "enum"=>["syllabus_body", "term", "course_progress", "storage_quota_used_mb", "total_students", "teachers", "account_name"], "items"=>{"type"=>"string"}}, {"paramType"=>"query", "name"=>"sort", "type"=>"string", "format"=>nil, "required"=>false, "enum"=>["course_name", "sis_course_id", "teacher", "account_name"]}, {"paramType"=>"query", "name"=>"order", "type"=>"string", "format"=>nil, "required"=>false, "enum"=>["asc", "desc"]}, {"paramType"=>"query", "name"=>"search_by", "type"=>"string", "format"=>nil, "required"=>false, "enum"=>["course", "teacher"]}] },
22
22
  "UPDATE_ACCOUNT" => { uri: ->(id:) { "accounts/#{id}" }, method: "PUT", parameters: [{"paramType"=>"path", "name"=>"id", "type"=>"string", "format"=>nil, "required"=>true}, {"paramType"=>"form", "name"=>"account[name]", "type"=>"string", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[sis_account_id]", "type"=>"string", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[default_time_zone]", "type"=>"string", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[default_storage_quota_mb]", "type"=>"integer", "format"=>"int64", "required"=>false}, {"paramType"=>"form", "name"=>"account[default_user_storage_quota_mb]", "type"=>"integer", "format"=>"int64", "required"=>false}, {"paramType"=>"form", "name"=>"account[default_group_storage_quota_mb]", "type"=>"integer", "format"=>"int64", "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_past_view][value]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_past_view][locked]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_future_view][value]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_future_view][locked]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][lock_all_announcements][value]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][lock_all_announcements][locked]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_future_listing][value]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[settings][restrict_student_future_listing][locked]", "type"=>"boolean", "format"=>nil, "required"=>false}, {"paramType"=>"form", "name"=>"account[services]", "type"=>"Hash", "format"=>nil, "required"=>false}] },
23
23
  "DELETE_USER_FROM_ROOT_ACCOUNT" => { uri: ->(account_id:, user_id:) { "accounts/#{account_id}/users/#{user_id}" }, method: "DELETE", parameters: [{"paramType"=>"path", "name"=>"account_id", "type"=>"string", "format"=>nil, "required"=>true}, {"paramType"=>"path", "name"=>"user_id", "type"=>"string", "format"=>nil, "required"=>true}] },
data/lib/lms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LMS
2
- VERSION = "1.6.0".freeze
2
+ VERSION = "1.7.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lms-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atomic Jolt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-08-17 00:00:00.000000000 Z
13
+ date: 2018-10-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport