absorb_api 0.1.2 → 0.1.5
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 +4 -4
- data/README.md +23 -11
- data/doc/AbsorbApi/Base.html +17 -6
- data/doc/AbsorbApi/Category.html +1 -12
- data/doc/AbsorbApi/Certificate.html +1 -12
- data/doc/AbsorbApi/Chapter.html +1 -12
- data/doc/AbsorbApi/Course.html +4 -8
- data/doc/AbsorbApi/CourseEnrollment.html +14 -16
- data/doc/AbsorbApi/Curriculum.html +1 -12
- data/doc/AbsorbApi/Department.html +0 -4
- data/doc/AbsorbApi/User.html +1 -5
- data/doc/Gemfile_lock.html +1 -1
- data/doc/absorb_api_gemspec.html +2 -11
- data/doc/created.rid +28 -26
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/lib/absorb_api/base.rb +3 -1
- data/lib/absorb_api/category.rb +0 -2
- data/lib/absorb_api/certificate.rb +0 -2
- data/lib/absorb_api/chapter.rb +0 -2
- data/lib/absorb_api/collection.rb +18 -8
- data/lib/absorb_api/course.rb +3 -4
- data/lib/absorb_api/course_enrollment.rb +9 -15
- data/lib/absorb_api/curriculum.rb +0 -2
- data/lib/absorb_api/department.rb +0 -1
- data/lib/absorb_api/user.rb +0 -1
- data/lib/absorb_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5387f031cc50ad89f0af07737f46ececb7193ae2
|
4
|
+
data.tar.gz: c8f6b4e99484161d9bd07215aab7ac03c9475141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45b6490be166ec18e27f3a671bef8d738111d8107771996891970c47c12e5ffda6bb2a0dd0be4b40f6bab66b48716571998a717fca8f67d45691c6e22292dc05
|
7
|
+
data.tar.gz: a2c4aae967b2921d9576960b7c24c6d9c3ee5a52250ab1d1d5ee6bbcf8d666070d1a8286a530e58190b2cedb282bb672a75d0f782f318bab978f710b51e9e38e
|
data/README.md
CHANGED
@@ -17,6 +17,8 @@ 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
|
+
* [CourseEnrollment](#courseenrollment)
|
21
|
+
* [LessonEnrollment](#lessonenrollment)
|
20
22
|
4. [Development](#development)
|
21
23
|
|
22
24
|
## Installation
|
@@ -85,13 +87,10 @@ AbsorbApi::User.create do |user|
|
|
85
87
|
user.email_address = "email_address"
|
86
88
|
user.password = "password"
|
87
89
|
end
|
88
|
-
```
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
courses = AbsorbApi::User.courses_from_collection(users)
|
94
|
-
```
|
91
|
+
# To return a collection of courses available per user given a collection of users
|
92
|
+
courses = AbsorbApi::User.courses_from_collection(users)
|
93
|
+
```
|
95
94
|
|
96
95
|
### Course
|
97
96
|
```ruby
|
@@ -122,12 +121,11 @@ course.find_certificate(id)
|
|
122
121
|
course.chapters
|
123
122
|
# To return a single chapters for a specific course
|
124
123
|
course.find_chapter(id)
|
125
|
-
```
|
126
124
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
# To return a collection of associated enrollments given a collection of courses
|
126
|
+
# Available conditions include modifiedSince and status
|
127
|
+
AbsorbApi::Course.enrollments_from_collection(courses, modifiedSince: DateTime.new(2016, 1, 1))
|
128
|
+
```
|
131
129
|
|
132
130
|
### Category
|
133
131
|
```ruby
|
@@ -187,6 +185,20 @@ AbsorbApi::Department.create do |department|
|
|
187
185
|
end
|
188
186
|
```
|
189
187
|
|
188
|
+
### CourseEnrollment
|
189
|
+
```ruby
|
190
|
+
# To return a collection of associated lessons matching conditions
|
191
|
+
# Available conditions are modifiedSince and status
|
192
|
+
course_enrollment.lessons
|
193
|
+
|
194
|
+
# To return a collection of associated enrollments given a collection of courses
|
195
|
+
# Available conditions include modifiedSince and status
|
196
|
+
AbsorbApi::CourseEnrollment.lessons_from_collection(course_enrollments, modifiedSince: DateTime.new(2016, 1, 1))
|
197
|
+
```
|
198
|
+
|
199
|
+
### LessonEnrollment
|
200
|
+
|
201
|
+
|
190
202
|
## Development
|
191
203
|
|
192
204
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/doc/AbsorbApi/Base.html
CHANGED
@@ -62,7 +62,18 @@
|
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
65
|
-
|
65
|
+
<div id="includes-section" class="nav-section">
|
66
|
+
<h3>Included Modules</h3>
|
67
|
+
|
68
|
+
<ul class="link-list">
|
69
|
+
|
70
|
+
|
71
|
+
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
+
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
66
77
|
|
67
78
|
<!-- Method Quickref -->
|
68
79
|
<div id="method-list-section" class="nav-section">
|
@@ -129,7 +140,7 @@
|
|
129
140
|
|
130
141
|
|
131
142
|
<div class="method-source-code" id="api-source">
|
132
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line
|
143
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line 24</span>
|
133
144
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">api</span>
|
134
145
|
<span class="ruby-ivar">@api</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Faraday</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:url</span> =<span class="ruby-operator">></span> <span class="ruby-constant">AbsorbApi</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">url</span>, <span class="ruby-value">:parallel_manager</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Hydra</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:max_concurrency</span> =<span class="ruby-operator">></span> <span class="ruby-value">200</span>)) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">faraday</span><span class="ruby-operator">|</span>
|
135
146
|
<span class="ruby-identifier">faraday</span>.<span class="ruby-identifier">request</span> <span class="ruby-value">:json</span>
|
@@ -167,7 +178,7 @@
|
|
167
178
|
|
168
179
|
|
169
180
|
<div class="method-source-code" id="authorize-source">
|
170
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line
|
181
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line 12</span>
|
171
182
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">authorize</span>
|
172
183
|
<span class="ruby-ivar">@authorize</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Faraday</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:url</span> =<span class="ruby-operator">></span> <span class="ruby-constant">AbsorbApi</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">url</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">faraday</span><span class="ruby-operator">|</span>
|
173
184
|
<span class="ruby-identifier">faraday</span>.<span class="ruby-identifier">request</span> <span class="ruby-value">:url_encoded</span>
|
@@ -193,7 +204,7 @@
|
|
193
204
|
|
194
205
|
<div class="method-heading">
|
195
206
|
<span class="method-name">new</span><span
|
196
|
-
class="method-args">(attributes) { |self| ... }</span>
|
207
|
+
class="method-args">(attributes = []) { |self| ... }</span>
|
197
208
|
|
198
209
|
<span class="method-click-advice">click to toggle source</span>
|
199
210
|
|
@@ -208,8 +219,8 @@
|
|
208
219
|
|
209
220
|
|
210
221
|
<div class="method-source-code" id="new-source">
|
211
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line
|
212
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span
|
222
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/base.rb, line 5</span>
|
223
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span> = [], <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
213
224
|
<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
214
225
|
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{k.to_s.underscore}"</span>, <span class="ruby-identifier">v</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span>
|
215
226
|
<span class="ruby-keyword">end</span>
|
data/doc/AbsorbApi/Category.html
CHANGED
@@ -62,18 +62,7 @@
|
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
65
|
-
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
65
|
+
|
77
66
|
|
78
67
|
|
79
68
|
</div>
|
@@ -62,18 +62,7 @@
|
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
65
|
-
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
65
|
+
|
77
66
|
|
78
67
|
|
79
68
|
</div>
|
data/doc/AbsorbApi/Chapter.html
CHANGED
@@ -62,18 +62,7 @@
|
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
65
|
-
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
65
|
+
|
77
66
|
|
78
67
|
|
79
68
|
</div>
|
data/doc/AbsorbApi/Course.html
CHANGED
@@ -68,10 +68,6 @@
|
|
68
68
|
<ul class="link-list">
|
69
69
|
|
70
70
|
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
71
|
<li><a class="include" href="Relations.html">AbsorbApi::Relations</a>
|
76
72
|
|
77
73
|
|
@@ -484,7 +480,7 @@
|
|
484
480
|
|
485
481
|
<div class="method-heading">
|
486
482
|
<span class="method-name">enrollments_from_collection</span><span
|
487
|
-
class="method-args">(courses)</span>
|
483
|
+
class="method-args">(courses, **filters)</span>
|
488
484
|
|
489
485
|
<span class="method-click-advice">click to toggle source</span>
|
490
486
|
|
@@ -500,12 +496,12 @@ called in parallel</p>
|
|
500
496
|
|
501
497
|
|
502
498
|
<div class="method-source-code" id="enrollments_from_collection-source">
|
503
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/course.rb, line
|
504
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">enrollments_from_collection</span>(<span class="ruby-identifier">courses</span>)
|
499
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/course.rb, line 13</span>
|
500
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">enrollments_from_collection</span>(<span class="ruby-identifier">courses</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">filters</span>)
|
505
501
|
<span class="ruby-identifier">enrollments</span> = []
|
506
502
|
<span class="ruby-identifier">api</span>.<span class="ruby-identifier">in_parallel</span> <span class="ruby-keyword">do</span>
|
507
503
|
<span class="ruby-identifier">courses</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">course</span><span class="ruby-operator">|</span> <span class="ruby-constant">AbsorbApi</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">ignored_course_ids</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">course</span>.<span class="ruby-identifier">id</span> }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">course</span><span class="ruby-operator">|</span>
|
508
|
-
<span class="ruby-identifier">enrollments</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"courses/#{course.id}/enrollments"</span>)
|
504
|
+
<span class="ruby-identifier">enrollments</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"courses/#{course.id}/enrollments"</span>, <span class="ruby-identifier">filters</span>)
|
509
505
|
<span class="ruby-keyword">end</span>
|
510
506
|
<span class="ruby-keyword">end</span>
|
511
507
|
<span class="ruby-identifier">enrollments</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">attrs</span><span class="ruby-operator">|</span> <span class="ruby-constant">CourseEnrollment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attrs</span>) } }.<span class="ruby-identifier">flatten</span>
|
@@ -339,7 +339,7 @@
|
|
339
339
|
|
340
340
|
<div class="method-heading">
|
341
341
|
<span class="method-name">lessons_from_collection</span><span
|
342
|
-
class="method-args">(course_enrollments,
|
342
|
+
class="method-args">(course_enrollments, **filters)</span>
|
343
343
|
|
344
344
|
<span class="method-click-advice">click to toggle source</span>
|
345
345
|
|
@@ -356,19 +356,17 @@ typhoeus from getting bogged down modifiedSince must be a DateTime object</p>
|
|
356
356
|
|
357
357
|
|
358
358
|
<div class="method-source-code" id="lessons_from_collection-source">
|
359
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/course_enrollment.rb, line
|
360
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">lessons_from_collection</span>(<span class="ruby-identifier">course_enrollments</span>, <span class="ruby-identifier">
|
361
|
-
<span class="ruby-
|
362
|
-
|
363
|
-
<span class="ruby-identifier">
|
364
|
-
<span class="ruby-identifier">
|
365
|
-
<span class="ruby-identifier">
|
366
|
-
<span class="ruby-identifier">lessons</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons"</span>, { <span class="ruby-string">"modifiedSince"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">modifiedSince</span>.<span class="ruby-identifier">to_s</span>})
|
367
|
-
<span class="ruby-keyword">end</span>
|
359
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/course_enrollment.rb, line 17</span>
|
360
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">lessons_from_collection</span>(<span class="ruby-identifier">course_enrollments</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">filters</span>)
|
361
|
+
<span class="ruby-identifier">lessons</span> = []
|
362
|
+
<span class="ruby-identifier">course_enrollments</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">105</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">enrollment_slice</span><span class="ruby-operator">|</span>
|
363
|
+
<span class="ruby-identifier">api</span>.<span class="ruby-identifier">in_parallel</span> <span class="ruby-keyword">do</span>
|
364
|
+
<span class="ruby-identifier">enrollment_slice</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">enrollment</span><span class="ruby-operator">|</span>
|
365
|
+
<span class="ruby-identifier">lessons</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons"</span>, <span class="ruby-identifier">filters</span>)
|
368
366
|
<span class="ruby-keyword">end</span>
|
369
367
|
<span class="ruby-keyword">end</span>
|
370
|
-
<span class="ruby-identifier">lessons</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">body</span><span class="ruby-operator">|</span> <span class="ruby-constant">LessonEnrollment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">body</span>) } }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">lesson</span><span class="ruby-operator">|</span> <span class="ruby-constant">AbsorbApi</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">ignored_lesson_types</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">lesson</span>.<span class="ruby-identifier">type</span> }
|
371
368
|
<span class="ruby-keyword">end</span>
|
369
|
+
<span class="ruby-identifier">lessons</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">body</span><span class="ruby-operator">|</span> <span class="ruby-constant">LessonEnrollment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">body</span>) } }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">lesson</span><span class="ruby-operator">|</span> <span class="ruby-constant">AbsorbApi</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">ignored_lesson_types</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">lesson</span>.<span class="ruby-identifier">type</span> }
|
372
370
|
<span class="ruby-keyword">end</span></pre>
|
373
371
|
</div>
|
374
372
|
|
@@ -392,7 +390,7 @@ typhoeus from getting bogged down modifiedSince must be a DateTime object</p>
|
|
392
390
|
|
393
391
|
<div class="method-heading">
|
394
392
|
<span class="method-name">lessons</span><span
|
395
|
-
class="method-args">()</span>
|
393
|
+
class="method-args">(**conditions)</span>
|
396
394
|
|
397
395
|
<span class="method-click-advice">click to toggle source</span>
|
398
396
|
|
@@ -401,15 +399,15 @@ typhoeus from getting bogged down modifiedSince must be a DateTime object</p>
|
|
401
399
|
|
402
400
|
<div class="method-description">
|
403
401
|
|
404
|
-
|
402
|
+
|
405
403
|
|
406
404
|
|
407
405
|
|
408
406
|
|
409
407
|
<div class="method-source-code" id="lessons-source">
|
410
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/course_enrollment.rb, line
|
411
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">lessons</span>
|
412
|
-
<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"users/#{self.user_id}/enrollments/#{self.course_id}/lessons"</span>,
|
408
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/course_enrollment.rb, line 7</span>
|
409
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">lessons</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">conditions</span>)
|
410
|
+
<span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"users/#{self.user_id}/enrollments/#{self.course_id}/lessons"</span>, <span class="ruby-identifier">conditions</span>).<span class="ruby-identifier">body</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lesson_attributes</span><span class="ruby-operator">|</span>
|
413
411
|
<span class="ruby-constant">LessonEnrollment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lesson_attributes</span>)
|
414
412
|
<span class="ruby-keyword">end</span>
|
415
413
|
<span class="ruby-keyword">end</span></pre>
|
@@ -62,18 +62,7 @@
|
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
65
|
-
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
65
|
+
|
77
66
|
|
78
67
|
|
79
68
|
</div>
|
data/doc/AbsorbApi/User.html
CHANGED
@@ -68,10 +68,6 @@
|
|
68
68
|
<ul class="link-list">
|
69
69
|
|
70
70
|
|
71
|
-
<li><a class="include" href="Orm.html">AbsorbApi::Orm</a>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
71
|
<li><a class="include" href="Relations.html">AbsorbApi::Relations</a>
|
76
72
|
|
77
73
|
|
@@ -579,7 +575,7 @@ getting bogged down</p>
|
|
579
575
|
|
580
576
|
|
581
577
|
<div class="method-source-code" id="courses_from_collection-source">
|
582
|
-
<pre><span class="ruby-comment"># File lib/absorb_api/user.rb, line
|
578
|
+
<pre><span class="ruby-comment"># File lib/absorb_api/user.rb, line 14</span>
|
583
579
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">courses_from_collection</span>(<span class="ruby-identifier">users</span>)
|
584
580
|
<span class="ruby-identifier">courses</span> = []
|
585
581
|
<span class="ruby-identifier">users</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">105</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">user_slice</span><span class="ruby-operator">|</span>
|
data/doc/Gemfile_lock.html
CHANGED
data/doc/absorb_api_gemspec.html
CHANGED
@@ -87,23 +87,14 @@ unless $LOAD_PATH.include?(lib) require 'absorb_api/version'</p>
|
|
87
87
|
|
88
88
|
<pre class="ruby"><span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span> = <span class="ruby-string">"absorb_api"</span>
|
89
89
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">version</span> = <span class="ruby-constant">AbsorbApi</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>
|
90
|
-
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">authors</span> = [<span class="ruby-string">"
|
90
|
+
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">authors</span> = [<span class="ruby-string">"npezza"</span>]
|
91
91
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">email</span> = [<span class="ruby-string">"npezza93@gmail.com"</span>]
|
92
92
|
|
93
93
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">summary</span> = <span class="ruby-string">"API wrapper for Absorb LMS"</span>
|
94
|
-
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">description</span> = <span class="ruby-string">"
|
95
|
-
\""</span>
|
94
|
+
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">description</span> = <span class="ruby-string">"This gem provides a ruby wrapper for Absorb's Learning Management System API. \n\n"</span>
|
96
95
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">homepage</span> = <span class="ruby-string">"https://github.com/npezza93/absorb_api"</span>
|
97
96
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">license</span> = <span class="ruby-string">"MIT"</span>
|
98
97
|
|
99
|
-
<span class="ruby-comment"># Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or</span>
|
100
|
-
<span class="ruby-comment"># delete this section to allow pushing this gem to any host.</span>
|
101
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">respond_to?</span>(:<span class="ruby-identifier">metadata</span>)
|
102
|
-
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">metadata</span>[<span class="ruby-string">'allowed_push_host'</span>] = <span class="ruby-string">"TODO: Set to 'http://mygemserver.com'"</span>
|
103
|
-
<span class="ruby-keyword">else</span>
|
104
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-string">"RubyGems 2.0 or newer is required to protect against public gem pushes."</span>
|
105
|
-
<span class="ruby-keyword">end</span>
|
106
|
-
|
107
98
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">files</span> = <span class="ruby-value">%x`git ls-files -z`</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"\x0"</span>).<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r{^(test|spec|features)/}</span>) }
|
108
99
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">bindir</span> = <span class="ruby-string">"exe"</span>
|
109
100
|
<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">executables</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">grep</span>(<span class="ruby-regexp">%r{^exe/}</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">f</span>) }
|
data/doc/created.rid
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
Sun, 24 Jan 2016
|
2
|
-
./absorb_api-0.1.0.gem Sun, 24 Jan 2016
|
3
|
-
./absorb_api.
|
4
|
-
./
|
5
|
-
./
|
6
|
-
./
|
7
|
-
./
|
8
|
-
./
|
9
|
-
./
|
10
|
-
./lib/absorb_api/
|
11
|
-
./lib/absorb_api/
|
12
|
-
./lib/absorb_api/
|
13
|
-
./lib/absorb_api/
|
14
|
-
./lib/absorb_api/
|
15
|
-
./lib/absorb_api/
|
16
|
-
./lib/absorb_api/
|
17
|
-
./lib/absorb_api/
|
18
|
-
./lib/absorb_api/
|
19
|
-
./lib/absorb_api/
|
20
|
-
./lib/absorb_api/
|
21
|
-
./lib/absorb_api/
|
22
|
-
./lib/absorb_api/
|
23
|
-
./lib/absorb_api.rb
|
24
|
-
./
|
25
|
-
./
|
26
|
-
./
|
1
|
+
Sun, 24 Jan 2016 13:40:14 -0500
|
2
|
+
./absorb_api-0.1.0.gem Sun, 24 Jan 2016 01:09:53 -0500
|
3
|
+
./absorb_api-0.1.1.gem Sun, 24 Jan 2016 01:11:48 -0500
|
4
|
+
./absorb_api-0.1.2.gem Sun, 24 Jan 2016 13:28:23 -0500
|
5
|
+
./absorb_api.gemspec Sun, 24 Jan 2016 01:19:54 -0500
|
6
|
+
./bin/console Sun, 24 Jan 2016 01:01:43 -0500
|
7
|
+
./bin/setup Sun, 24 Jan 2016 01:01:43 -0500
|
8
|
+
./Gemfile Sun, 24 Jan 2016 01:01:43 -0500
|
9
|
+
./Gemfile.lock Sun, 24 Jan 2016 13:06:37 -0500
|
10
|
+
./lib/absorb_api/base.rb Sun, 24 Jan 2016 12:30:32 -0500
|
11
|
+
./lib/absorb_api/category.rb Sun, 24 Jan 2016 10:58:35 -0500
|
12
|
+
./lib/absorb_api/certificate.rb Sun, 24 Jan 2016 10:58:44 -0500
|
13
|
+
./lib/absorb_api/chapter.rb Sun, 24 Jan 2016 10:58:52 -0500
|
14
|
+
./lib/absorb_api/collection.rb Sun, 24 Jan 2016 12:36:10 -0500
|
15
|
+
./lib/absorb_api/configuration.rb Sun, 24 Jan 2016 01:01:43 -0500
|
16
|
+
./lib/absorb_api/course.rb Sun, 24 Jan 2016 13:18:20 -0500
|
17
|
+
./lib/absorb_api/course_enrollment.rb Sun, 24 Jan 2016 13:39:33 -0500
|
18
|
+
./lib/absorb_api/curriculum.rb Sun, 24 Jan 2016 10:59:13 -0500
|
19
|
+
./lib/absorb_api/department.rb Sun, 24 Jan 2016 10:59:23 -0500
|
20
|
+
./lib/absorb_api/lesson_enrollment.rb Sun, 24 Jan 2016 01:01:43 -0500
|
21
|
+
./lib/absorb_api/orm.rb Sun, 24 Jan 2016 01:01:43 -0500
|
22
|
+
./lib/absorb_api/relations.rb Sun, 24 Jan 2016 01:01:43 -0500
|
23
|
+
./lib/absorb_api/user.rb Sun, 24 Jan 2016 10:59:43 -0500
|
24
|
+
./lib/absorb_api/version.rb Sun, 24 Jan 2016 01:20:03 -0500
|
25
|
+
./lib/absorb_api.rb Sun, 24 Jan 2016 01:01:43 -0500
|
26
|
+
./LICENSE.txt Sun, 24 Jan 2016 01:01:43 -0500
|
27
|
+
./Rakefile Sun, 24 Jan 2016 01:01:43 -0500
|
28
|
+
./README.md Sun, 24 Jan 2016 01:01:43 -0500
|
data/doc/js/navigation.js.gz
CHANGED
Binary file
|
data/doc/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["absorbapi","base","category","certificate","chapter","collection","configuration","course","courseenrollment","curriculum","department","lessonenrollment","orm","relations","resourcenotfound","routenotfound","user","validationerror","all()","api()","authorize()","configure()","courses_from_collection()","create()","enrollments_from_collection()","find()","has_many()","has_one()","lessons()","lessons_from_collection()","new()","new()","reset()","where()","gemfile","gemfile.lock","license","readme","rakefile","absorb_api.gemspec","setup"],"longSearchIndex":["absorbapi","absorbapi::base","absorbapi::category","absorbapi::certificate","absorbapi::chapter","absorbapi::collection","absorbapi::configuration","absorbapi::course","absorbapi::courseenrollment","absorbapi::curriculum","absorbapi::department","absorbapi::lessonenrollment","absorbapi::orm","absorbapi::relations","absorbapi::resourcenotfound","absorbapi::routenotfound","absorbapi::user","absorbapi::validationerror","absorbapi::orm#all()","absorbapi::base::api()","absorbapi::base::authorize()","absorbapi::configure()","absorbapi::user::courses_from_collection()","absorbapi::relations#create()","absorbapi::course::enrollments_from_collection()","absorbapi::orm#find()","absorbapi::relations#has_many()","absorbapi::relations#has_one()","absorbapi::courseenrollment#lessons()","absorbapi::courseenrollment::lessons_from_collection()","absorbapi::base::new()","absorbapi::collection::new()","absorbapi::reset()","absorbapi::relations#where()","","","","","","",""],"info":[["AbsorbApi","","AbsorbApi.html","",""],["AbsorbApi::Base","","AbsorbApi/Base.html","",""],["AbsorbApi::Category","","AbsorbApi/Category.html","",""],["AbsorbApi::Certificate","","AbsorbApi/Certificate.html","",""],["AbsorbApi::Chapter","","AbsorbApi/Chapter.html","",""],["AbsorbApi::Collection","","AbsorbApi/Collection.html","",""],["AbsorbApi::Configuration","","AbsorbApi/Configuration.html","",""],["AbsorbApi::Course","","AbsorbApi/Course.html","",""],["AbsorbApi::CourseEnrollment","","AbsorbApi/CourseEnrollment.html","",""],["AbsorbApi::Curriculum","","AbsorbApi/Curriculum.html","",""],["AbsorbApi::Department","","AbsorbApi/Department.html","",""],["AbsorbApi::LessonEnrollment","","AbsorbApi/LessonEnrollment.html","",""],["AbsorbApi::Orm","","AbsorbApi/Orm.html","",""],["AbsorbApi::Relations","","AbsorbApi/Relations.html","",""],["AbsorbApi::ResourceNotFound","","AbsorbApi/ResourceNotFound.html","",""],["AbsorbApi::RouteNotFound","","AbsorbApi/RouteNotFound.html","",""],["AbsorbApi::User","","AbsorbApi/User.html","",""],["AbsorbApi::ValidationError","","AbsorbApi/ValidationError.html","",""],["all","AbsorbApi::Orm","AbsorbApi/Orm.html#method-i-all","()",""],["api","AbsorbApi::Base","AbsorbApi/Base.html#method-c-api","()",""],["authorize","AbsorbApi::Base","AbsorbApi/Base.html#method-c-authorize","()",""],["configure","AbsorbApi","AbsorbApi.html#method-c-configure","()",""],["courses_from_collection","AbsorbApi::User","AbsorbApi/User.html#method-c-courses_from_collection","(users)","<p>gets all associated courses given a collection of users all calls are\ncalled in parallel users are chunked …\n"],["create","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-create","(attributes = [], &block)",""],["enrollments_from_collection","AbsorbApi::Course","AbsorbApi/Course.html#method-c-enrollments_from_collection","(courses)","<p>gets all associated enrollments given a collection of courses all calls are\ncalled in parallel\n"],["find","AbsorbApi::Orm","AbsorbApi/Orm.html#method-i-find","(id)",""],["has_many","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-has_many","(rel_name, klass = nil)",""],["has_one","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-has_one","(rel_name, klass = nil)",""],["lessons","AbsorbApi::CourseEnrollment","AbsorbApi/CourseEnrollment.html#method-i-lessons","()","
|
1
|
+
var search_data = {"index":{"searchIndex":["absorbapi","base","category","certificate","chapter","collection","configuration","course","courseenrollment","curriculum","department","lessonenrollment","orm","relations","resourcenotfound","routenotfound","user","validationerror","all()","api()","authorize()","configure()","courses_from_collection()","create()","enrollments_from_collection()","find()","has_many()","has_one()","lessons()","lessons_from_collection()","new()","new()","reset()","where()","gemfile","gemfile.lock","license","readme","rakefile","absorb_api.gemspec","setup"],"longSearchIndex":["absorbapi","absorbapi::base","absorbapi::category","absorbapi::certificate","absorbapi::chapter","absorbapi::collection","absorbapi::configuration","absorbapi::course","absorbapi::courseenrollment","absorbapi::curriculum","absorbapi::department","absorbapi::lessonenrollment","absorbapi::orm","absorbapi::relations","absorbapi::resourcenotfound","absorbapi::routenotfound","absorbapi::user","absorbapi::validationerror","absorbapi::orm#all()","absorbapi::base::api()","absorbapi::base::authorize()","absorbapi::configure()","absorbapi::user::courses_from_collection()","absorbapi::relations#create()","absorbapi::course::enrollments_from_collection()","absorbapi::orm#find()","absorbapi::relations#has_many()","absorbapi::relations#has_one()","absorbapi::courseenrollment#lessons()","absorbapi::courseenrollment::lessons_from_collection()","absorbapi::base::new()","absorbapi::collection::new()","absorbapi::reset()","absorbapi::relations#where()","","","","","","",""],"info":[["AbsorbApi","","AbsorbApi.html","",""],["AbsorbApi::Base","","AbsorbApi/Base.html","",""],["AbsorbApi::Category","","AbsorbApi/Category.html","",""],["AbsorbApi::Certificate","","AbsorbApi/Certificate.html","",""],["AbsorbApi::Chapter","","AbsorbApi/Chapter.html","",""],["AbsorbApi::Collection","","AbsorbApi/Collection.html","",""],["AbsorbApi::Configuration","","AbsorbApi/Configuration.html","",""],["AbsorbApi::Course","","AbsorbApi/Course.html","",""],["AbsorbApi::CourseEnrollment","","AbsorbApi/CourseEnrollment.html","",""],["AbsorbApi::Curriculum","","AbsorbApi/Curriculum.html","",""],["AbsorbApi::Department","","AbsorbApi/Department.html","",""],["AbsorbApi::LessonEnrollment","","AbsorbApi/LessonEnrollment.html","",""],["AbsorbApi::Orm","","AbsorbApi/Orm.html","",""],["AbsorbApi::Relations","","AbsorbApi/Relations.html","",""],["AbsorbApi::ResourceNotFound","","AbsorbApi/ResourceNotFound.html","",""],["AbsorbApi::RouteNotFound","","AbsorbApi/RouteNotFound.html","",""],["AbsorbApi::User","","AbsorbApi/User.html","",""],["AbsorbApi::ValidationError","","AbsorbApi/ValidationError.html","",""],["all","AbsorbApi::Orm","AbsorbApi/Orm.html#method-i-all","()",""],["api","AbsorbApi::Base","AbsorbApi/Base.html#method-c-api","()",""],["authorize","AbsorbApi::Base","AbsorbApi/Base.html#method-c-authorize","()",""],["configure","AbsorbApi","AbsorbApi.html#method-c-configure","()",""],["courses_from_collection","AbsorbApi::User","AbsorbApi/User.html#method-c-courses_from_collection","(users)","<p>gets all associated courses given a collection of users all calls are\ncalled in parallel users are chunked …\n"],["create","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-create","(attributes = [], &block)",""],["enrollments_from_collection","AbsorbApi::Course","AbsorbApi/Course.html#method-c-enrollments_from_collection","(courses, **filters)","<p>gets all associated enrollments given a collection of courses all calls are\ncalled in parallel\n"],["find","AbsorbApi::Orm","AbsorbApi/Orm.html#method-i-find","(id)",""],["has_many","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-has_many","(rel_name, klass = nil)",""],["has_one","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-has_one","(rel_name, klass = nil)",""],["lessons","AbsorbApi::CourseEnrollment","AbsorbApi/CourseEnrollment.html#method-i-lessons","(**conditions)",""],["lessons_from_collection","AbsorbApi::CourseEnrollment","AbsorbApi/CourseEnrollment.html#method-c-lessons_from_collection","(course_enrollments, **filters)","<p>gets all associated lessons given a collection of enrollments all calls are\ncalled in parallel enrollments …\n"],["new","AbsorbApi::Base","AbsorbApi/Base.html#method-c-new","(attributes = [], &block)",""],["new","AbsorbApi::Collection","AbsorbApi/Collection.html#method-c-new","(elements, metadata = {})",""],["reset","AbsorbApi","AbsorbApi.html#method-c-reset","()",""],["where","AbsorbApi::Relations","AbsorbApi/Relations.html#method-i-where","(**conditions)",""],["Gemfile","","Gemfile.html","","<p>source 'rubygems.org'\n<p># Specify your gem's dependencies in absorb_api.gemspec gemspec\n<p>gem 'faraday' …\n"],["Gemfile.lock","","Gemfile_lock.html","","<p>PATH\n\n<pre>remote: .\nspecs:\n absorb_api (0.1.2)</pre>\n<p>GEM\n"],["LICENSE","","LICENSE_txt.html","","<p>The MIT License (MIT)\n<p>Copyright © 2016 npezza93\n<p>Permission is hereby granted, free of charge, to any …\n"],["README","","README_md.html","","<p>Absorb LMS API Wrapper\n<p>“Absorb LMS is a powerful, flexible, and visually stunning software\nplatform …\n"],["Rakefile","","Rakefile.html","","<p>require “bundler/gem_tasks” task :default => :spec\n"],["absorb_api.gemspec","","absorb_api_gemspec.html","","<p>lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib)\nunless $LOAD_PATH.include?(lib) …\n"],["setup","","bin/setup.html","","<p>#!/usr/bin/env bash set -euo pipefail IFS=$'nt' set -vx\n<p>bundle install\n<p># Do any other automated …\n"]]}}
|
data/doc/js/search_index.js.gz
CHANGED
Binary file
|
data/doc/js/searcher.js.gz
CHANGED
Binary file
|
data/lib/absorb_api/base.rb
CHANGED
data/lib/absorb_api/category.rb
CHANGED
data/lib/absorb_api/chapter.rb
CHANGED
@@ -7,13 +7,23 @@ module AbsorbApi
|
|
7
7
|
@metadata = metadata
|
8
8
|
end
|
9
9
|
|
10
|
-
private
|
11
|
-
def method_missing(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
10
|
+
# private
|
11
|
+
# def method_missing(method_name, *arguments, &block)
|
12
|
+
# if "AbsorbApi::#{metadata[:klass]}".constantize.new.respond_to? method_name
|
13
|
+
# collection = []
|
14
|
+
# Base.api.in_parallel do
|
15
|
+
# self.each do |object|
|
16
|
+
# collection << Base.api.get("#{metadata[:klass].to_s.pluralize}/#{object.id}/#{method_name}")
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# collection.map { |response| response.body.map { |attrs| CourseEnrollment.new(attrs) } }.flatten
|
20
|
+
# else
|
21
|
+
# super
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# def respond_to_missing?(method_name, include_private = false)
|
26
|
+
# self.first.respond_to? method_name || super
|
27
|
+
# end
|
18
28
|
end
|
19
29
|
end
|
data/lib/absorb_api/course.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module AbsorbApi
|
2
2
|
class Course < Base
|
3
|
-
include Orm
|
4
3
|
include Relations
|
5
4
|
|
6
5
|
attr_accessor :id, :name, :description, :notes, :external_id, :access_date, :expire_type, :expire_duration, :expiry_date, :active_status, :tag_ids, :resource_ids, :editor_ids, :prices, :competency_definition_ids, :prerequisite_course_ids, :post_enrollment_course_ids, :allow_course_evaluation, :category_id, :certificate_url, :audience, :goals, :vendor, :company_cost, :learner_cost, :company_time, :learner_time
|
@@ -8,14 +7,14 @@ module AbsorbApi
|
|
8
7
|
has_many :certificates
|
9
8
|
has_many :chapters
|
10
9
|
has_many :enrollments, :course_enrollment
|
11
|
-
|
10
|
+
|
12
11
|
# gets all associated enrollments given a collection of courses
|
13
12
|
# all calls are called in parallel
|
14
|
-
def self.enrollments_from_collection(courses)
|
13
|
+
def self.enrollments_from_collection(courses, **conditions)
|
15
14
|
enrollments = []
|
16
15
|
api.in_parallel do
|
17
16
|
courses.reject { |course| AbsorbApi.configuration.ignored_course_ids.include? course.id }.each do |course|
|
18
|
-
enrollments << api.get("courses/#{course.id}/enrollments")
|
17
|
+
enrollments << api.get("courses/#{course.id}/enrollments", conditions)
|
19
18
|
end
|
20
19
|
end
|
21
20
|
enrollments.map { |response| response.body.map { |attrs| CourseEnrollment.new(attrs) } }.flatten
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module AbsorbApi
|
2
2
|
class CourseEnrollment < Base
|
3
|
-
include Relations
|
4
|
-
|
5
3
|
attr_accessor :id, :course_id, :course_name, :course_version_id, :user_id, :full_name, :status, :progress, :score, :accepted_terms_and_conditions, :time_spent, :date_started, :date_completed, :enrollment_key_id, :certificate_id, :credits
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
def lessons
|
10
|
-
api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", { "modifiedSince" => "2016-01-01"}).body.map! do |lesson_attributes|
|
5
|
+
def lessons(**conditions)
|
6
|
+
api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", conditions).body.map! do |lesson_attributes|
|
11
7
|
LessonEnrollment.new(lesson_attributes)
|
12
8
|
end
|
13
9
|
end
|
@@ -16,18 +12,16 @@ module AbsorbApi
|
|
16
12
|
# all calls are called in parallel
|
17
13
|
# enrollments are chunked in groups of 105 to keep typhoeus from getting bogged down
|
18
14
|
# modifiedSince must be a DateTime object
|
19
|
-
def self.lessons_from_collection(course_enrollments,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
lessons << api.get("users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons", { "modifiedSince" => modifiedSince.to_s})
|
26
|
-
end
|
15
|
+
def self.lessons_from_collection(course_enrollments, **filters)
|
16
|
+
lessons = []
|
17
|
+
course_enrollments.each_slice(105) do |enrollment_slice|
|
18
|
+
api.in_parallel do
|
19
|
+
enrollment_slice.each do |enrollment|
|
20
|
+
lessons << api.get("users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons", filters)
|
27
21
|
end
|
28
22
|
end
|
29
|
-
lessons.map { |response| response.body.map { |body| LessonEnrollment.new(body) } }.flatten.reject { |lesson| AbsorbApi.configuration.ignored_lesson_types.include? lesson.type }
|
30
23
|
end
|
24
|
+
lessons.map { |response| response.body.map { |body| LessonEnrollment.new(body) } }.flatten.reject { |lesson| AbsorbApi.configuration.ignored_lesson_types.include? lesson.type }
|
31
25
|
end
|
32
26
|
end
|
33
27
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module AbsorbApi
|
2
2
|
class Curriculum < Base
|
3
|
-
include Orm
|
4
|
-
|
5
3
|
attr_accessor :is_pacing_enabled, :curriculum_group_ids, :id, :name, :description, :notes, :external_id, :access_date, :expire_type, :expire_duration, :expiry_date, :active_status, :tag_ids, :resource_ids, :editor_ids, :prices, :competency_definition_ids, :prerequisite_course_ids, :post_enrollment_course_ids, :allow_course_evaluation, :category_id, :certificate_url, :audience, :goals, :vendor, :company_cost, :learner_cost, :company_time, :learner_time
|
6
4
|
end
|
7
5
|
end
|
data/lib/absorb_api/user.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module AbsorbApi
|
2
2
|
class User < Base
|
3
|
-
include Orm
|
4
3
|
include Relations
|
5
4
|
|
6
5
|
attr_accessor :id, :department_id, :first_name, :middle_name, :last_name, :username, :password, :email_address, :cc_email_addresses, :language_id, :gender, :address, :address2, :city, :province_id, :country_id, :postal_code, :phone, :employee_number, :location, :job_title, :reference_number, :date_hired, :date_terminated, :notes, :custom_fields, :role_ids, :active_status, :is_learner, :is_admin, :is_instructor, :external_id, :supervisor_id
|
data/lib/absorb_api/version.rb
CHANGED