absorb_api 0.1.2 → 0.1.5

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: 6c0fde749045fade29fdc3500ebf53c1f867f194
4
- data.tar.gz: 8d57b68bf956d463243fc3e103a083a9d41da19c
3
+ metadata.gz: 5387f031cc50ad89f0af07737f46ececb7193ae2
4
+ data.tar.gz: c8f6b4e99484161d9bd07215aab7ac03c9475141
5
5
  SHA512:
6
- metadata.gz: 9cd4b16123d50d42ebacc8976386b170339efdc353b471d157181fcaeb5438cad4ecdaeb9a60ad6573759e2713d7f8339388fb2543e31db5c6db6e694940a39f
7
- data.tar.gz: 663e33d308b274827c2e3225f659bc911d4d7c518a75902526299edbe79d9005a5ccf2869fb9151ea92782e5b1de25a84d6d91fa8fb350df1a73669e079dfed2
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
- To return a collection of courses available per user given a collection of users:
91
- ```ruby
92
- users = AbsorbApi::User.all
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
- To return a collection of associated enrollments given a collection of courses
128
- ```ruby
129
- AbsorbApi::Course.enrollments_from_collection(AbsorbApi::Course.all)
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.
@@ -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 22</span>
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">&gt;</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">&gt;</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">&gt;</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 10</span>
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">&gt;</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 3</span>
212
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</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">&amp;</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">&quot;@#{k.to_s.underscore}&quot;</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>
@@ -62,18 +62,7 @@
62
62
 
63
63
  </div>
64
64
 
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
-
65
+
77
66
 
78
67
 
79
68
  </div>
@@ -62,18 +62,7 @@
62
62
 
63
63
  </div>
64
64
 
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
-
65
+
77
66
 
78
67
 
79
68
  </div>
@@ -62,18 +62,7 @@
62
62
 
63
63
  </div>
64
64
 
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
-
65
+
77
66
 
78
67
 
79
68
  </div>
