canvas_webex 0.4 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,11 +22,21 @@
22
22
  <tr>
23
23
  <td><%= f.blabel :site_name, "Site Name" %></td>
24
24
  <td>
25
- <%= f.text_field :site_name, :autocomplete => false %><br>
26
- <small class="help-text">
25
+ <%= f.text_field :site_name, :autocomplete => false %>
26
+ <div class="hint-text">
27
27
  <%= t(:site_name_description, "Site name for your WebEx account,
28
28
  if the url is \"https://school.webex.com\" then your site name is 'school'") %>
29
- </small>
29
+ </div>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td><%= f.blabel :meting_password, "Meeting Password"%></td>
34
+ <td>
35
+ <%= f.password_field :meeting_password, :autocomplete => false%>
36
+ <div class="hint-text">
37
+ <%= t(:meeting_password_description, 'Meeting password must adhere to WebEx password requirements') %>
38
+ </div>
39
+ <br>
30
40
  </td>
31
41
  </tr>
32
42
  </tbody>
@@ -38,7 +38,7 @@ module Canvas
38
38
  :version => CanvasWebex::VERSION,
39
39
  :settings_partial => 'plugins/webex_settings',
40
40
  :validator => 'CiscoWebexValidator',
41
- :encrypted_settings => [:password]
41
+ :encrypted_settings => [:password, :meeting_password]
42
42
  })
43
43
  end
44
44
 
@@ -21,7 +21,7 @@ module Canvas
21
21
  module Validators
22
22
  class CiscoWebexValidator
23
23
  # Public: An array of allowed plugin settings.
24
- REQUIRED_KEYS = %w{webex_id password site_id site_name}
24
+ REQUIRED_KEYS = %w{webex_id password site_id site_name meeting_password}
25
25
 
26
26
  # Public: Validate setting input for this plugin.
27
27
  #
data/lib/canvas_webex.rb CHANGED
@@ -21,27 +21,29 @@ require_dependency "canvas_webex/version"
21
21
  module CanvasWebex
22
22
  class ConnectionError < StandardError; end
23
23
 
24
- # Public: Configure as a Canvas plugin
25
- #
26
- # Returns nothing.
27
- def self.register
28
- Rails.configuration.to_prepare do
29
- view_path = File.join(File.dirname(__FILE__), '..', 'app', 'views')
30
- unless ApplicationController.view_paths.include?(view_path)
31
- ApplicationController.view_paths.unshift(view_path)
32
- end
33
-
34
- path = File.expand_path('../app/models', File.dirname(__FILE__))
35
- ActiveSupport::Dependencies.autoload_paths << path unless ActiveSupport::Dependencies.autoload_paths.include? path
36
-
37
- require_dependency File.expand_path('../app/models/cisco_webex_conference.rb', File.dirname(__FILE__))
38
- require_dependency "canvas/plugins/validators/cisco_webex_validator"
39
- require_dependency "canvas/plugins/cisco_webex"
40
- require_dependency "canvas_webex/service"
41
- require_dependency "canvas_webex/meeting"
42
-
43
- Canvas::Plugins::CiscoWebex.new
24
+ configure_method = Proc.new do
25
+ view_path = File.join(File.dirname(__FILE__), '..', 'app', 'views')
26
+ unless ApplicationController.view_paths.include?(view_path)
27
+ ApplicationController.view_paths.unshift(view_path)
44
28
  end
29
+
30
+ path = File.expand_path('../app/models', File.dirname(__FILE__))
31
+ ActiveSupport::Dependencies.autoload_paths << path unless ActiveSupport::Dependencies.autoload_paths.include? path
32
+
33
+ require_dependency File.expand_path('../app/models/cisco_webex_conference.rb', File.dirname(__FILE__))
34
+ require_dependency "canvas/plugins/validators/cisco_webex_validator"
35
+ require_dependency "canvas/plugins/cisco_webex"
36
+ require_dependency "canvas_webex/service"
37
+ require_dependency "canvas_webex/meeting"
38
+
39
+ Canvas::Plugins::CiscoWebex.new
40
+ end
41
+
42
+ if CANVAS_RAILS2
43
+ Rails.configuration.to_prepare(&configure_method)
44
+ else
45
+ class Railtie < Rails::Railtie; end
46
+ Railtie.config.to_prepare(&configure_method)
45
47
  end
46
48
 
47
49
  # Public: Find the plugin configuration.
@@ -55,9 +57,6 @@ module CanvasWebex
55
57
  #
