absorb_api 0.1.5 → 0.1.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
2
  SHA1:
3
- metadata.gz: 5387f031cc50ad89f0af07737f46ececb7193ae2
4
- data.tar.gz: c8f6b4e99484161d9bd07215aab7ac03c9475141
3
+ metadata.gz: 29ac6927feaf3f06a8b8cc7d1c67f83696e34300
4
+ data.tar.gz: f1dff5922ac85bdf95aa3f0f742c9401e0e1da00
5
5
  SHA512:
6
- metadata.gz: 45b6490be166ec18e27f3a671bef8d738111d8107771996891970c47c12e5ffda6bb2a0dd0be4b40f6bab66b48716571998a717fca8f67d45691c6e22292dc05
7
- data.tar.gz: a2c4aae967b2921d9576960b7c24c6d9c3ee5a52250ab1d1d5ee6bbcf8d666070d1a8286a530e58190b2cedb282bb672a75d0f782f318bab978f710b51e9e38e
6
+ metadata.gz: e3af4ec6f0fecc9c48b305155cc2fce09ce1292feb4510347cfc4baa7eadcbf633176c671d8c3c4680c743e44ade1406d3ed9d7da13806de36d15f358aff29f5
7
+ data.tar.gz: 514173a715b6d9c2db6637e263d9b2e55dcc81641c86b14427161adaece3189ba05a2169e32f8509178f4542731b0f7142d89a532c94347c2daf86273acd08c3
data/README.md CHANGED
@@ -17,6 +17,12 @@ Full documentation can be found at [http://npezza93.github.io/absorb_api/](http:
17
17
  * [Chapter](#chapter)
18
18
  * [Curriculum](#curriculum)
19
19
  * [Department](#department)
20
+ * [Role](#role)
21
+ * [Tag](#tag)
22
+ * [SessionSchedule](#sessionschedule)
23
+ * [Resource](#resource)
24
+ * [Prerequisite](#prerequisite)
25
+ * [Lesson](#lesson)
20
26
  * [CourseEnrollment](#courseenrollment)
21
27
  * [LessonEnrollment](#lessonenrollment)
22
28
  4. [Development](#development)
@@ -73,6 +79,9 @@ user.certificates
73
79
  # To return a single certificate for a specific user
74
80
  user.find_certificate(id)
75
81
 
82
+ # To return a collection of all resources available to an user
83
+ user.resources
84
+
76
85
  # To return a collection of all courses available for enrollment for a user
77
86
  user.courses
78
87
 
@@ -110,7 +119,7 @@ course.enrollments
110
119
  # Available filters for enrollments include status and modifiedSince
111
120
  course.enrollments(status: 0, modifiedSince: DateTime.new(2016, 1, 1).to_s)
112
121
 
113
- # To return a collection of all certificates awarded to a user
122
+ # To return a collection of all certificates awarded in a course
114
123
  course.certificates
115
124
  # Available filters for certificates include includeExpired, acquiredDate, and expiryDate
116
125
  course.certificates(includeExpired: true)
@@ -122,6 +131,19 @@ course.chapters
122
131
  # To return a single chapters for a specific course
123
132
  course.find_chapter(id)
124
133
 
134
+ # To return a collection of all resources available to a course
135
+ course.resources
136
+ # To return a single resource for a specific course
137
+ course.find_resource(id)
138
+
139
+ # To return a collection of all prerequisites to a course
140
+ course.prerequisites
141
+
142
+ # To return a collection of all lessons available to a course
143
+ course.lessons
144
+ # To return a single lesson for a specific course
145
+ course.find_lesson(id)
146
+
125
147
  # To return a collection of associated enrollments given a collection of courses
126
148
  # Available conditions include modifiedSince and status
127
149
  AbsorbApi::Course.enrollments_from_collection(courses, modifiedSince: DateTime.new(2016, 1, 1))
@@ -185,6 +207,67 @@ AbsorbApi::Department.create do |department|
185
207
  end
186
208
  ```
187
209
 
210
+ ### Role
211
+ ```ruby
212
+ # To return a collection of all available roles
213
+ AbsorbApi::Role.all
214
+
215
+ # To find a single role by id
216
+ AbsorbApi::Role.find(id)
217
+ ```
218
+
219
+ ### Tag
220
+ ```ruby
221
+ # To return a collection of all available tags
222
+ AbsorbApi::Tag.all
223
+
224
+ # To find a single tag by id
225
+ AbsorbApi::Tag.find(id)
226
+
227
+ # To create a new tag
228
+ AbsorbApi::Tag.create(name: "example")
229
+ # or
230
+ AbsorbApi::Tag.create do |tag|
231
+ user.name = "example"
232
+ end
233
+ ```
234
+
235
+ ### SessionSchedule
236
+ ```ruby
237
+ # To return a collection of all available session schedules
238
+ AbsorbApi::SessionSchedule.all
239
+
240
+ # To find a single session schedule by id
241
+ AbsorbApi::SessionSchedule.find(id)
242
+ ```
243
+
244
+ ### Resource
245
+ ```ruby
246
+ # To return a collection of all available resources
247
+ AbsorbApi::Resource.all
248
+
249
+ # To find a single resource by id
250
+ AbsorbApi::Resource.find(id)
251
+ ```
252
+
253
+ ### Prerequisite
254
+ ```ruby
255
+ # To return a collection of all available prerequisites
256
+ AbsorbApi::Prerequisite.all
257
+
258
+ # To find a single prerequisite by id
259
+ AbsorbApi::Prerequisite.find(id)
260
+ ```
261
+
262
+ ### Lesson
263
+ ```ruby
264
+ # To return a collection of all available lessons
265
+ AbsorbApi::Lesson.all
266
+
267
+ # To find a single lesson by id
268
+ AbsorbApi::Lesson.find(id)
269
+ ```
270
+
188
271
  ### CourseEnrollment
189
272
  ```ruby
190
273
  # To return a collection of associated lessons matching conditions
data/lib/absorb_api.rb CHANGED
@@ -21,6 +21,12 @@ require "absorb_api/certificate"
21
21
  require "absorb_api/chapter"
22
22
  require "absorb_api/curriculum"
23
23
  require "absorb_api/department"
24
+ require "absorb_api/tag"
25
+ require "absorb_api/session_schedule"
26
+ require "absorb_api/role"
27
+ require "absorb_api/resource"
28
+ require "absorb_api/prerequisite"
29
+ require "absorb_api/lesson"
24
30
 
25
31
  module AbsorbApi
26
32
  end
@@ -7,7 +7,10 @@ module AbsorbApi
7
7
  has_many :certificates
8
8
  has_many :chapters
9
9
  has_many :enrollments, :course_enrollment
10
-
10
+ has_many :resources
11
+ has_many :prerequisites
12
+ has_many :lessons
13
+
11
14
  # gets all associated enrollments given a collection of courses
12
15
  # all calls are called in parallel
13
16
  def self.enrollments_from_collection(courses, **conditions)
@@ -0,0 +1,5 @@
1
+ module AbsorbApi
2
+ class Lesson < Base
3
+ attr_accessor :id, :chapter_id, :name, :description, :notes, :type, :width, :height, :url, :use_popup, :passing_score, :weight, :ref_id
4
+ end
5
+ end
@@ -10,13 +10,21 @@ module AbsorbApi
10
10
  def find(id)
11
11
  raise ResourceNotFound if id.blank?
12
12
  response = Base.api.get("#{to_s.demodulize.pluralize}/#{id}")
13
- response.status == 404 ? raise(ResourceNotFound) : new(response.body)
13
+ if response.status == 404
14
+ raise(RouteNotFound)
15
+ elsif response.status == 400
16
+ raise ResourceNotFound
17
+ else
18
+ new(response.body)
19
+ end
14
20
  end
15
21
 
16
22
  def all
17
23
  response = Base.api.get("#{to_s.demodulize.pluralize}")
18
24
  if response.status == 404
19
25
  raise RouteNotFound
26
+ elsif response.status == 400
27
+ raise ResourceNotFound
20
28
  else
21
29
  Collection.new( response.body.map! do |attributes|
22
30
  new(attributes)
@@ -0,0 +1,5 @@
1
+ module AbsorbApi
2
+ class Prerequisite < Base
3
+ attr_accessor :id, :name, :required_number, :prerequisite_type, :course_ids, :competency_definition_ids
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module AbsorbApi
2
+ class Resource < Base
3
+ attr_accessor :id, :name, :file, :module_id
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module AbsorbApi
2
+ class Role < Base
3
+ attr_accessor :id, :name, :description
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module AbsorbApi
2
+ class SessionSchedule < Base
3
+ attr_accessor :id, :session_id, :venue_id, :venue_type, :venue_name, :date_start, :date_end, :time_zone_id, :meeting_id, :meeting_username, :meeting_password
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module AbsorbApi
2
+ class Tag < Base
3
+ include Relations
4
+
5
+ attr_accessor :id, :name
6
+ end
7
+ end
@@ -7,7 +7,8 @@ module AbsorbApi
7
7
  has_many :courses
8
8
  has_many :enrollments, klass: :course_enrollment
9
9
  has_many :certificates
10
-
10
+ has_many :resources
11
+
11
12
  # gets all associated courses given a collection of users
12
13
  # all calls are called in parallel
13
14
  # users are chunked in groups of 105 to keep typhoeus from getting bogged down
@@ -1,3 +1,3 @@
1
1
  module AbsorbApi
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: absorb_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - npezza
@@ -135,9 +135,15 @@ files:
135
135
  - lib/absorb_api/course_enrollment.rb
136
136
  - lib/absorb_api/curriculum.rb
137
137
  - lib/absorb_api/department.rb
138
+ - lib/absorb_api/lesson.rb
138
139
  - lib/absorb_api/lesson_enrollment.rb
139
140
  - lib/absorb_api/orm.rb
141
+ - lib/absorb_api/prerequisite.rb
140
142
  - lib/absorb_api/relations.rb
143
+ - lib/absorb_api/resource.rb
144
+ - lib/absorb_api/role.rb
145
+ - lib/absorb_api/session_schedule.rb
146
+ - lib/absorb_api/tag.rb
141
147
  - lib/absorb_api/user.rb
142
148
  - lib/absorb_api/version.rb
143
149
  homepage: https://github.com/npezza93/absorb_api