@@ -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 14</span>
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">&lt;&lt;</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;courses/#{course.id}/enrollments&quot;</span>)
504
+ <span class="ruby-identifier">enrollments</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;courses/#{course.id}/enrollments&quot;</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, modifiedSince)</span>
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 19</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-identifier">modifiedSince</span>)
361
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">modifiedSince</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">DateTime</span>
362
- <span class="ruby-identifier">lessons</span> = []
363
- <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>
364
- <span class="ruby-identifier">api</span>.<span class="ruby-identifier">in_parallel</span> <span class="ruby-keyword">do</span>
365
- <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>
366
- <span class="ruby-identifier">lessons</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons&quot;</span>, { <span class="ruby-string">&quot;modifiedSince&quot;</span> =<span class="ruby-operator">&gt;</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">&lt;&lt;</span> <span class="ruby-identifier">api</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons&quot;</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
- <p>has_many :lessons, klass: :lesson_enrollment</p>
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 9</span>
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">&quot;users/#{self.user_id}/enrollments/#{self.course_id}/lessons&quot;</span>, { <span class="ruby-string">&quot;modifiedSince&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;2016-01-01&quot;</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>
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">&quot;users/#{self.user_id}/enrollments/#{self.course_id}/lessons&quot;</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
- <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
-
65
+
77
66
 
78
67
 
79
68
  </div>
@@ -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
 
@@ -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 15</span>
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>
@@ -84,7 +84,7 @@
84
84
 
85
85
  <pre>remote: .
86
86
  specs:
87
- absorb_api (0.1.0)</pre>
87
+ absorb_api (0.1.2)</pre>
88
88
 
89
89
  <p>GEM</p>
90
90
 
@@ -87,23 +87,14 @@ unless $LOAD_PATH.include?(lib) require &#39;absorb_api/version&#39;</p>
87
87
 
88
88
  <pre class="ruby"><span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span> = <span class="ruby-string">&quot;absorb_api&quot;</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">&quot;npezza93&quot;</span>]
90
+ <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">authors</span> = [<span class="ruby-string">&quot;npezza&quot;</span>]
91
91
  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">email</span> = [<span class="ruby-string">&quot;npezza93@gmail.com&quot;</span>]
92
92
 
93
93
  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">summary</span> = <span class="ruby-string">&quot;API wrapper for Absorb LMS&quot;</span>
94
- <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">description</span> = <span class="ruby-string">&quot;\&quot;Absorb LMS is a powerful, flexible, and visually stunning software platform teamed with expert implementation and support to help you build the training programs your business needs. Whether your old LMS is slowing you down or you’ve outgrown your current training model, Absorb can help.
95
- \&quot;&quot;</span>
94
+ <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">description</span> = <span class="ruby-string">&quot;This gem provides a ruby wrapper for Absorb&#39;s Learning Management System API. \n\n&quot;</span>
96
95
  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">homepage</span> = <span class="ruby-string">&quot;https://github.com/npezza93/absorb_api&quot;</span>
97
96
  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">license</span> = <span class="ruby-string">&quot;MIT&quot;</span>
98
97
 
99
- <span class="ruby-comment"># Prevent pushing this gem to RubyGems.org by setting &#39;allowed_push_host&#39;, 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">&#39;allowed_push_host&#39;</span>] = <span class="ruby-string">&quot;TODO: Set to &#39;http://mygemserver.com&#39;&quot;</span>
103
- <span class="ruby-keyword">else</span>
104
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;RubyGems 2.0 or newer is required to protect against public gem pushes.&quot;</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">&quot;\x0&quot;</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">&quot;exe&quot;</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>) }
@@ -1,26 +1,28 @@
1
- Sun, 24 Jan 2016 00:57:52 -0500
2
- ./absorb_api-0.1.0.gem Sun, 24 Jan 2016 00:20:27 -0500
3
- ./absorb_api.gemspec Fri, 22 Jan 2016 22:38:47 -0500
4
- ./bin/console Fri, 22 Jan 2016 22:30:41 -0500
5
- ./bin/setup Fri, 22 Jan 2016 22:30:41 -0500
6
- ./Gemfile Sat, 23 Jan 2016 08:25:08 -0500
7
- ./Gemfile.lock Sat, 23 Jan 2016 08:25:27 -0500
8
- ./lib/absorb_api/base.rb Sun, 24 Jan 2016 00:54:56 -0500
9
- ./lib/absorb_api/category.rb Sat, 23 Jan 2016 18:08:36 -0500
10
- ./lib/absorb_api/certificate.rb Sun, 24 Jan 2016 00:01:42 -0500
11
- ./lib/absorb_api/chapter.rb Sat, 23 Jan 2016 18:06:53 -0500
12
- ./lib/absorb_api/collection.rb Sat, 23 Jan 2016 20:58:07 -0500
13
- ./lib/absorb_api/configuration.rb Fri, 22 Jan 2016 22:30:41 -0500
14
- ./lib/absorb_api/course.rb Sat, 23 Jan 2016 23:59:38 -0500
15
- ./lib/absorb_api/course_enrollment.rb Sat, 23 Jan 2016 23:51:45 -0500
16
- ./lib/absorb_api/curriculum.rb Sun, 24 Jan 2016 00:20:14 -0500
17
- ./lib/absorb_api/department.rb Sat, 23 Jan 2016 23:05:43 -0500
18
- ./lib/absorb_api/lesson_enrollment.rb Sat, 23 Jan 2016 09:09:59 -0500
19
- ./lib/absorb_api/orm.rb Sun, 24 Jan 2016 00:02:36 -0500
20
- ./lib/absorb_api/relations.rb Sun, 24 Jan 2016 00:00:56 -0500
21
- ./lib/absorb_api/user.rb Sun, 24 Jan 2016 00:06:32 -0500
22
- ./lib/absorb_api/version.rb Fri, 22 Jan 2016 22:30:41 -0500
23
- ./lib/absorb_api.rb Sat, 23 Jan 2016 18:38:24 -0500
24
- ./LICENSE.txt Fri, 22 Jan 2016 22:30:41 -0500
25
- ./Rakefile Fri, 22 Jan 2016 22:30:41 -0500
26
- ./README.md Sun, 24 Jan 2016 00:57:07 -0500
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
Binary file
@@ -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","()","<p>has_many :lessons, klass: :lesson_enrollment\n"],["lessons_from_collection","AbsorbApi::CourseEnrollment","AbsorbApi/CourseEnrollment.html#method-c-lessons_from_collection","(course_enrollments, modifiedSince)","<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 &#39;rubygems.org&#39;\n<p># Specify your gem&#39;s dependencies in absorb_api.gemspec gemspec\n<p>gem &#39;faraday&#39; …\n"],["Gemfile.lock","","Gemfile_lock.html","","<p>PATH\n\n<pre>remote: .\nspecs:\n absorb_api (0.1.0)</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 =&gt; :spec\n"],["absorb_api.gemspec","","absorb_api_gemspec.html","","<p>lib = File.expand_path(&#39;../lib&#39;, __FILE__) $LOAD_PATH.unshift(lib)\nunless $LOAD_PATH.include?(lib) …\n"],["setup","","bin/setup.html","","<p>#!/usr/bin/env bash set -euo pipefail IFS=$&#39;nt&#39; set -vx\n<p>bundle install\n<p># Do any other automated …\n"]]}}
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 &#39;rubygems.org&#39;\n<p># Specify your gem&#39;s dependencies in absorb_api.gemspec gemspec\n<p>gem &#39;faraday&#39; …\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 =&gt; :spec\n"],["absorb_api.gemspec","","absorb_api_gemspec.html","","<p>lib = File.expand_path(&#39;../lib&#39;, __FILE__) $LOAD_PATH.unshift(lib)\nunless $LOAD_PATH.include?(lib) …\n"],["setup","","bin/setup.html","","<p>#!/usr/bin/env bash set -euo pipefail IFS=$&#39;nt&#39; set -vx\n<p>bundle install\n<p># Do any other automated …\n"]]}}
Binary file
Binary file
@@ -1,6 +1,8 @@
1
1
  module AbsorbApi
