canvas_connect 0.1.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 44f5fe287ab3b420a5dfe8d086ecb2baf9f52204
4
+ data.tar.gz: 8d25e01e810dc848577605c98e6eb7f25e19ed73
5
+ SHA512:
6
+ metadata.gz: 7df57750b292460c1d85d931d11dc4ba54d25e65a62dabec02df23568c1ae4d9aff473c2baef293a83e98352723492ba0373efa1d0abece052104ea9032b7d13
7
+ data.tar.gz: 0c045d467ec9046be597a6b3f6d6af6723bbd00c51bbf0727e639dd00ca35e5cb373c854bb2435e251a53f035bd572545a9184da8eb14ad742997221474ad0c2
@@ -83,23 +83,38 @@ class AdobeConnectConference < WebConference
83
83
  end
84
84
  end
85
85
 
86
+ # Public: List all of the recordings for a meeting
87
+ #
88
+ # Returns an Array of MeetingArchive, or an empty Array if there are no recordings
89
+ def recordings
90
+ if key = find_conference_key
91
+ CanvasConnect::MeetingArchive.retrieve(key).map do |recording|
92
+ {
93
+ recording_id: recording.id,
94
+ duration_minutes: recording.duration.to_i,
95
+ title: recording.name,
96
+ updated_at: recording.date_modified,
97
+ created_at: recording.date_created,
98
+ playback_url: "#{config[:domain]}#{recording.url_path}",
99
+ }
100
+ end
101
+ else
102
+ []
103
+ end
104
+ end
105
+
86
106
  protected
87
107
  # Internal: Retrieve the SCO-ID for this meeting.
88
108
  #
89
109
  # Returns an SCO-ID string.
90
110
  def find_conference_key
91
- unless conference_key.present?
92
- meeting_node = meeting_folder.contents.xpath("//sco[name=#{meeting_name.inspect}]")
93
- # if meeting node exists, get that value
94
- if meeting_node.present?
95
- self.conference_key = meeting_node.attr('sco-id').value
96
- else
97
- # meeting node not found (by name)
98
- raise CanvasConnect::MeetingNotFound, "Meeting with name '#{meeting_name}' not found"
111
+ unless @conference_key.present?
112
+ response = connect_service.sco_by_url(:url_path => meeting_url_suffix)
113
+ if response.body.at_xpath('//status').attr('code') == 'ok'
114
+ @conference_key = response.body.xpath('//sco[@sco-id]').attr('sco-id').value
99
115
  end
100
116
  end
101
-
102
- conference_key
117
+ @conference_key
103
118
  end
104
119
 
105
120
  # Internal: Register a participant as a host.
@@ -16,8 +16,8 @@
16
16
  # with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  #
18
18
 
19
- require 'adobe_connect'
20
- require 'canvas_connect/version'
19
+ require "adobe_connect"
20
+ require "canvas_connect/version"
21
21
 
22
22
  module CanvasConnect
23
23
  class ConnectionError < StandardError; end
@@ -39,6 +39,7 @@ module CanvasConnect
39
39
  require_dependency File.expand_path('../app/models/adobe_connect_conference.rb', File.dirname(__FILE__))
40
40
  require_dependency "canvas/plugins/validators/adobe_connect_validator"
41
41
  require_dependency "canvas/plugins/adobe_connect"
42
+ require_dependency "canvas_connect/meeting_archive"
42
43
 
43
44
  Canvas::Plugins::AdobeConnect.new
44
45
  end
