Class: Webex::Meeting::Presenter

Inherits:
Object
  • Object
show all
Includes:
Webex, Webex::Meeting
Defined in:
lib/webex/meeting/presenter.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 = {}) ⇒ Presenter

phones = nil, PhoneArea: nil, PhoneNumber: nil, PhoneExt: nil



11
12
13
14
15
# File 'lib/webex/meeting/presenter.rb', line 11

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

Instance Attribute Details

#back_urlObject

Returns the value of attribute back_url.



7
8
9
# File 'lib/webex/meeting/presenter.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/presenter.rb', line 7

def cancel_mail
  @cancel_mail
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#full_nameObject

Returns the value of attribute full_name.



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

def full_name
  @full_name
end

#invitationObject

Returns the value of attribute invitation.



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

def invitation
  @invitation
end

#meeting_keyObject

Returns the value of attribute meeting_key.



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

def meeting_key
  @meeting_key
end

#phonesObject

Returns the value of attribute phones.



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

def phones
  @phones
end

Instance Method Details

#addObject



17
18
19
20
21
22
# File 'lib/webex/meeting/presenter.rb', line 17

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

#deleteObject



24
25
26
27
28
# File 'lib/webex/meeting/presenter.rb', line 24

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

#generate_params(overwrite_params = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/webex/meeting/presenter.rb', line 30

def generate_params(overwrite_params = {})
  result = {}
  result[:AT] = overwrite_params[:api_type]
  result[:MK] = meeting_key
  result[:BU] = back_url
  result[:FN] = full_name
  result[:EM] = email
  if result[:AT] == 'AP'
    result[:EI] = invitation
    result.merge!(phone_params) if phones
  end
  result[:EC] = cancel_mail? if result[:AT] == 'DP'
  result.delete_if { |k, v| v.nil? }
end