Class: Webex::Meeting::Registration

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

Returns a new instance of Registration.



12
13
14
15
16
# File 'lib/webex/meeting/registration.rb', line 12

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

Instance Attribute Details

#address_1Object

Returns the value of attribute address_1.



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

def address_1
  @address_1
end

#address_2Object

Returns the value of attribute address_2.



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

def address_2
  @address_2
end

#back_urlObject

Returns the value of attribute back_url.



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

def back_url
  @back_url
end

#check_box_contentsObject

Returns the value of attribute check_box_contents.



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

def check_box_contents
  @check_box_contents
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#computer_nameObject

Returns the value of attribute computer_name.



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

def computer_name
  @computer_name
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

Returns the value of attribute dropdown_list_selections.



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

def dropdown_list_selections
  @dropdown_list_selections
end

#email_addressObject

Returns the value of attribute email_address.



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

def email_address
  @email_address
end

#faxObject

Returns the value of attribute fax.



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

def fax
  @fax
end

#first_nameObject

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#job_titleObject

Returns the value of attribute job_title.



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

def job_title
  @job_title
end

#last_nameObject

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#meeting_keyObject

Returns the value of attribute meeting_key.



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

def meeting_key
  @meeting_key
end

#name_and_valuesObject

Returns the value of attribute name_and_values.



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

def name_and_values
  @name_and_values
end

#phone_numberObject

Returns the value of attribute phone_number.



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

def phone_number
  @phone_number
end

#radio_button_contentsObject

Returns the value of attribute radio_button_contents.



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

def radio_button_contents
  @radio_button_contents
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#text_box_contentsObject

Returns the value of attribute text_box_contents.



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

def text_box_contents
  @text_box_contents
end

#zip_codeObject

Returns the value of attribute zip_code.



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

def zip_code
  @zip_code
end

Instance Method Details

#formObject



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

def form
  option_required! :meeting_key
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'GF')
  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
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/webex/meeting/registration.rb', line 30

def generate_params(overwrite_params = {})
  result = {}
  result[:AT] = overwrite_params[:api_type]
  result[:MK] = meeting_key
  result[:BU] = back_url

  if result[:AT] == 'RM'
    result[:FN] = first_name
    result[:LN] = last_name
    result[:EM] = email_address
    result[:JT] = job_title
    result[:CY] = computer_name
    result[:E1] = address_1
    result[:E2] = address_2
    result[:CT] = city
    result[:SA] = state
    result[:ZP] = zip_code
    result[:CI] = country
    result[:PH] = phone_number
    result[:FX] = fax
    result.merge!(name_and_value_params) if name_and_values
    result.merge!(tc_params)
  end
  result.delete_if { |k, v| v.nil? }
end

#registerObject



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

def register
  option_required! :meeting_key, :first_name, :last_name, :email_address, :job_title, :computer_name
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'RM')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end