bearcat 0.9.18 → 0.9.19

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: 90b441a976ad2e0183959717d04f71510dc040bc
4
- data.tar.gz: 7eda87e3704266e96fa14a9c023e4c84205ac003
3
+ metadata.gz: a8bf4b934a64ae5d38c51e9ce29a3fbb20de5074
4
+ data.tar.gz: ff4c6a2d236334ade66a5d30248baae97028f01c
5
5
  SHA512:
6
- metadata.gz: 2a5ea5d5c54a4390a438496c05bb11389dab39c536db2972ddb9e37267e030ada528d313334c6bc8145d39b6b11c63646884fcea6597f6e5aafa79a49f936a97
7
- data.tar.gz: 351bcfec746792977702616a4d9a5a575bfa654f2732a4da7a6946a6cd5e93149725676cef91700ae7b11308a439c239f29df56af9c6b653d9b5fbeef0e8fa17
6
+ metadata.gz: 9b4858784e5d2bdbd27f9d99ff8fefb7c58d53c2b4814362e1a4ae6194972763bd22bc7173da7a4f28b50ef2838e877db3c5743a88efc21e31ac75c8a41eaedc
7
+ data.tar.gz: 1a399a9a378b3e377d55aa700cd8a9ca403a46ae141f59541d0019b188bc6b57e011d1ed0939d0b854894965ccb8a914cf9e16859cc58f8a9b2e6b4417244c0f
@@ -18,10 +18,14 @@ module Bearcat
18
18
  post("/api/v1/sections/#{section.to_s}/enrollments", params)
19
19
  end
20
20
 
21
+ def enroll_in_course(course, params={})
22
+ post("/api/v1/courses/#{course.to_s}/enrollments", params)
23
+ end
24
+
21
25
  def conclude_enrollment(course, enrollment, params={})
22
26
  delete("/api/v1/courses/#{course}/enrollments/#{enrollment}", params)
23
27
  end
24
28
 
25
29
  end
26
30
  end
27
- end
31
+ end
@@ -15,7 +15,7 @@ module FileHelper
15
15
  params['Filename'] = File.basename(file_path)
16
16
  params['file'] = Faraday::UploadIO.new(file_path, params['content-type'])
17
17
  response = upload_connection.post(url, params)
18
- if response.status == (302 || 303) #success if it is a redirect
18
+ if [302, 303].include? response.status #success if it is a redirect
19
19
  response.headers['Location']
20
20
  else
21
21
  raise 'FailedFileUpload'
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '0.9.18' unless defined?(Bearcat::VERSION)
2
+ VERSION = '0.9.19' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -48,6 +48,19 @@ describe Bearcat::Client::Enrollments do
48
48
  enrollment["enrollment_state"].should == "invited"
49
49
  end
50
50
 
51
+ it "enrolls a student in a course" do
52
+ stub_post(@client, "/api/v1/courses/3/enrollments")
53
+ .with(:body => {"enrollment"=>{"user_id"=>"1", "type"=>"StudentEnrollment"}})
54
+ .to_return(json_response("enroll_student.json"))
55
+
56
+ enrollment = @client.enroll_in_course(3, {"enrollment[user_id]" => 1, "enrollment[type]" => "StudentEnrollment"})
57
+ enrollment["course_id"].should == 3
58
+ enrollment["course_section_id"].should == 70
59
+ enrollment["id"].should == 1386
60
+ enrollment["role"].should == "StudentEnrollment"
61
+ enrollment["enrollment_state"].should == "invited"
62
+ end
63
+
51
64
  it "concludes a students enrollment" do
52
65
  stub_request(:delete, "http://canvas.instructure.com/api/v1/courses/3/enrollments/1386?task=conclude").to_return(json_response("conclude_enrollment.json"))
53
66
  enrollment = @client.conclude_enrollment(3, 1386, {"task" => "conclude"})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bearcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.18
4
+ version: 0.9.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake