lessonly-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lessonly/resource/course.rb +8 -4
- data/lib/lessonly/version.rb +1 -1
- data/spec/course_spec.rb +12 -0
- data/spec/support/fixtures/get_users_2.json +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f284456492f751b0ebf56f2b5de8d04442d996b
|
4
|
+
data.tar.gz: 9ae71b4e6cb547b24132b1ecce901147c7d9e48b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f1d8bb820e0fad5ed01815527531cb0d5aff25827ac0e357db80511f981efac0eb9874824c70e85fdf79f1abf1410347ec3befd448eaedfc97a54587a27d09
|
7
|
+
data.tar.gz: a88f6c70015c417484def558ab730979b85eefb9912294d060d9149a7f8665c9e7f1ef924d6c5f6f2aa0f398fd1badd3bc5926e8fa3f4c026ac89ecf47557ca4
|
@@ -14,13 +14,17 @@ module Lessonly
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def create_assignment(
|
18
|
-
|
17
|
+
def create_assignment(users, due_by = 1.year.from_now)
|
18
|
+
users = [users] unless users.is_a? Array
|
19
|
+
|
20
|
+
new_assignments = users.map do |user|
|
19
21
|
Lessonly::Assignment.new(agent, assignee_id: user.id, due_by: due_by)
|
20
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
self.assignments = assignments + new_assignments
|
21
25
|
|
22
26
|
client.put "#{href}/assignments",
|
23
|
-
Resource.new(agent, assignments:
|
27
|
+
Resource.new(agent, assignments: new_assignments)
|
24
28
|
end
|
25
29
|
|
26
30
|
def destroy_assignment(user)
|
data/lib/lessonly/version.rb
CHANGED
data/spec/course_spec.rb
CHANGED
@@ -53,6 +53,18 @@ describe Lessonly::Course do
|
|
53
53
|
expect(course.assignments.map(&:assignee_id)).to include(user.id)
|
54
54
|
expect(course.assignments.count).to eq 2
|
55
55
|
end
|
56
|
+
|
57
|
+
it 'should accept multiple users' do
|
58
|
+
course = Lessonly::Course.find(1)
|
59
|
+
user3 = Lessonly::User.find(3)
|
60
|
+
user2 = Lessonly::User.find(2)
|
61
|
+
|
62
|
+
course.create_assignment([user3, user2])
|
63
|
+
|
64
|
+
expect(course.assignments.map(&:assignee_id)).to include(user3.id)
|
65
|
+
expect(course.assignments.map(&:assignee_id)).to include(user2.id)
|
66
|
+
expect(course.assignments.count).to eq 3
|
67
|
+
end
|
56
68
|
end
|
57
69
|
|
58
70
|
describe '#destroy_assignment' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lessonly-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skylar Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- spec/support/fixtures/get_groups_1.json
|
191
191
|
- spec/support/fixtures/get_users.json
|
192
192
|
- spec/support/fixtures/get_users_1.json
|
193
|
+
- spec/support/fixtures/get_users_2.json
|
193
194
|
- spec/support/fixtures/get_users_3.json
|
194
195
|
- spec/support/fixtures/put_courses_1_assignments.json
|
195
196
|
- spec/support/fixtures/put_groups_1.json
|
@@ -230,6 +231,7 @@ test_files:
|
|
230
231
|
- spec/support/fixtures/get_groups_1.json
|
231
232
|
- spec/support/fixtures/get_users.json
|
232
233
|
- spec/support/fixtures/get_users_1.json
|
234
|
+
- spec/support/fixtures/get_users_2.json
|
233
235
|
- spec/support/fixtures/get_users_3.json
|
234
236
|
- spec/support/fixtures/put_courses_1_assignments.json
|
235
237
|
- spec/support/fixtures/put_groups_1.json
|