Class: Innowhite
- Inherits:
-
Object
- Object
- Innowhite
- Defined in:
- lib/innowhite.rb
Instance Attribute Summary collapse
-
#mod_name ⇒ Object
Returns the value of attribute mod_name.
-
#org_name ⇒ Object
Returns the value of attribute org_name.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#server_address ⇒ Object
Returns the value of attribute server_address.
-
#sub ⇒ Object
Returns the value of attribute sub.
Instance Method Summary collapse
- #cancel_meeting(room_id) ⇒ Object
- #create_room(params = {}) ⇒ Object
- #get_scheduled_list(params = {}) ⇒ Object
- #get_sessions(params = {}) ⇒ Object
- #getRecordingURL(room_id) ⇒ Object
-
#initialize ⇒ Innowhite
constructor
A new instance of Innowhite.
- #join_meeting(room_id, user) ⇒ Object
- #past_sessions(params = {}) ⇒ Object
- #schedule_meeting(params = {}) ⇒ Object
- #update_schedule(params = {}) ⇒ Object
Constructor Details
#initialize ⇒ Innowhite
Returns a new instance of Innowhite.
9 10 11 |
# File 'lib/innowhite.rb', line 9 def initialize load_settings end |
Instance Attribute Details
#mod_name ⇒ Object
Returns the value of attribute mod_name.
7 8 9 |
# File 'lib/innowhite.rb', line 7 def mod_name @mod_name end |
#org_name ⇒ Object
Returns the value of attribute org_name.
7 8 9 |
# File 'lib/innowhite.rb', line 7 def org_name @org_name end |
#private_key ⇒ Object
Returns the value of attribute private_key.
7 8 9 |
# File 'lib/innowhite.rb', line 7 def private_key @private_key end |
#server_address ⇒ Object
Returns the value of attribute server_address.
7 8 9 |
# File 'lib/innowhite.rb', line 7 def server_address @server_address end |
#sub ⇒ Object
Returns the value of attribute sub.
7 8 9 |
# File 'lib/innowhite.rb', line 7 def sub @sub end |
Instance Method Details
#cancel_meeting(room_id) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/innowhite.rb', line 76 def cancel_meeting(room_id) checksum = main_cheksum(@parent_org, @org_name) par = url_generator(@parent_org, @org_name) url = URI.escape("#{@api_address}cancel_meeting?roomId=#{room_id}&#{par}&checksum=#{checksum}") Nokogiri::XML(open(url)).xpath("//success").text == "true" end |
#create_room(params = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/innowhite.rb', line 13 def create_room(params = {}) room_id = get_room_id address = join_room_url(@org_name, room_id, params[:user], true) res = create_room_info(room_id, params[:user], params[:tags], params[:desc], @org_name, address) res.include?("Missing") ? {"errors" => "Failed to fetch, maybe you have entered wrong username / organization name .."} : {"room_id" => room_id, "address" => address} end |
#get_scheduled_list(params = {}) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/innowhite.rb', line 69 def get_scheduled_list(params={}) checksum = main_cheksum(params[:parentOrg] || @parent_org, params[:orgName] || @org_name) par = url_generator(params[:parentOrg] || @parent_org, params[:orgName] || @org_name) url = URI.escape("#{@api_address}get_scheduled_sessions?#{par}&checksum=#{checksum}&tags=#{params[:tags]}}") JSON::parse(RestClient.get(url, :accept => :json)) end |
#get_sessions(params = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/innowhite.rb', line 26 def get_sessions(params = {}) temp = url_generator(params[:parentOrg] || @parent_org, params[:orgName] || @org_name) checksum = (URI.escape(temp)) tmp = "#{temp}&user=#{params[:user]}&tags=#{params[:tags]}" url = URI.escape("#{@api_address}list_sessions?#{tmp}&checksum=#{checksum}") JSON::parse(RestClient.get(url, :accept => :json)) rescue {"errors" => "Error fetching sessions check the organization and private key .."} end |
#getRecordingURL(room_id) ⇒ Object
97 98 99 |
# File 'lib/innowhite.rb', line 97 def getRecordingURL(room_id) Nokogiri.parse(RestClient.get("#{@server_address}PlayBackServlet?room_id=#{room_id}")).css("webMpath").text.gsub(/.webm$/, "") end |
#join_meeting(room_id, user) ⇒ Object
20 21 22 23 24 |
# File 'lib/innowhite.rb', line 20 def join_meeting(room_id, user) url = "#{@api_address}exist_session?roomId=#{room_id}" doc = Nokogiri::XML(open(url)) doc.text.blank? ? nil : join_room_url(@org_name, room_id, user, false) end |
#past_sessions(params = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/innowhite.rb', line 57 def past_sessions(params = {}) temp = url_generator(params[:parentOrg] || @parent_org, params[:orgName] || @org_name) checksum = (URI.escape(temp)) tmp = "#{temp}&user=#{params[:user]}&tags=#{params[:tags]}" url = URI.escape("#{@api_address}past_sessions?#{tmp}&checksum=#{checksum}") JSON::parse(RestClient.get(url, :accept => :json)) rescue { "errors" => "Error fetching sessions check the organization and private key .." } end |
#schedule_meeting(params = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/innowhite.rb', line 37 def schedule_meeting(params = {}) room_id = get_room_id address = join_room_url( params[:orgName] || @org_name, room_id, params[:user], true) create_schedule( room_id, params[:user], params[:tags], params[:description], params[:parentOrg] || @parent_org, address, params[:startTime], params[:endTime], params[:timeZone]) == "true" end |
#update_schedule(params = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/innowhite.rb', line 83 def update_schedule(params = {}) checksum = main_cheksum(@parent_org, @org_name) params[:startTime] = params[:startTime].to_i if !params[:startTime].blank? && (params[:startTime].is_a?(DateTime) || params[:startTime].is_a?(Time)) params[:endTime] = params[:endTime].to_i if !params[:endTime].blank? && (params[:endTime].is_a?(DateTime) || params[:endTime].is_a?(Time)) Nokogiri::XML(RestClient.put("#{@api_address}update_schedule", {:roomId => params[:room_id], :tags => params[:tags], :description => params[:description], :parentOrg => @parent_org, :orgName => @org_name, :checksum => checksum, :startTime => params[:startTime], :endTime => params[:endTime], :timeZone => params[:timeZone] } )).xpath("//success").text == "true" end |