@@ -0,0 +1,52 @@
1
+ #
2
+ # Copyright (C) 2013 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
+ module CanvasConnect
19
+ class MeetingArchive
20
+ ATTRIBUTES = [:name, :url_path, :date_begin, :date_end, :date_modified, :duration, :date_created]
21
+ attr_accessor :meeting_id
22
+
23
+ def self.retrieve(meeting_id, client = CanvasConnect.client)
24
+ result = client.sco_contents(sco_id: meeting_id, filter_icon: 'archive')
25
+ Array(result.at_xpath('results/scos').try(:children)).map do |archive|
26
+ MeetingArchive.new(Nokogiri::XML(archive.to_xml))
27
+ end
28
+ end
29
+
30
+ # Public: Create a new MeetingArchive.
31
+ #
32
+ # meeting_id - The id of the meeting on Adobe Connect (must already exist).
33
+ # client - A CanvasConnect::Service to make requests with. (default: CanvasConnect.client)
34
+ def initialize(archive)
35
+ @attr_cache = {}
36
+ @archive = archive
37
+ end
38
+
39
+ def id
40
+ @archive.attr('sco-id')
41
+ end
42
+
43
+ def method_missing(meth, *args, &block)
44
+ if ATTRIBUTES.include?(meth)
45
+ @attr_cache[meth] ||= @archive.at_xpath("//#{meth.to_s.dasherize}").try(:text)
46
+ else
47
+ super
48
+ end
49
+ end
50
+
51
+ end
52
+ end
@@ -1,3 +1,3 @@
1
1
  module CanvasConnect
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2'
3
3
  end
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright (C) 2013 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::Response do
22
+
23
+ describe CanvasConnect::MeetingArchive do
24
+
25
+ subject { CanvasConnect::MeetingArchive.retrieve(38230, nil).first }
26
+
27
+ before (:each) do
28
+ subject.should_receive(:archive) {
29
+ '<?xml version="1.0" encoding="utf-8"?>
30
+ <results>
31
+ <status code="ok"/>
32
+ <scos>
33
+ <sco sco-id="38230" source-sco-id="" folder-id="38223" type="content" icon="archive" display-seq="0" duration="0" is-folder="0">
34
+ <name>Test Recording</name>
35
+ <url-path>/p3u8rj0rvuj/</url-path>
36
+ <date-begin>2013-09-05T12:13:03.387-06:00</date-begin>
37
+ <date-end>2013-09-05T12:13:28.970-06:00</date-end>
38
+ <date-created>2013-09-05T12:13:03.387-06:00</date-created>
39
+ <date-modified>2013-09-05T12:13:29.727-06:00</date-modified>
40
+ </sco>
41
+ </scos>
42
+ </results>'
43
+ }
44
+ end
45
+
46
+ it "returns the name" do
47
+ subject.name.should == 'Test Recording'
48
+ end
49
+
50
+ it "returns the url_path" do
51
+ subject.url_path.should == '/p3u8rj0rvuj/'
52
+ end
53
+
54
+ it "returns the date_begin" do
55
+ subject.date_begin.should == '2013-09-05T12:13:03.387-06:00'
56
+ end
57
+
58
+ it "returns the date end" do
59
+ subject.date_end.should == '2013-09-05T12:13:28.970-06:00'
60
+ end
61
+
62
+ it "returns the date created" do
63
+ subject.date_created.should == '2013-09-05T12:13:03.387-06:00'
64
+ end
65
+
66
+ it "returns the date modified" do
67
+ subject.date_modified.should == '2013-09-05T12:13:29.727-06:00'
68
+ end
69
+
70
+ end
71
+ end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: '0.2'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Zach Pendleton
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2013-10-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.9.6
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.9.6
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: adobe_connect
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -63,35 +58,35 @@ files:
63
58
  - lib/canvas/plugins/adobe_connect.rb
64
59
  - lib/canvas/plugins/validators/adobe_connect_validator.rb
65
60
  - lib/canvas_connect.rb
61
+ - lib/canvas_connect/meeting_archive.rb
66
62
  - lib/canvas_connect/version.rb
67
63
  - spec_canvas/lib/canvas/plugins/validators/adobe_connect_validator_spec.rb
64
+ - spec_canvas/lib/canvas_connect/meeting_archive_spec.rb
68
65
  - spec_canvas/lib/canvas_connect/response_spec.rb
69
66
  - spec_canvas/lib/canvas_connect/service_spec.rb
70
67
  - spec_canvas/models/adobe_connect_conference_spec.rb
71
68
  homepage: http://instructure.com
72
69
  licenses: []
70
+ metadata: {}
73
71
  post_install_message:
74
72
  rdoc_options: []
75
73
  require_paths:
76
74
  - app
77
75
  - lib
78
76
  required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
77
  requirements:
81
- - - ! '>='
78
+ - - '>='
82
79
  - !ruby/object:Gem::Version
83
80
  version: '0'
84
81
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
82
  requirements:
87
- - - ! '>='
83
+ - - '>='
88
84
  - !ruby/object:Gem::Version
89
85
  version: '0'
90
86
  requirements: []
91
87
  rubyforge_project:
92
- rubygems_version: 1.8.25
88
+ rubygems_version: 2.0.3
93
89
  signing_key:
94
- specification_version: 3
90
+ specification_version: 4
95
91
  summary: Adobe Connect integration for Instructure Canvas (http://instructure.com).
96
92
  test_files: []
97
- has_rdoc: