absorb_api 0.1.6 → 0.1.7
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/doc/AbsorbApi.html +83 -0
- data/doc/AbsorbApi/Base.html +0 -83
- data/doc/AbsorbApi/Course.html +5 -5
- data/doc/AbsorbApi/CourseEnrollment.html +6 -17
- data/doc/AbsorbApi/Lesson.html +279 -0
- data/doc/AbsorbApi/Orm.html +12 -4
- data/doc/AbsorbApi/Prerequisite.html +188 -0
- data/doc/AbsorbApi/Relations.html +5 -5
- data/doc/AbsorbApi/Resource.html +162 -0
- data/doc/AbsorbApi/Role.html +149 -0
- data/doc/AbsorbApi/SessionSchedule.html +253 -0
- data/doc/AbsorbApi/Tag.html +147 -0
- data/doc/AbsorbApi/User.html +3 -3
- data/doc/Gemfile_lock.html +1 -1
- data/doc/README_md.html +122 -10
- data/doc/created.rid +32 -28
- data/doc/index.html +12 -0
- 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/doc/table_of_contents.html +30 -4
- data/lib/absorb_api.rb +20 -0
- data/lib/absorb_api/base.rb +0 -21
- data/lib/absorb_api/course.rb +3 -3
- data/lib/absorb_api/course_enrollment.rb +3 -3
- data/lib/absorb_api/orm.rb +2 -2
- data/lib/absorb_api/relations.rb +5 -5
- data/lib/absorb_api/user.rb +3 -3
- data/lib/absorb_api/version.rb +1 -1
- metadata +8 -2
data/doc/created.rid
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
-
Sun, 24 Jan 2016
|
2
|
-
./absorb_api-0.1.
|
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/relations.rb Sun, 24 Jan 2016
|
23
|
-
./lib/absorb_api/
|
24
|
-
./lib/absorb_api/
|
25
|
-
./lib/absorb_api.rb Sun, 24 Jan 2016
|
26
|
-
./
|
27
|
-
./
|
28
|
-
./
|
1
|
+
Sun, 24 Jan 2016 20:45:40 -0500
|
2
|
+
./absorb_api-0.1.6.gem Sun, 24 Jan 2016 20:16:53 -0500
|
3
|
+
./absorb_api.gemspec Sun, 24 Jan 2016 15:20:52 -0500
|
4
|
+
./bin/console Sun, 24 Jan 2016 15:20:52 -0500
|
5
|
+
./bin/setup Sun, 24 Jan 2016 15:20:52 -0500
|
6
|
+
./Gemfile Sun, 24 Jan 2016 15:20:52 -0500
|
7
|
+
./Gemfile.lock Sun, 24 Jan 2016 20:07:00 -0500
|
8
|
+
./lib/absorb_api/base.rb Sun, 24 Jan 2016 20:04:37 -0500
|
9
|
+
./lib/absorb_api/category.rb Sun, 24 Jan 2016 15:20:52 -0500
|
10
|
+
./lib/absorb_api/certificate.rb Sun, 24 Jan 2016 15:20:52 -0500
|
11
|
+
./lib/absorb_api/chapter.rb Sun, 24 Jan 2016 15:20:52 -0500
|
12
|
+
./lib/absorb_api/collection.rb Sun, 24 Jan 2016 15:20:52 -0500
|
13
|
+
./lib/absorb_api/configuration.rb Sun, 24 Jan 2016 15:20:52 -0500
|
14
|
+
./lib/absorb_api/course.rb Sun, 24 Jan 2016 20:16:27 -0500
|
15
|
+
./lib/absorb_api/course_enrollment.rb Sun, 24 Jan 2016 20:11:22 -0500
|
16
|
+
./lib/absorb_api/curriculum.rb Sun, 24 Jan 2016 15:20:52 -0500
|
17
|
+
./lib/absorb_api/department.rb Sun, 24 Jan 2016 15:20:52 -0500
|
18
|
+
./lib/absorb_api/lesson.rb Sun, 24 Jan 2016 15:20:52 -0500
|
19
|
+
./lib/absorb_api/lesson_enrollment.rb Sun, 24 Jan 2016 15:20:52 -0500
|
20
|
+
./lib/absorb_api/orm.rb Sun, 24 Jan 2016 20:16:30 -0500
|
21
|
+
./lib/absorb_api/prerequisite.rb Sun, 24 Jan 2016 15:20:52 -0500
|
22
|
+
./lib/absorb_api/relations.rb Sun, 24 Jan 2016 20:10:12 -0500
|
23
|
+
./lib/absorb_api/resource.rb Sun, 24 Jan 2016 15:20:52 -0500
|
24
|
+
./lib/absorb_api/role.rb Sun, 24 Jan 2016 15:20:52 -0500
|
25
|
+
./lib/absorb_api/session_schedule.rb Sun, 24 Jan 2016 15:20:52 -0500
|
26
|
+
./lib/absorb_api/tag.rb Sun, 24 Jan 2016 15:20:52 -0500
|
27
|
+
./lib/absorb_api/user.rb Sun, 24 Jan 2016 20:11:30 -0500
|
28
|
+
./lib/absorb_api/version.rb Sun, 24 Jan 2016 20:45:36 -0500
|
29
|
+
./lib/absorb_api.rb Sun, 24 Jan 2016 20:16:39 -0500
|
30
|
+
./LICENSE.txt Sun, 24 Jan 2016 15:20:52 -0500
|
31
|
+
./Rakefile Sun, 24 Jan 2016 15:20:52 -0500
|
32
|
+
./README.md Sun, 24 Jan 2016 15:20:52 -0500
|
data/doc/index.html
CHANGED
@@ -101,16 +101,28 @@
|
|
101
101
|
|
102
102
|
<li><a href="./AbsorbApi/Department.html">AbsorbApi::Department</a>
|
103
103
|
|
104
|
+
<li><a href="./AbsorbApi/Lesson.html">AbsorbApi::Lesson</a>
|
105
|
+
|
104
106
|
<li><a href="./AbsorbApi/LessonEnrollment.html">AbsorbApi::LessonEnrollment</a>
|
105
107
|
|
106
108
|
<li><a href="./AbsorbApi/Orm.html">AbsorbApi::Orm</a>
|
107
109
|
|
110
|
+
<li><a href="./AbsorbApi/Prerequisite.html">AbsorbApi::Prerequisite</a>
|
111
|
+
|
108
112
|
<li><a href="./AbsorbApi/Relations.html">AbsorbApi::Relations</a>
|
109
113
|
|
114
|
+
<li><a href="./AbsorbApi/Resource.html">AbsorbApi::Resource</a>
|
115
|
+
|
110
116
|
<li><a href="./AbsorbApi/ResourceNotFound.html">AbsorbApi::ResourceNotFound</a>
|
111
117
|
|
118
|
+
<li><a href="./AbsorbApi/Role.html">AbsorbApi::Role</a>
|
119
|
+
|
112
120
|
<li><a href="./AbsorbApi/RouteNotFound.html">AbsorbApi::RouteNotFound</a>
|
113
121
|
|
122
|
+
<li><a href="./AbsorbApi/SessionSchedule.html">AbsorbApi::SessionSchedule</a>
|
123
|
+
|
124
|
+
<li><a href="./AbsorbApi/Tag.html">AbsorbApi::Tag</a>
|
125
|
+
|
114
126
|
<li><a href="./AbsorbApi/User.html">AbsorbApi::User</a>
|
115
127
|
|
116
128
|
<li><a href="./AbsorbApi/ValidationError.html">AbsorbApi::ValidationError</a>
|
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::
|
1
|
+
var search_data = {"index":{"searchIndex":["absorbapi","base","category","certificate","chapter","collection","configuration","course","courseenrollment","curriculum","department","lesson","lessonenrollment","orm","prerequisite","relations","resource","resourcenotfound","role","routenotfound","sessionschedule","tag","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::lesson","absorbapi::lessonenrollment","absorbapi::orm","absorbapi::prerequisite","absorbapi::relations","absorbapi::resource","absorbapi::resourcenotfound","absorbapi::role","absorbapi::routenotfound","absorbapi::sessionschedule","absorbapi::tag","absorbapi::user","absorbapi::validationerror","absorbapi::orm#all()","absorbapi::api()","absorbapi::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::Lesson","","AbsorbApi/Lesson.html","",""],["AbsorbApi::LessonEnrollment","","AbsorbApi/LessonEnrollment.html","",""],["AbsorbApi::Orm","","AbsorbApi/Orm.html","",""],["AbsorbApi::Prerequisite","","AbsorbApi/Prerequisite.html","",""],["AbsorbApi::Relations","","AbsorbApi/Relations.html","",""],["AbsorbApi::Resource","","AbsorbApi/Resource.html","",""],["AbsorbApi::ResourceNotFound","","AbsorbApi/ResourceNotFound.html","",""],["AbsorbApi::Role","","AbsorbApi/Role.html","",""],["AbsorbApi::RouteNotFound","","AbsorbApi/RouteNotFound.html","",""],["AbsorbApi::SessionSchedule","","AbsorbApi/SessionSchedule.html","",""],["AbsorbApi::Tag","","AbsorbApi/Tag.html","",""],["AbsorbApi::User","","AbsorbApi/User.html","",""],["AbsorbApi::ValidationError","","AbsorbApi/ValidationError.html","",""],["all","AbsorbApi::Orm","AbsorbApi/Orm.html#method-i-all","()",""],["api","AbsorbApi","AbsorbApi.html#method-c-api","()",""],["authorize","AbsorbApi","AbsorbApi.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, **conditions)","<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.6)</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/doc/table_of_contents.html
CHANGED
@@ -49,6 +49,14 @@
|
|
49
49
|
<li><a href="README_md.html#label-Chapter">Chapter</a>
|
50
50
|
<li><a href="README_md.html#label-Curriculum">Curriculum</a>
|
51
51
|
<li><a href="README_md.html#label-Department">Department</a>
|
52
|
+
<li><a href="README_md.html#label-Role">Role</a>
|
53
|
+
<li><a href="README_md.html#label-Tag">Tag</a>
|
54
|
+
<li><a href="README_md.html#label-SessionSchedule">SessionSchedule</a>
|
55
|
+
<li><a href="README_md.html#label-Resource">Resource</a>
|
56
|
+
<li><a href="README_md.html#label-Prerequisite">Prerequisite</a>
|
57
|
+
<li><a href="README_md.html#label-Lesson">Lesson</a>
|
58
|
+
<li><a href="README_md.html#label-CourseEnrollment">CourseEnrollment</a>
|
59
|
+
<li><a href="README_md.html#label-LessonEnrollment">LessonEnrollment</a>
|
52
60
|
<li><a href="README_md.html#label-Development">Development</a>
|
53
61
|
<li><a href="README_md.html#label-Contributing">Contributing</a>
|
54
62
|
<li><a href="README_md.html#label-License">License</a>
|
@@ -101,21 +109,39 @@
|
|
101
109
|
<li class="class">
|
102
110
|
<a href="AbsorbApi/Department.html">AbsorbApi::Department</a>
|
103
111
|
</li>
|
112
|
+
<li class="class">
|
113
|
+
<a href="AbsorbApi/Lesson.html">AbsorbApi::Lesson</a>
|
114
|
+
</li>
|
104
115
|
<li class="class">
|
105
116
|
<a href="AbsorbApi/LessonEnrollment.html">AbsorbApi::LessonEnrollment</a>
|
106
117
|
</li>
|
107
118
|
<li class="module">
|
108
119
|
<a href="AbsorbApi/Orm.html">AbsorbApi::Orm</a>
|
109
120
|
</li>
|
121
|
+
<li class="class">
|
122
|
+
<a href="AbsorbApi/Prerequisite.html">AbsorbApi::Prerequisite</a>
|
123
|
+
</li>
|
110
124
|
<li class="module">
|
111
125
|
<a href="AbsorbApi/Relations.html">AbsorbApi::Relations</a>
|
112
126
|
</li>
|
127
|
+
<li class="class">
|
128
|
+
<a href="AbsorbApi/Resource.html">AbsorbApi::Resource</a>
|
129
|
+
</li>
|
113
130
|
<li class="class">
|
114
131
|
<a href="AbsorbApi/ResourceNotFound.html">AbsorbApi::ResourceNotFound</a>
|
115
132
|
</li>
|
133
|
+
<li class="class">
|
134
|
+
<a href="AbsorbApi/Role.html">AbsorbApi::Role</a>
|
135
|
+
</li>
|
116
136
|
<li class="class">
|
117
137
|
<a href="AbsorbApi/RouteNotFound.html">AbsorbApi::RouteNotFound</a>
|
118
138
|
</li>
|
139
|
+
<li class="class">
|
140
|
+
<a href="AbsorbApi/SessionSchedule.html">AbsorbApi::SessionSchedule</a>
|
141
|
+
</li>
|
142
|
+
<li class="class">
|
143
|
+
<a href="AbsorbApi/Tag.html">AbsorbApi::Tag</a>
|
144
|
+
</li>
|
119
145
|
<li class="class">
|
120
146
|
<a href="AbsorbApi/User.html">AbsorbApi::User</a>
|
121
147
|
</li>
|
@@ -128,14 +154,14 @@
|
|
128
154
|
<ul>
|
129
155
|
|
130
156
|
<li class="method">
|
131
|
-
<a href="AbsorbApi
|
157
|
+
<a href="AbsorbApi.html#method-c-api">::api</a>
|
132
158
|
—
|
133
|
-
<span class="container">AbsorbApi
|
159
|
+
<span class="container">AbsorbApi</span>
|
134
160
|
|
135
161
|
<li class="method">
|
136
|
-
<a href="AbsorbApi
|
162
|
+
<a href="AbsorbApi.html#method-c-authorize">::authorize</a>
|
137
163
|
—
|
138
|
-
<span class="container">AbsorbApi
|
164
|
+
<span class="container">AbsorbApi</span>
|
139
165
|
|
140
166
|
<li class="method">
|
141
167
|
<a href="AbsorbApi.html#method-c-configure">::configure</a>
|
data/lib/absorb_api.rb
CHANGED
@@ -29,4 +29,24 @@ require "absorb_api/prerequisite"
|
|
29
29
|
require "absorb_api/lesson"
|
30
30
|
|
31
31
|
module AbsorbApi
|
32
|
+
def self.authorize
|
33
|
+
@authorize ||= Faraday.new(:url => AbsorbApi.configuration.url) do |faraday|
|
34
|
+
faraday.request :url_encoded
|
35
|
+
faraday.response :logger
|
36
|
+
faraday.adapter :typhoeus
|
37
|
+
end.post do |req|
|
38
|
+
req.url 'Authenticate', { username: AbsorbApi.configuration.absorbuser, password: AbsorbApi.configuration.absorbpass, privateKey: AbsorbApi.configuration.absorbkey }
|
39
|
+
req.headers['Content-Type'] = 'application/json'
|
40
|
+
req.headers["accept"] = "json"
|
41
|
+
end.body.delete('\\"')
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.api
|
45
|
+
@api ||= Faraday.new(:url => AbsorbApi.configuration.url, :parallel_manager => Typhoeus::Hydra.new(:max_concurrency => 200)) do |faraday|
|
46
|
+
faraday.request :json
|
47
|
+
faraday.response :json, :content_type => /\bjson$/
|
48
|
+
faraday.adapter :typhoeus
|
49
|
+
faraday.headers = {"Authorization" => authorize }
|
50
|
+
end
|
51
|
+
end
|
32
52
|
end
|
data/lib/absorb_api/base.rb
CHANGED
@@ -8,26 +8,5 @@ module AbsorbApi
|
|
8
8
|
end
|
9
9
|
yield self if block_given?
|
10
10
|
end
|
11
|
-
|
12
|
-
def self.authorize
|
13
|
-
@authorize ||= Faraday.new(:url => AbsorbApi.configuration.url) do |faraday|
|
14
|
-
faraday.request :url_encoded
|
15
|
-
faraday.response :logger
|
16
|
-
faraday.adapter :typhoeus
|
17
|
-
end.post do |req|
|
18
|
-
req.url 'Authenticate', { username: AbsorbApi.configuration.absorbuser, password: AbsorbApi.configuration.absorbpass, privateKey: AbsorbApi.configuration.absorbkey }
|
19
|
-
req.headers['Content-Type'] = 'application/json'
|
20
|
-
req.headers["accept"] = "json"
|
21
|
-
end.body.delete('\\"')
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
@api ||= Faraday.new(:url => AbsorbApi.configuration.url, :parallel_manager => Typhoeus::Hydra.new(:max_concurrency => 200)) do |faraday|
|
26
|
-
faraday.request :json
|
27
|
-
faraday.response :json, :content_type => /\bjson$/
|
28
|
-
faraday.adapter :typhoeus
|
29
|
-
faraday.headers = {"Authorization" => authorize }
|
30
|
-
end
|
31
|
-
end
|
32
11
|
end
|
33
12
|
end
|
data/lib/absorb_api/course.rb
CHANGED
@@ -10,14 +10,14 @@ module AbsorbApi
|
|
10
10
|
has_many :resources
|
11
11
|
has_many :prerequisites
|
12
12
|
has_many :lessons
|
13
|
-
|
13
|
+
|
14
14
|
# gets all associated enrollments given a collection of courses
|
15
15
|
# all calls are called in parallel
|
16
16
|
def self.enrollments_from_collection(courses, **conditions)
|
17
17
|
enrollments = []
|
18
|
-
api.in_parallel do
|
18
|
+
AbsorbApi.api.in_parallel do
|
19
19
|
courses.reject { |course| AbsorbApi.configuration.ignored_course_ids.include? course.id }.each do |course|
|
20
|
-
enrollments << api.get("courses/#{course.id}/enrollments", conditions)
|
20
|
+
enrollments << AbsorbApi.api.get("courses/#{course.id}/enrollments", conditions)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
enrollments.map { |response| response.body.map { |attrs| CourseEnrollment.new(attrs) } }.flatten
|
@@ -3,7 +3,7 @@ module AbsorbApi
|
|
3
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
|
4
4
|
|
5
5
|
def lessons(**conditions)
|
6
|
-
api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", conditions).body.map! do |lesson_attributes|
|
6
|
+
AbsorbApi.api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", conditions).body.map! do |lesson_attributes|
|
7
7
|
LessonEnrollment.new(lesson_attributes)
|
8
8
|
end
|
9
9
|
end
|
@@ -15,9 +15,9 @@ module AbsorbApi
|
|
15
15
|
def self.lessons_from_collection(course_enrollments, **filters)
|
16
16
|
lessons = []
|
17
17
|
course_enrollments.each_slice(105) do |enrollment_slice|
|
18
|
-
api.in_parallel do
|
18
|
+
AbsorbApi.api.in_parallel do
|
19
19
|
enrollment_slice.each do |enrollment|
|
20
|
-
lessons << api.get("users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons", filters)
|
20
|
+
lessons << AbsorbApi.api.get("users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons", filters)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/absorb_api/orm.rb
CHANGED
@@ -9,7 +9,7 @@ module AbsorbApi
|
|
9
9
|
class_methods do
|
10
10
|
def find(id)
|
11
11
|
raise ResourceNotFound if id.blank?
|
12
|
-
response =
|
12
|
+
response = AbsorbApi.api.get("#{to_s.demodulize.pluralize}/#{id}")
|
13
13
|
if response.status == 404
|
14
14
|
raise(RouteNotFound)
|
15
15
|
elsif response.status == 400
|
@@ -20,7 +20,7 @@ module AbsorbApi
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def all
|
23
|
-
response =
|
23
|
+
response = AbsorbApi.api.get("#{to_s.demodulize.pluralize}")
|
24
24
|
if response.status == 404
|
25
25
|
raise RouteNotFound
|
26
26
|
elsif response.status == 400
|
data/lib/absorb_api/relations.rb
CHANGED
@@ -7,13 +7,13 @@ module AbsorbApi
|
|
7
7
|
klass ||= rel_name
|
8
8
|
|
9
9
|
define_method "#{rel_name.to_s}" do |**conditions|
|
10
|
-
|
10
|
+
AbsorbApi.api.get("#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}", conditions).body.map! do |attributes|
|
11
11
|
"AbsorbApi::#{klass.to_s.classify}".constantize.new(attributes)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
define_method "find_#{rel_name.to_s.singularize}" do |child_id|
|
16
|
-
response =
|
16
|
+
response = AbsorbApi.api.get("#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}/#{child_id}")
|
17
17
|
if response.status == 400
|
18
18
|
raise ResourceNotFound
|
19
19
|
else
|
@@ -22,7 +22,7 @@ module AbsorbApi
|
|
22
22
|
end
|
23
23
|
|
24
24
|
define_method "#{rel_name.to_s.singularize}_ids" do
|
25
|
-
|
25
|
+
AbsorbApi.api.get("#{self.class.to_s.demodulize.pluralize}/#{id}/#{rel_name.to_s}").body.map! do |attributes|
|
26
26
|
"AbsorbApi::#{klass.to_s.classify}".constantize.new(attributes)
|
27
27
|
end.map(&:id)
|
28
28
|
end
|
@@ -32,12 +32,12 @@ module AbsorbApi
|
|
32
32
|
klass ||= rel_name
|
33
33
|
|
34
34
|
define_method "#{rel_name.to_s}" do
|
35
|
-
"AbsorbApi::#{klass.to_s.classify}".constantize.new(
|
35
|
+
"AbsorbApi::#{klass.to_s.classify}".constantize.new(AbsorbApi.api.get("#{klass.to_s.pluralize}/"+ send(rel_name.to_s + "_id")).body)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
def where(**conditions)
|
40
|
-
Collection.new(
|
40
|
+
Collection.new( AbsorbApi.api.get("#{to_s.demodulize.pluralize}", conditions).body.map! do |attributes|
|
41
41
|
new(attributes)
|
42
42
|
end, {klass: to_s.demodulize } )
|
43
43
|
end
|
data/lib/absorb_api/user.rb
CHANGED
@@ -8,16 +8,16 @@ module AbsorbApi
|
|
8
8
|
has_many :enrollments, klass: :course_enrollment
|
9
9
|
has_many :certificates
|
10
10
|
has_many :resources
|
11
|
-
|
11
|
+
|
12
12
|
# gets all associated courses given a collection of users
|
13
13
|
# all calls are called in parallel
|
14
14
|
# users are chunked in groups of 105 to keep typhoeus from getting bogged down
|
15
15
|
def self.courses_from_collection(users)
|
16
16
|
courses = []
|
17
17
|
users.each_slice(105) do |user_slice|
|
18
|
-
api.in_parallel do
|
18
|
+
AbsorbApi.api.in_parallel do
|
19
19
|
user_slice.each do |user|
|
20
|
-
courses << api.get("users/#{user.id}/courses")
|
20
|
+
courses << AbsorbApi.api.get("users/#{user.id}/courses")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/absorb_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: absorb_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- npezza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -65,11 +65,17 @@ files:
|
|
65
65
|
- doc/AbsorbApi/CourseEnrollment.html
|
66
66
|
- doc/AbsorbApi/Curriculum.html
|
67
67
|
- doc/AbsorbApi/Department.html
|
68
|
+
- doc/AbsorbApi/Lesson.html
|
68
69
|
- doc/AbsorbApi/LessonEnrollment.html
|
69
70
|
- doc/AbsorbApi/Orm.html
|
71
|
+
- doc/AbsorbApi/Prerequisite.html
|
70
72
|
- doc/AbsorbApi/Relations.html
|
73
|
+
- doc/AbsorbApi/Resource.html
|
71
74
|
- doc/AbsorbApi/ResourceNotFound.html
|
75
|
+
- doc/AbsorbApi/Role.html
|
72
76
|
- doc/AbsorbApi/RouteNotFound.html
|
77
|
+
- doc/AbsorbApi/SessionSchedule.html
|
78
|
+
- doc/AbsorbApi/Tag.html
|
73
79
|
- doc/AbsorbApi/User.html
|
74
80
|
- doc/AbsorbApi/ValidationError.html
|
75
81
|
- doc/Gemfile.html
|