56
58
  # Returns a CiscoWwebex::Service.
57
59
  def self.client
58
- @client ||= Service.new(*self.config.values_at(:webex_id, :password_dec, :site_id, :site_name, :partner_id))
60
+ Service.new(*self.config.values_at(:webex_id, :password_dec, :site_id, :site_name, :partner_id, :meeting_password_dec))
59
61
  end
60
-
61
62
  end
62
-
63
- CanvasWebex.register
@@ -1,9 +1,10 @@
1
1
  module CanvasWebex
2
2
  class Service
3
- attr_reader :webex_id, :password, :site_id, :site_name, :partner_id, :status
3
+ attr_reader :webex_id, :password, :site_id, :site_name, :partner_id, :status, :meeting_password
4
4
 
5
- def initialize(webex_id, password, site_id, site_name, partner_id)
6
- @webex_id, @password, @site_id, @site_name, @partner_id = [webex_id, password, site_id, site_name, partner_id]
5
+
6
+ def initialize(webex_id, password, site_id, site_name, partner_id, meeting_password)
7
+ @webex_id, @password, @site_id, @site_name, @partner_id, @meeting_password = [webex_id, password, site_id, site_name, partner_id, meeting_password]
7
8
  end
8
9
 
9
10
  def list_summary_meetings
@@ -25,11 +26,17 @@ module CanvasWebex
25
26
  end
26
27
 
27
28
  def create_meeting(confName, options = {})
29
+
28
30
  body = xml_request do |xml|
29
31
  xml.bodyContent('xsi:type' =>'java:com.webex.service.binding.meeting.CreateMeeting'){
30
32
  xml.metaData{
31
33
  xml.confName confName
32
34
  }
35
+ if meeting_password != nil && meeting_password.strip != ''
36
+ xml.accessControl{
37
+ xml.meetingPassword meeting_password
38
+ }
39
+ end
33
40
  xml.schedule{
34
41
  xml.startDate
35
42
  xml.duration(options[:duration].to_i)
@@ -77,7 +84,12 @@ module CanvasWebex
77
84
  xml.meetingKey meeting_key
78
85
  }
79
86
  end
80
- request(body)
87
+ begin
88
+ request(body)
89
+ rescue CanvasWebex::ConnectionError
90
+ nil
91
+ end
92
+
81
93
  end
82
94
 
83
95
  def list_recordings(meeting_key)
@@ -91,7 +103,11 @@ module CanvasWebex
91
103
  xml.returnSessionDetails 'true'
92
104
  }
93
105
  end
94
- request(body)
106
+ begin
107
+ request(body)
108
+ rescue CanvasWebex::ConnectionError
109
+ nil
110
+ end
95
111
  end
96
112
 
97
113
  def list_time_zone(id, date)
@@ -134,7 +150,11 @@ module CanvasWebex
134
150
  http.use_ssl = true
135
151
  response = http.post('/WBXService/XMLService', body)
136
152
  xml = Nokogiri::XML(response.body).remove_namespaces!
137
- xml.at_xpath('/message/header/response/result').try(:text) == 'SUCCESS' && xml.at_xpath('/message/body/bodyContent')
153
+ if xml.at_xpath('/message/header/response/result').try(:text) == 'SUCCESS'
154
+ xml.at_xpath('/message/body/bodyContent')
155
+ else
156
+ raise CanvasWebex::ConnectionError.new(xml.at_xpath('/message/header/response/reason').try(:text))
157
+ end
138
158
  end
139
159
 
140
160
  end
@@ -17,6 +17,6 @@
17
17
  #
18
18
 
19
19
  module CanvasWebex
20
- VERSION = "0.4"
20
+ VERSION = "0.6"
21
21
  end
22
22
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CanvasWebex::Meeting do
4
- let(:client) {CanvasWebex::Service.new('proserv_instructure', 'foo', '123', 'instructure', nil)}
4
+ let(:client) {CanvasWebex::Service.new('proserv_instructure', 'foo', '123', 'instructure', nil, 'test')}
5
5
  subject{CanvasWebex::Meeting.retrieve(123, client)}
6
6
 
7
7
  before(:each) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CanvasWebex::Service do
4
- subject {CanvasWebex::Service.new('proserv_instructure', 'foo', '123', 'instructure', nil)}
4
+ subject {CanvasWebex::Service.new('proserv_instructure', 'foo', '123', 'instructure', nil, 'test')}
5
5
 
6
6
  describe 'api_calls' do
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_webex
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.6'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-07 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake