bearcat 1.3.39 → 1.3.40

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
- SHA256:
3
- metadata.gz: 65123eeb33d4e34d269eb78e2dd2bbb24a3b0dd22ea8669a0aad71d95fcdd579
4
- data.tar.gz: 27d69431eb95003df4f38413b12de69d797d5b1d1f55a1d2bc06f82a199bf229
2
+ SHA1:
3
+ metadata.gz: 5079e17e4df08521cc13bd4cd446c3b9965b6d84
4
+ data.tar.gz: b79f492ea8f67159be51348e6cd3baefc90e30b8
5
5
  SHA512:
6
- metadata.gz: 8826c81214be7c758f4f3c847407d9b2f926cfaabbcb8ae086108d4aa647dce1a9a6fb9d415dd0ff4982e9f484c7daa57d418fec1c03cc6ca12bd151cdd640ae
7
- data.tar.gz: abc239a8e4211ff6da3af47a56e98a83385a8ca8cbc0ee17b39cbe8f6a4df8dfca72fddfd2e576313ffffd25d669ffa4b481f75886ab563245b9df5838bbf132
6
+ metadata.gz: 9f526fcc6cecacbb4b71bb4a90518738a3b6f45c5eb0b8c61a2b43e0cbbc8f5775ad492baad440a6fb8ac74f097ea9101f206b1e2ee859caef813483c347319c
7
+ data.tar.gz: 77216036689c6a45610fddfe87cfae674bca8a04ff927f795ebe4fb66421192f60dc328cac920fc2143c55bf1f640b0a086098e32ee73b89fd048d3cb1a3d3cd
@@ -10,6 +10,17 @@ module Bearcat
10
10
  get("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
11
11
  end
12
12
 
13
+ def create_module_item(course_id, module_id, params={})
14
+ post("/api/v1/courses/#{course_id}/modules/#{module_id}/items", params)
15
+ end
16
+
17
+ def update_module_item(course_id, module_id, module_item_id, params={})
18
+ put("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
19
+ end
20
+
21
+ def delete_module_item(course_id, module_id, module_item_id, params={})
22
+ delete("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -18,6 +18,13 @@ module Bearcat
18
18
  post("/api/v1/courses/#{course}/modules", params)
19
19
  end
20
20
 
21
+ def update_module(course, module_id, params={})
22
+ put("/api/v1/courses/#{course}/modules/#{module_id}")
23
+ end
24
+
25
+ def delete_module(course, module_id, params={})
26
+ delete("/api/v1/courses/#{course}/modules/#{module_id}")
27
+ end
21
28
  end
22
29
  end
23
30
  end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.39' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.40' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -21,4 +21,40 @@ describe Bearcat::Client::ModuleItems do
21
21
  end
22
22
  end
23
23
 
24
+ describe '#create_module_item' do
25
+ it 'creates a module item' do
26
+ params = { module_item: { title: 'Test Page',
27
+ content_id: '1-dot-1-intro-to-disease',
28
+ type: 'Page' }}
29
+ stub_request(:post, "http://canvas.instructure.com/api/v1/courses/1/modules/1/items")
30
+ .with(body: params)
31
+ .to_return(json_response("module_item.json"))
32
+ module_item = @client.create_module_item(1, 1, params)
33
+ expect(module_item['title']).to eq('Test Page')
34
+ expect(module_item['page_url']).to eq('1-dot-1-intro-to-disease')
35
+ end
36
+ end
37
+
38
+ describe '#update_module_item' do
39
+ it 'updates a module item' do
40
+ params = { module_item: { title: 'Test Page',
41
+ content_id: '1-dot-1-intro-to-disease',
42
+ type: 'Page' }}
43
+ stub_request(:put, "http://canvas.instructure.com/api/v1/courses/1/modules/1/items/2")
44
+ .with(body: params)
45
+ .to_return(json_response("module_item.json"))
46
+ module_item = @client.update_module_item(1, 1, 2, params)
47
+ expect(module_item['title']).to eq('Test Page')
48
+ expect(module_item['page_url']).to eq('1-dot-1-intro-to-disease')
49
+ end
50
+ end
51
+
52
+ describe '#delete_module_item' do
53
+ it 'deletes a module item' do
54
+ stub_request(:delete, "http://canvas.instructure.com/api/v1/courses/1/modules/1/items/2")
55
+ .to_return(json_response('module_item.json'))
56
+ module_item = @client.delete_module_item(1, 1, 2)
57
+ expect(module_item["id"]).to eq(2)
58
+ end
59
+ end
24
60
  end
@@ -33,11 +33,29 @@ describe Bearcat::Client::Modules do
33
33
  it "creates a new module" do
34
34
  name = "new module"
35
35
  stub_request(:post, "http://canvas.instructure.com/api/v1/courses/1/modules")
36
- .with(body: {"name"=>"new module"})
36
+ .with(body: {"name"=> name})
37
37
  .to_return(json_response("created_module.json"))
38
38
  course_module = @client.create_module(1, { name: name })
39
39
  course_module["name"].should == name
40
40
  course_module["id"].should == 1
41
41
  end
42
42
  end
43
+
44
+ describe "#update_module" do
45
+ it "updates a module" do
46
+ stub_request(:put, "http://canvas.instructure.com/api/v1/courses/3/modules/2")
47
+ .to_return(json_response("module.json"))
48
+ updated_module = @client.update_module(3, 2, {})
49
+ expect(updated_module['name']).to eq("Second Module")
50
+ expect(updated_module['id']).to eq(2)
51
+ end
52
+ end
53
+
54
+ describe "#delete_module" do
55
+ it "deletes a module" do
56
+ stub_delete(@client, "/api/v1/courses/3/modules/2").to_return(json_response("module.json"))
57
+ course_module = @client.delete_module(3, 2)
58
+ expect(course_module["id"]).to eq(2)
59
+ end
60
+ end
43
61
  end
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: 1.3.39
4
+ version: 1.3.40
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: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2019-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -369,7 +369,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  - !ruby/object:Gem::Version
370
370
  version: '0'
371
371
  requirements: []
372
- rubygems_version: 3.0.3
372
+ rubyforge_project:
373
+ rubygems_version: 2.5.1
373
374
  signing_key:
374
375
  specification_version: 4
375
376
  summary: Canvas API