webex 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06a8e1a43fdb9160050dff5298597c80a6a029c3
4
- data.tar.gz: 9cf6498fcdbccbf17946293203c93bcdfcc0f660
3
+ metadata.gz: 4093231ff4b1b1a8defd1607da6e443543dd5352
4
+ data.tar.gz: 62436e6a2d9d2015aa0684ef4d308a06b5f28b3a
5
5
  SHA512:
6
- metadata.gz: 0d41f3536dfee6435a595c2a327e2f126e20336e6143a9c92c7c460bd736e7b2e16efe19caa567dea87fb421beb8fd47012065841862196a2264d58e8f7c871b
7
- data.tar.gz: 0c6a8675bc54847462af5d414fa787b4267c8122eb19584d5e927847407b5357f2364f0ac4dfc867f13735de91c14b991ddaaa6060107117bfdfea3c1abe3fcd
6
+ metadata.gz: d5a4e465e69bb187de34ab874ee9cbea9eec075d137572ecef54038c4a3c4a01eae6c8b2b32a50a0a7bb85d71ea90863ee325747f6dd8638af036e31d9d471d2
7
+ data.tar.gz: 134404a621092f5a872987d26f20450bacf9121444579a493fdc89c7324bdfeb457c11edea253f9b6d4d9545f0f2946e39345063a6d1341b1b3382fde62e4c7e
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ require 'active_support/core_ext/hash'
2
+ class String
3
+ def stringify_string
4
+ hash = Hash.from_xml(self)
5
+ "ST=#{hash['ListOpenMeetings']['Status']}&RS=#{hash['ListOpenMeetings']['Reason']}&MeetingKeys=#{hash['ListOpenMeetings']['MeetingKeys']}"
6
+ rescue
7
+ match(/(var url = |window.location.replace\()\"(.*)\"/)[2].gsub!('\\x3a',':').gsub!('\\x2f','/').gsub!('\\x3f','?').gsub!('\\x3d','=').gsub!('\\x26','&').split('?').last
8
+ end
9
+ end
@@ -1,3 +1,4 @@
1
+ require 'core_ext/string'
1
2
  require 'webex/error/errors'
2
3
  require 'webex/version'
3
4
  require 'webex/configuration'
@@ -9,5 +9,8 @@ module Webex
9
9
  # comment
10
10
  module Meeting
11
11
  PATH_URL = 'm.php'.freeze
12
+ def post_url
13
+ URI.join(CONFIGURATION.host_url + PATH_URL)
14
+ end
12
15
  end
13
16
  end
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Action
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :meeting_key, :cancel_mail, :back_url,
7
8
  :start_feature, :app_handle, :location, :parameter, :url, :document_location,
8
9
  :attendee_name, :attendee_mail, :phone, :password, :registration_id
@@ -14,35 +15,35 @@ module Webex
14
15
 
15
16
  def delete
16
17
  option_required! :meeting_key
17
- { params: generate_params(api_type: 'DM'),
18
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
18
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'DM')
19
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
19
20
  end
20
21
 
21
22
  def host
22
23
  option_required! :meeting_key
23
- { params: generate_params(api_type: 'HM'),
24
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
24
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'HM')
25
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
25
26
  end
26
27
 
27
28
  def join
28
29
  option_required! :meeting_key
29
- { params: generate_params(api_type: 'JM'),
30
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
30
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'JM')
31
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
31
32
  end
32
33
 
33
34
  def list_meetings
34
- { params: generate_params(api_type: 'LM'),
35
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
35
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'LM')
36
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
36
37
  end
37
38
 
38
39
  def list_open_meetings
39
- { params: generate_params(api_type: 'OM'),
40
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
40
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'OM')
41
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
41
42
  end
42
43
 
43
44
  def schedule
44
- { params: generate_params(api_type: 'SM'),
45
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
45
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'SM')
46
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
46
47
  end
47
48
 
48
49
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Attendee
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :meeting_key, :back_url, :invitation, :attendees, :cancel_mail, :email
7
8
 
8
9
  # attendees: [{FullName: FullName1, EmailAddress: nil, PhoneCountry: nil, PhoneArea: nil, PhoneLocal: nil, PhoneExt: nil, TimeZone: nil, Language: nil, Locale: nil, AddToAddressBook: nil},
@@ -16,20 +17,20 @@ module Webex
16
17
 
17
18
  def add
18
19
  option_required! :attendees
19
- { params: generate_params(api_type: 'AA'),
20
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
20
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'AA')
21
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
21
22
  end
22
23
 
23
24
  def delete
24
25
  option_required! :email
25
- { params: generate_params(api_type: 'DA'),
26
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
26
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'DA')
27
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
27
28
  end
28
29
 
29
30
  def detail
30
31
  option_required! :email
31
- { params: generate_params(api_type: 'MD'),
32
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
32
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'MD')
33
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
33
34
  end
34
35
 
35
36
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Presenter
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :meeting_key, :back_url, :email, :full_name, :invitation,
7
8
  :phones, :cancel_mail
8
9
  # phones = {PhoneCountry: nil, PhoneArea: nil, PhoneNumber: nil, PhoneExt: nil}
@@ -15,13 +16,15 @@ module Webex
15
16
 
16
17
  def add
17
18
  option_required! :full_name
18
- { params: generate_params(api_type: 'AP'),
19
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
19
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'AP')
20
+ p res.body
21
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
20
22
  end
21
23
 
22
24
  def delete
23
- { params: generate_params(api_type: 'DP'),
24
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
25
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'DP')
26
+ p res.body
27
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
25
28
  end
26
29
 
27
30
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Registration
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :meeting_key, :back_url, :first_name, :last_name, :email_address, :job_title,
7
8
  :computer_name, :address_1, :address_2, :city, :state, :zip_code, :country,
8
9
  :phone_number, :fax, :name_and_values, :text_box_contents, :check_box_contents,
@@ -16,14 +17,14 @@ module Webex
16
17
 
17
18
  def form
18
19
  option_required! :meeting_key
19
- { params: generate_params(api_type: 'GF'),
20
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
20
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'GF')
21
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
21
22
  end
22
23
 
23
24
  def register
24
25
  option_required! :meeting_key, :first_name, :last_name, :email_address, :job_title, :computer_name
25
- { params: generate_params(api_type: 'RM'),
26
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
26
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'RM')
27
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
27
28
  end
28
29
 
29
30
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Report
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :recording_topic, :specify_url, :agenda, :registration,
7
8
  :destination_address_after_session, :description, :email_address,
8
9
  :duration_hours, :duration_minutes, :month, :year, :presenter,
@@ -18,8 +19,9 @@ module Webex
18
19
 
19
20
  def create
20
21
  option_required! :recording_topic
21
- { params: generate_params(api_type: 'CR'),
22
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
22
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'CR')
23
+ p res.body
24
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
23
25
  end
24
26
 
25
27
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Schedule
5
5
  include Webex
6
+ include Webex::Meeting
6
7
  attr_accessor :meeting_name, :meeting_type, :list_flag, :meeting_password, :password_filter_feature,
7
8
  :require_attendee_registration, :automatically_accept_registration, :attendee_information,
8
9
  :registration_password, :maxinum_registrations_allowed, :registration_close_year, :registration_close_month,
@@ -31,21 +32,20 @@ module Webex
31
32
  end
32
33
 
33
34
  def edit
34
- { params: generate_params(api_type: 'EM'),
35
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
35
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'EM')
36
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
36
37
  end
37
38
 
38
39
  def schedule
39
- { params: generate_params(api_type: 'SM'),
40
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
40
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'SM')
41
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
41
42
  end
42
43
 
43
44
  def impromptu
44
- { params: generate_params(api_type: 'IM'),
45
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
45
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'IM')
46
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
46
47
  end
47
48
 
48
-
49
49
  private
50
50
 
51
51
  def generate_params(overwrite_params = {})
@@ -8,5 +8,8 @@ module Webex
8
8
  # comment
9
9
  module User
10
10
  PATH_URL = 'p.php'.freeze
11
+ def post_url
12
+ URI.join(CONFIGURATION.host_url + PATH_URL)
13
+ end
11
14
  end
12
15
  end
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Activation
5
5
  include Webex
6
+ include Webex::User
6
7
  attr_accessor :webex_id, :partner_id, :back_url
7
8
 
8
9
  def initialize(attributes = {})
@@ -12,13 +13,13 @@ module Webex
12
13
  end
13
14
 
14
15
  def activate
15
- { params: generate_params(api_type: 'AC'),
16
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
16
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'AC')
17
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
17
18
  end
18
19
 
19
20
  def deactivate
20
- { params: generate_params(api_type: 'IN'),
21
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
21
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'IN')
22
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
22
23
  end
23
24
 
24
25
  private
@@ -3,6 +3,8 @@ module Webex
3
3
  # comment
4
4
  class File
5
5
  include Webex
6
+ include Webex::User
7
+
6
8
  attr_accessor :file_name, :back_url, :current_directory
7
9
 
8
10
  def initialize(attributes = {})
@@ -13,13 +15,13 @@ module Webex
13
15
 
14
16
  def download
15
17
  option_required! :file_name
16
- { params: generate_params(api_type: 'DF'),
17
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
18
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'DF')
19
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
18
20
  end
19
21
 
20
22
  def list
21
- { params: generate_params(api_type: 'LF'),
22
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
23
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'LF')
24
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
23
25
  end
24
26
 
25
27
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Partner
5
5
  include Webex
6
+ include Webex::User
6
7
  attr_accessor :webex_id, :ticket, :password, :back_type, :back_url, :email,
7
8
  :session, :first_name, :last_name, :new_password
8
9
  def initialize(attributes = {})
@@ -12,13 +13,13 @@ module Webex
12
13
  end
13
14
 
14
15
  def login
15
- { params: generate_params(api_type: 'LI'),
16
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
16
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'LI')
17
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
17
18
  end
18
19
 
19
20
  def logout
20
- { params: generate_params(api_type: 'LO'),
21
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
21
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'LO')
22
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
22
23
  end
23
24
 
24
25
  private
@@ -3,6 +3,8 @@ module Webex
3
3
  # comment
4
4
  class Registration
5
5
  include Webex
6
+ include Webex::User
7
+
6
8
  attr_accessor :webex_id, :first_name, :last_name, :email, :password, :partner_id, :back_url,
7
9
  # optional attributes
8
10
  :address_1, :address_2, :city, :state, :zip_code, :country, :office_phones, :fax_phones,
@@ -28,14 +30,14 @@ module Webex
28
30
 
29
31
  def sign_up(condition={})
30
32
  option_required! :webex_id, :first_name, :last_name, :email, :password, :partner_id
31
- { params: generate_params(api_type: 'SU'),
32
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
33
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'SU')
34
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
33
35
  end
34
36
 
35
37
  def edit(condition={})
36
38
  option_required! :webex_id, :password, :partner_id
37
- { params: generate_params(api_type: 'EU'),
38
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
39
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'EU')
40
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
39
41
  end
40
42
 
41
43
  private
@@ -3,6 +3,7 @@ module Webex
3
3
  # comment
4
4
  class Report
5
5
  include Webex
6
+ include Webex::User
6
7
  attr_accessor :report_type, :back_url, :start_month, :start_year, :start_date,
7
8
  :end_month, :end_year, :end_date, :topic, :sort_result_by
8
9
 
@@ -13,8 +14,8 @@ module Webex
13
14
  end
14
15
 
15
16
  def display
16
- { params: generate_params(api_type: 'QR'),
17
- url: URI.join(CONFIGURATION.host_url + PATH_URL) }
17
+ res = Net::HTTP.post_form post_url, generate_params(api_type: 'QR')
18
+ Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
18
19
  end
19
20
 
20
21
  private
@@ -1,3 +1,3 @@
1
1
  module Webex
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wei-Yi Chiu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,7 @@ files:
77
77
  - .rspec
78
78
  - .travis.yml
79
79
  - Gemfile
80
+ - LICENSE.txt
80
81
  - README.md
81
82
  - Rakefile
82
83
  - bin/console
@@ -87,6 +88,7 @@ files:
87
88
  - example/views/user/partner/logout.erb
88
89
  - example/views/user/registration/edit.erb
89
90
  - example/views/user/registration/sign_up.erb
91
+ - lib/core_ext/string.rb
90
92
  - lib/webex.rb
91
93
  - lib/webex/configuration.rb
92
94
  - lib/webex/error/errors.rb