2
2
  class Base
3
- def initialize(attributes, &block)
3
+ include Orm
4
+
5
+ def initialize(attributes = [], &block)
4
6
  attributes.each do |k,v|
5
7
  instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil?
6
8
  end
@@ -1,7 +1,5 @@
1
1
  module AbsorbApi
2
2
  class Category < Base
3
- include Orm
4
-
5
3
  attr_accessor :id, :parent_id, :name, :description
6
4
  end
7
5
  end
@@ -1,7 +1,5 @@
1
1
  module AbsorbApi
2
2
  class Certificate < Base
3
- include Orm
4
-
5
3
  attr_accessor :id, :enrollment_id, :full_name, :course_name, :acquired_date, :expiry_date, :notes
6
4
  end
7
5
  end
@@ -1,7 +1,5 @@
1
1
  module AbsorbApi
2
2
  class Chapter < Base
3
- include Orm
4
-
5
3
  attr_accessor :id, :name, :lesson_ids
6
4
  end
7
5
  end
@@ -7,13 +7,23 @@ module AbsorbApi
7
7
  @metadata = metadata
8
8
  end
9
9
 
10
- private
11
- def method_missing(name, *args, &block)
12
- # if klass.respond_to?(name)
13
- # scoping { klass.send(name, *args) }
14
- # else
15
- super
16
- # end
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
@@ -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
- # has_many :lessons, klass: :lesson_enrollment
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, modifiedSince)
20
- if modifiedSince.is_a? DateTime
21
- lessons = []
22
- course_enrollments.each_slice(105) do |enrollment_slice|
23
- api.in_parallel do
24
- enrollment_slice.each do |enrollment|
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
@@ -1,6 +1,5 @@
1
1
  module AbsorbApi
2
2
  class Department < Base
3
- include Orm
4
3
  include Relations
5
4
 
6
5
  attr_accessor :id, :name, :use_department_contact_details, :company_name, :phone_number, :email_address, :external_id, :parent_id, :currency_id
@@ -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
@@ -1,3 +1,3 @@
1
1
  module AbsorbApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.5"
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.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - npezza