webex 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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 06a8e1a43fdb9160050dff5298597c80a6a029c3
4
+ data.tar.gz: 9cf6498fcdbccbf17946293203c93bcdfcc0f660
5
+ SHA512:
6
+ metadata.gz: 0d41f3536dfee6435a595c2a327e2f126e20336e6143a9c92c7c460bd736e7b2e16efe19caa567dea87fb421beb8fd47012065841862196a2264d58e8f7c871b
7
+ data.tar.gz: 0c6a8675bc54847462af5d414fa787b4267c8122eb19584d5e927847407b5357f2364f0ac4dfc867f13735de91c14b991ddaaa6060107117bfdfea3c1abe3fcd
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in webex.gemspec
4
+ gemspec
@@ -0,0 +1,39 @@
1
+ # Webex
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/webex`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'webex'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install webex
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/webex/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "webex"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+ $: << File.expand_path('../../lib', __FILE__)
3
+ require 'bundler/setup'
4
+ require 'sinatra'
5
+ require 'webex'
6
+
7
+ get '/' do
8
+ @partner = Webex::User::Partner.new({ webex_id: 'test', password: 'yeh',back_type: 'GoBack', back_url: 'localhost:4567', email: 'bird1204@gmail.com' }).login
9
+ # @partner = Webex::User::Partner.new(webex_id: "test1118", password: "yeh1118", back_type: 'GoBack', back_url: 'localhost:4567', email: 'fewhi.cewf@fiof.com')
10
+ # @url = URI.join(Webex::Configuration.host_url + @partner.path)
11
+ erb :'user/partner/login'
12
+ end
13
+
14
+ get '/logout' do
15
+ @partner = Webex::User::Partner.new({ webex_id: 'test', password: 'yeh',back_type: 'GoBack', back_url: 'localhost:4567', email: 'bird1204@gmail.com' }).logout
16
+ erb :'user/partner/logout'
17
+ end
18
+
19
+ get '/sign_up' do
20
+ @partner = Webex::User::Registration.new({ webex_id: 'bird1204', password: 'yeh1118', email: 'bird1204@gmail.com', partner_id: 'test1118', first_name: 'first', last_name: 'last', back_url: 'localhost:4567' }).sign_up
21
+ erb :'user/registration/sign_up'
22
+ end
23
+
24
+ get '/edit' do
25
+ @partner = Webex::User::Registration.new({ webex_id: 'test', password: 'yeh1118', email: 'bird1204@gmail.com', partner_id: 'test12312', first_name: 'first', last_name: 'last' }).edit
26
+ erb :'user/registration/edit'
27
+ end
28
+
29
+ post '/' do
30
+ erb :back_page
31
+ end
@@ -0,0 +1,118 @@
1
+ <html>
2
+
3
+ <head>
4
+ <title>Return Status</title>
5
+ <script language=JavaScript>
6
+ var strAction = "<%=params['AT']%>";
7
+ var strWID = "<%=params['WID']%>";
8
+ var strStatus = "<%=params['ST']%>";
9
+ var strReason = "<%=params['RS']%>";
10
+ var strMeetingKey = "<%=params['MK']%>";
11
+ var strTeleNumber = "<%=params['TN']%>";
12
+ var strOfficeID = "<%=params['OID']%>";
13
+ var strOfficeURL = "<%=params['OURL']%>";
14
+
15
+ if (strAction == "PL" || strAction == "LI") { // Login
16
+ if (strStatus == "SUCCESS" || (strStatus == "FAIL" && strReason ==
17
+ "AlreadyLogon")) {
18
+ // window.location.href = "54.64.216.233";
19
+ document.write(strWID + ", login SUCCESS");
20
+ } else {
21
+ document.write("Sorry, " + strWID + ", login failed. Reason is " + strReason);
22
+ }
23
+ } else if (strAction == "LO") { // Login
24
+ if (strStatus == "SUCCESS") {
25
+ document.write("You've successfully logged out!");
26
+ } else {
27
+ document.write("Failed to log out!");
28
+ }
29
+ } else if (strAction == "IM" || strAction == "HM") { // Instant Meeting or Start Scheduled Meeting
30
+ if (strStatus == "SUCCESS") {
31
+ document.write("Meeting is closed");
32
+ } else {
33
+ document.write("Sorry, meeting can not be started. Reason is " + strReason);
34
+ }
35
+ } else if (strAction == "JM") { // Join Meeting
36
+ if (strStatus == "SUCCESS") {
37
+ document.write("Meeting is closed by the host");
38
+ } else {
39
+ if (strReason == "InvalidMeetingKeyOrPassword")
40
+ document.write("Sorry, join meeting failed due to invalid meeting key or password.");
41
+ else if (strReason == "MeetingNotInProgress")
42
+ document.write("Sorry, join meeting failed because meeting is not open or already closed.");
43
+ if (strReason == "MeetingLocked") {
44
+ document.write("Sorry, join meeting failed because the meeting is locked.");
45
+ } else {
46
+ document.write("Welcome, " + strWID + "!");
47
+ }
48
+ }
49
+ } else if (strAction == "SM") { // Schedule Meeting
50
+ if (strStatus == "SUCCESS") {
51
+ document.write("Meeting is scheduled. Meeting Key is " + strMeetingKey);
52
+ document.write("<form name=\"HostMeetingForm\" ACTION=\"https://yourWebExHostedName.webex.com/yourWebExHostedName/m.php\" METHOD=\"POST\">" + "<INPUT TYPE=\"HIDDEN\" NAME=\"AT\" VALUE=\"HM\">" + "<INPUT TYPE=\"HIDDEN\" NAME=\"MK\" VALUE=" + strMeetingKey + ">" + "<INPUT TYPE=\"HIDDEN\" NAME=\"BU\" VALUE = \"http://at2k100619/testapi/back.htm\">" + "<INPUT TYPE=\"submit\" name=\"btnHostMeeting\" value = \"Start\"></form>");
53
+ } else {
54
+ if (strReason == "AccessDenied")
55
+ document.write("Sorry, schedule meeting failed because you haven't logged in or timeout.");
56
+ else if (strReason == "TeleConferenceLineReserveFail")
57
+ document.write("Sorry, schedule meeting failed due to insufficient telephone lines available.");
58
+ if (strReason == "MeetingScheduleFail")
59
+ document.write("Sorry, schedule meeting failed due to insufficient system resource.");
60
+ }
61
+ } else if (strAction == "MO" || strAction == "CO") { // Create or Update WebEx Office
62
+ if (strStatus == "SUCCESS") {
63
+ document.write("Office is created successfully. OfficeID=" + strOfficeID + ",OfficeURL=" + strOfficeURL);
64
+ } else {
65
+ document.write("Sorry, office can not be created, you might haven't logged in");
66
+ }
67
+ } else if (strAction == "SS") { // Start Support Session
68
+ if (strStatus == "SUCCESS") {
69
+ document.write("Support session ended normally.");
70
+ } else {
71
+ document.write("Failed to start support session, reason is " + strReason);
72
+ }
73
+ }
74
+ </script>
75
+ <STYLE>
76
+ .hdr {
77
+ font-family: Verdana;
78
+ font-size: 10pt;
79
+ font-weight: bold;
80
+ color: #000000;
81
+ background-color: #99CCFF
82
+ }
83
+
84
+ .reg {
85
+ font-family: Verdana;
86
+ font-size: 8pt;
87
+ font-weight: bold;
88
+ color: #000000;
89
+ background-color: #EEEEEE
90
+ }
91
+
92
+ .regr {
93
+ font-family: Verdana;
94
+ font-size: 8pt;
95
+ font-weight: bold;
96
+ color: #FF0000;
97
+ background-color: #EEEEEE
98
+ }
99
+
100
+ .regb {
101
+ font-family: Verdana;
102
+ font-size: 8pt;
103
+ font-weight: bold;
104
+ color: #0066ff;
105
+ background-color: #EEEEEE
106
+ }
107
+
108
+ .red {
109
+ font-family: Verdana;
110
+ font-size: 8pt;
111
+ font-weight: bold;
112
+ color: #FF0000;
113
+ background-color: #ffffff
114
+ }
115
+ </STYLE>
116
+ </head>
117
+ <body><%=params%></body>
118
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Document</title>
6
+ </head>
7
+ <body>
8
+ <form action="<%=@partner[:url]%>" method="post">
9
+ <% @partner[:params].each do |k, v| %>
10
+ <%= k %>
11
+ <input type="text" name="<%= k %>" value="<%= v %>"><br>
12
+ <% end %>
13
+ <input type="submit">
14
+ </form>
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Document</title>
6
+ </head>
7
+ <body>
8
+ <form action="<%=@partner[:url]%>" method="post">
9
+ <% @partner[:params].each do |k, v| %>
10
+ <%= k %>
11
+ <input type="text" name="<%= k %>" value="<%= v %>"><br>
12
+ <% end %>
13
+ <input type="submit">
14
+ </form>
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Document</title>
6
+ </head>
7
+ <body>
8
+ <form action="<%=@partner[:url]%>" method="post">
9
+ <% @partner[:params].each do |k, v| %>
10
+ <%= k %>
11
+ <input type="text" name="<%= k %>" value="<%= v %>"><br>
12
+ <% end %>
13
+ <input type="submit">
14
+ </form>
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Document</title>
6
+ </head>
7
+ <body>
8
+ <form action="<%=@partner[:url]%>" method="post">
9
+ <% @partner[:params].each do |k, v| %>
10
+ <%= k %>
11
+ <input type="text" name="<%= k %>" value="<%= v %>"><br>
12
+ <% end %>
13
+ <input type="submit">
14
+ </form>
15
+ </body>
16
+ </html>
@@ -0,0 +1,23 @@
1
+ require 'webex/error/errors'
2
+ require 'webex/version'
3
+ require 'webex/configuration'
4
+ require 'webex/user'
5
+ require 'webex/meeting'
6
+ # comment
7
+ module Webex
8
+ def env_attributes!
9
+ %w( site_name webex_id password back_type back_url).each do |attribute|
10
+ begin
11
+ send("#{attribute}=", CONFIGURATION.send(attribute)) unless send(attribute)
12
+ rescue NoMethodError
13
+ next
14
+ end
15
+ end
16
+ end
17
+
18
+ def option_required!(*option_names)
19
+ option_names.each do |option_name|
20
+ raise MissingOption, %Q{option "#{option_name}" is required.} unless send(option_name)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ module Webex
2
+ # comment
3
+ class Configuration
4
+ %w( site_name webex_id password back_type back_url).each do |name|
5
+ define_singleton_method(name) { ENV["WEBEX_#{name.upcase}"] }
6
+ end
7
+
8
+ def self.host_url
9
+ "https://#{site_name}.webex.com/#{site_name}/"
10
+ # "https://engsound.webex.com/engsound/"
11
+ end
12
+ end
13
+ CONFIGURATION = Webex::Configuration
14
+ end
@@ -0,0 +1,13 @@
1
+ module Webex
2
+ # Generic WebexError exception class.
3
+ class WebexError < StandardError; end
4
+
5
+ class ConfigurationError < WebexError; end
6
+ class BackTypeError < ConfigurationError; end
7
+
8
+ class MissingOption < WebexError; end
9
+ class PartnerError < WebexError; end
10
+
11
+ class RegistrationError < WebexError; end
12
+ class LengthError < RegistrationError; end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'webex/meeting/presenter'
2
+ require 'webex/meeting/attendee'
3
+ require 'webex/meeting/action'
4
+ require 'webex/meeting/schedule'
5
+ require 'webex/meeting/registration'
6
+ require 'webex/meeting/report'
7
+
8
+ module Webex
9
+ # comment
10
+ module Meeting
11
+ PATH_URL = 'm.php'.freeze
12
+ end
13
+ end
@@ -0,0 +1,97 @@
1
+ module Webex
2
+ module Meeting
3
+ # comment
4
+ class Action
5
+ include Webex
6
+ attr_accessor :meeting_key, :cancel_mail, :back_url,
7
+ :start_feature, :app_handle, :location, :parameter, :url, :document_location,
8
+ :attendee_name, :attendee_mail, :phone, :password, :registration_id
9
+ def initialize(attributes = {})
10
+ attributes.each { |k, v| send("#{k}=", v) }
11
+ env_attributes!
12
+ option_required! :back_url
13
+ end
14
+
15
+ def delete
16
+ option_required! :meeting_key
17
+ { params: generate_params(api_type: 'DM'),
18
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
19
+ end
20
+
21
+ def host
22
+ option_required! :meeting_key
23
+ { params: generate_params(api_type: 'HM'),
24
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
25
+ end
26
+
27
+ def join
28
+ option_required! :meeting_key
29
+ { params: generate_params(api_type: 'JM'),
30
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
31
+ end
32
+
33
+ def list_meetings
34
+ { params: generate_params(api_type: 'LM'),
35
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
36
+ end
37
+
38
+ def list_open_meetings
39
+ { params: generate_params(api_type: 'OM'),
40
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
41
+ end
42
+
43
+ def schedule
44
+ { params: generate_params(api_type: 'SM'),
45
+ url: URI.join(CONFIGURATION.host_url + PATH_URL) }
46
+ end
47
+
48
+ private
49
+
50
+ def cancel_mail?
51
+ cancel_mail
52
+ end
53
+
54
+ def tracking_code_hash
55
+ attribute_length!(10, tracking_codes)
56
+ hash = {}
57
+ tracking_codes.each_with_index do |code, index|
58
+ hash.merge!("TC#{index + 1}".to_sym => code)
59
+ end
60
+ hash
61
+ end
62
+
63
+ def generate_params(overwrite_params = {})
64
+ result = {}
65
+ result[:AT] = overwrite_params[:api_type]
66
+ result[:MK] = meeting_key
67
+ result[:BU] = back_url
68
+ # delete
69
+ if result[:AT] == 'DM'
70
+ result[:SM] = cancel_mail?
71
+ end
72
+ # host
73
+ if result[:AT] == 'HM'
74
+ result[:AS] = start_feature
75
+ result[:AH] = app_handle
76
+ result[:AL] = location
77
+ result[:AP] = parameter
78
+ result[:DL] = document_location
79
+ result[:WL] = url
80
+ end
81
+ # join
82
+ if result[:AT] == 'JM'
83
+ result[:AN] = attendee_name
84
+ result[:AE] = attendee_mail
85
+ result[:CO] = phone
86
+ result[:PW] = password
87
+ result[:RID] = registration_id
88
+ end
89
+ result.delete_if { |k, v| v.nil? }
90
+ end
91
+
92
+ def attribute_length!(length, attribute)
93
+ raise LengthError, %Q{option "#{attribute}" is too long.} if attribute.size > length
94
+ end
95
+ end
96
+ end
97
+ end