canvas_connect 0.0.1

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.
@@ -0,0 +1,104 @@
1
+ #
2
+ # Copyright (C) 2012 Instructure, Inc.
3
+ #
4
+ # This file is part of Canvas.
5
+ #
6
+ # Canvas is free software: you can redistribute it and/or modify it under
7
+ # the terms of the GNU Affero General Public License as published by the Free
8
+ # Software Foundation, version 3 of the License.
9
+ #
10
+ # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
+ # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
+ # details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License along
16
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../../../spec/spec_helper')
20
+
21
+ describe CanvasConnect::Service do
22
+ subject { CanvasConnect::Service.new('username', 'password', 'http://connect.example.com') }
23
+
24
+ before(:each) do
25
+ subject.stubs(:session_key).returns('CookieValue')
26
+ end
27
+
28
+ let(:login_response) do
29
+ body = <<-END
30
+ <?xml version="1.0" encoding="utf-8"?>
31
+ <results>
32
+ <status code="ok" />
33
+ </results>
34
+ END
35
+
36
+ CanvasConnect::Response.new(200, {}, body)
37
+ end
38
+
39
+ let(:session_response) do
40
+ body = <<-END
41
+ <?xml version="1.0" encoding="utf-8"?>
42
+ <results>
43
+ <status code="ok" />
44
+ <common locale="en" time-zone-id="1" time-zone-java-id="America/Denver">
45
+ <cookie>CookieValue</cookie>
46
+ <date>2012-12-21T12:00:00Z</date>
47
+ <host>http://connect.example.com</host>
48
+ <local-host>SpecHost</local-host>
49
+ <admin-host>http://connect.example.com</admin-host>
50
+ <url>/api/xml?action=common-info&session=CookieValue</url>
51
+ <version>9.0.0.1</version>
52
+ <account account-id="1" />
53
+ <user user-id="1" type="user">
54
+ <name>Don Draper</name>
55
+ <login>don@sterlingcooperdraperpryce.com</login>
56
+ </user>
57
+ </common>
58
+ <reg-user>
59
+ <is-reg-user>false</is-reg-user>
60
+ </reg-user>
61
+ </results>
62
+ END
63
+
64
+ CanvasConnect::Response.new(200, {}, body)
65
+ end
66
+
67
+ it { should respond_to(:username) }
68
+ it { should respond_to(:domain) }
69
+ it { should respond_to(:is_authenticated) }
70
+
71
+ describe 'initialize' do
72
+ it 'should require a username' do
73
+ lambda { CanvasConnect::Service.new }.should raise_error(ArgumentError)
74
+ end
75
+
76
+ it 'should require a password' do
77
+ lambda { CanvasConnect::Service.new('username') }.should raise_error(ArgumentError)
78
+ end
79
+
80
+ it 'should require a domain' do
81
+ lambda { CanvasConnect::Service.new('username', 'password') }.should raise_error(ArgumentError)
82
+ end
83
+ end
84
+
85
+ describe 'log in' do
86
+ it 'should authenticate the given user' do
87
+ subject.expects(:request).with('login', { :login => 'username', :password => 'password' }, true).returns(login_response)
88
+ subject.log_in
89
+ subject.should be_logged_in
90
+ end
91
+ end
92
+
93
+ describe 'method_missing' do
94
+ before(:each) do
95
+ Struct.new('FakeResponse', :status, :headers, :body)
96
+ @fake_response = Struct::FakeResponse.new(200, {}, '')
97
+ end
98
+
99
+ it 'should pass unknown methods onto the Adobe Connect API' do
100
+ subject.send(:client).expects(:get).with('http://connect.example.com/api/xml?action=fake-call', {'session' => 'CookieValue'}).returns(@fake_response)
101
+ subject.fake_call.should be_an_instance_of(CanvasConnect::Response)
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,48 @@
1
+ #
2
+ # Copyright (C) 2012 Instructure, Inc.
3
+ #
4
+ # This file is part of Canvas.
5
+ #
6
+ # Canvas is free software: you can redistribute it and/or modify it under
7
+ # the terms of the GNU Affero General Public License as published by the Free
8
+ # Software Foundation, version 3 of the License.
9
+ #
10
+ # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
+ # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
+ # details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License along
16
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../../spec/spec_helper')
20
+
21
+ describe AdobeConnectConference do
22
+ CONNECT_CONFIG = {
23
+ :domain => 'http://connect.example.com',
24
+ :username => 'user',
25
+ :password => 'password',
26
+ :password_dec => 'password',
27
+ :meeting_container => 'canvas_meetings'
28
+ }
29
+
30
+ before(:each) do
31
+ AdobeConnectConference.stubs(:config).returns(CONNECT_CONFIG)
32
+ @conference = AdobeConnectConference.new
33
+ end
34
+
35
+ subject { AdobeConnectConference.new }
36
+
37
+ context 'with an admin participant' do
38
+ before(:each) do
39
+ @user = User.new(:name => 'Don Draper')
40
+ end
41
+
42
+ it 'should generate an admin url' do
43
+ CanvasConnect::Service.stubs(:user_session).returns('CookieValue')
44
+ @conference.expects(:add_host).with(@user).returns(@user)
45
+ @conference.admin_join_url(@user).should == "http://connect.example.com/canvas-meeting-#{@conference.id}"
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: canvas_connect
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Zach Pendleton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Canvas Connect is an Adobe Connect plugin for the Instructure Canvas
15
+ LMS. It allows teachers and administrators to create and launch Connect conferences
16
+ directly from their courses.
17
+ email:
18
+ - zachp@instructure.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - Gemfile
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - app/models/adobe_connect_conference.rb
29
+ - app/views/plugins/_connect_settings.html.erb
30
+ - canvas_connect.gemspec
31
+ - lib/canvas/plugins/adobe_connect.rb
32
+ - lib/canvas/plugins/validators/adobe_connect_validator.rb
33
+ - lib/canvas_connect.rb
34
+ - lib/canvas_connect/connect_user.rb
35
+ - lib/canvas_connect/meeting_folder.rb
36
+ - lib/canvas_connect/response.rb
37
+ - lib/canvas_connect/service.rb
38
+ - lib/canvas_connect/version.rb
39
+ - spec_canvas/lib/canvas/plugins/validators/adobe_connect_validator_spec.rb
40
+ - spec_canvas/lib/canvas_connect/response_spec.rb
41
+ - spec_canvas/lib/canvas_connect/service_spec.rb
42
+ - spec_canvas/models/adobe_connect_conference_spec.rb
43
+ homepage: http://instructure.com
44
+ licenses: []
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - app
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.8.23
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Adobe Connect integration for Instructure Canvas (http://instructure.com).
68
+ test_files: []
69
+ has_rdoc: