Class: Webex::Meeting::Action

Inherits:
Object
  • Object
show all
Includes:
Webex, Webex::Meeting
Defined in:
lib/webex/meeting/action.rb

Overview

comment

Constant Summary

Constants included from Webex::Meeting

PATH_URL

Constants included from Webex

CONFIGURATION, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Webex::Meeting

#post_url

Methods included from Webex

#env_attributes!, #option_required!

Constructor Details

#initialize(attributes = {}) ⇒ Action

Returns a new instance of Action.



10
11
12
13
14
# File 'lib/webex/meeting/action.rb', line 10

def initialize(attributes = {})
  attributes.each { |k, v| send("#{k}=", v) }
  env_attributes!
  option_required! :back_url
end

Instance Attribute Details

#app_handleObject

Returns the value of attribute app_handle.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def app_handle
  @app_handle
end

#attendee_mailObject

Returns the value of attribute attendee_mail.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def attendee_mail
  @attendee_mail
end

#attendee_nameObject

Returns the value of attribute attendee_name.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def attendee_name
  @attendee_name
end

#back_urlObject

Returns the value of attribute back_url.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def back_url
  @back_url
end

#cancel_mailObject

Returns the value of attribute cancel_mail.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def cancel_mail
  @cancel_mail
end

#document_locationObject

Returns the value of attribute document_location.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def document_location
  @document_location
end

#locationObject

Returns the value of attribute location.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def location
  @location
end

#meeting_keyObject

Returns the value of attribute meeting_key.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def meeting_key
  @meeting_key
end

#parameterObject

Returns the value of attribute parameter.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def parameter
  @parameter
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def password
  @password
end

#phoneObject

Returns the value of attribute phone.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def phone
  @phone
end

#registration_idObject

Returns the value of attribute registration_id.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def registration_id
  @registration_id
end

#start_featureObject

Returns the value of attribute start_feature.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def start_feature
  @start_feature
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/webex/meeting/action.rb', line 7

def url
  @url
end

Instance Method Details

#deleteObject



16
17
18
19
20
# File 'lib/webex/meeting/action.rb', line 16

def delete
  option_required! :meeting_key
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'DM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#generate_params(overwrite_params = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/webex/meeting/action.rb', line 49

def generate_params(overwrite_params = {})
  result = {}
  result[:AT] = overwrite_params[:api_type]
  result[:MK] = meeting_key
  result[:BU] = back_url
  # delete
  if result[:AT] == 'DM'
    result[:SM] = cancel_mail?
  end
  # host
  if result[:AT] == 'HM'
    result[:AS] = start_feature
    result[:AH] = app_handle
    result[:AL] = location
    result[:AP] = parameter
    result[:DL] = document_location
    result[:WL] = url
  end
  # join
  if result[:AT] == 'JM'
    result[:AN] = attendee_name
    result[:AE] = attendee_mail
    result[:CO] = phone
    result[:PW] = password
    result[:RID] = registration_id
  end
  result.delete_if { |k, v| v.nil? }
end

#hostObject



22
23
24
25
26
# File 'lib/webex/meeting/action.rb', line 22

def host
  option_required! :meeting_key
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'HM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#joinObject



28
29
30
31
32
# File 'lib/webex/meeting/action.rb', line 28

def join
  option_required! :meeting_key
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'JM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#list_meetingsObject



34
35
36
37
# File 'lib/webex/meeting/action.rb', line 34

def list_meetings
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'LM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#list_open_meetingsObject



39
40
41
42
# File 'lib/webex/meeting/action.rb', line 39

def list_open_meetings
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'OM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#scheduleObject



44
45
46
47
# File 'lib/webex/meeting/action.rb', line 44

def schedule
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'SM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end