Class: Webex::User::Registration

Inherits:
Object
  • Object
show all
Includes:
Webex, Webex::User
Defined in:
lib/webex/user/registration.rb

Overview

comment

Constant Summary

Constants included from Webex::User

PATH_URL

Constants included from Webex

CONFIGURATION, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Webex::User

#post_url

Methods included from Webex

#env_attributes!, #option_required!

Constructor Details

#initialize(attributes = {}) ⇒ Registration

office_phones = nil, OPhoneArea: nil, OPhoneLocal: nil, OPhoneExt: nil fax_phones = nil, FPhoneArea: nil, FPhoneLocal: nil, FPhoneExt: nil supports = { SupportRecordingEdit: nil, SupportFileFolder: nil, SupportMyContacts: nil,

SupportMyProfile: nil, SupportMyMeetings: nil, SupportEndUserReport: nil,
SupportAccessAnywhere: nil, SupportMyRecordings: nil, SupportEventDocuments: nil,
SupportPersonalLobby: nil}

tracking_codes = [nil, nil, nil] tsp_bridges: [nil, TollFreeCallIn: nil, TollCallIn1: nil, ParticipantAccessCode: nil, SubscribeAccessCode: nil,

{CreateAccount: nil, TollFreeCallIn: nil, TollCallIn1: nil, ParticipantAccessCode: nil, SubscribeAccessCode: nil},
{CreateAccount: nil, TollFreeCallIn: nil, TollCallIn1: nil, ParticipantAccessCode: nil, SubscribeAccessCode: nil}]


25
26
27
28
29
# File 'lib/webex/user/registration.rb', line 25

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

Instance Attribute Details

#address_1Object

Returns the value of attribute address_1.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def address_1
  @address_1
end

#address_2Object

Returns the value of attribute address_2.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def address_2
  @address_2
end

#adminObject

Returns the value of attribute admin.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def admin
  @admin
end

#back_urlObject

Returns the value of attribute back_url.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def back_url
  @back_url
end

#cityObject

Returns the value of attribute city.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def city
  @city
end

#computerObject

Returns the value of attribute computer.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def computer
  @computer
end

#countryObject

Returns the value of attribute country.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def country
  @country
end

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def email
  @email
end

#fax_phonesObject

Returns the value of attribute fax_phones.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def fax_phones
  @fax_phones
end

#first_nameObject

Returns the value of attribute first_name.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def last_name
  @last_name
end

#meeting_typeObject

Returns the value of attribute meeting_type.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def meeting_type
  @meeting_type
end

#new_passwordObject

Returns the value of attribute new_password.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def new_password
  @new_password
end

#new_webex_idObject

Returns the value of attribute new_webex_id.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def new_webex_id
  @new_webex_id
end

#office_phonesObject

Returns the value of attribute office_phones.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def office_phones
  @office_phones
end

#one_clickObject

Returns the value of attribute one_click.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def one_click
  @one_click
end

#partner_idObject

Returns the value of attribute partner_id.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def partner_id
  @partner_id
end

Returns the value of attribute partner_link.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def partner_link
  @partner_link
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def password
  @password
end

#password_changeObject

Returns the value of attribute password_change.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def password_change
  @password_change
end

#portalObject

Returns the value of attribute portal.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def portal
  @portal
end

#stateObject

Returns the value of attribute state.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def state
  @state
end

#storageObject

Returns the value of attribute storage.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def storage
  @storage
end

#supportsObject

Returns the value of attribute supports.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def supports
  @supports
end

#time_zoneObject

Returns the value of attribute time_zone.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def time_zone
  @time_zone
end

#tracking_codesObject

Returns the value of attribute tracking_codes.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def tracking_codes
  @tracking_codes
end

#tsp_bridgesObject

Returns the value of attribute tsp_bridges.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def tsp_bridges
  @tsp_bridges
end

#web_ex_typeObject

Returns the value of attribute web_ex_type.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def web_ex_type
  @web_ex_type
end

#webex_idObject

Returns the value of attribute webex_id.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def webex_id
  @webex_id
end

#zip_codeObject

Returns the value of attribute zip_code.



8
9
10
# File 'lib/webex/user/registration.rb', line 8

def zip_code
  @zip_code
end

Instance Method Details

#edit(condition = {}) ⇒ Object



37
38
39
40
41
# File 'lib/webex/user/registration.rb', line 37

def edit(condition={})
  option_required! :webex_id, :password, :partner_id
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'EU')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#generate_params(overwrite_params = {}) ⇒ Object



43
44
45
46
47
48
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
77
78
79
80
81
# File 'lib/webex/user/registration.rb', line 43

def generate_params(overwrite_params = {})
  result = {}
  result[:AT] = overwrite_params[:api_type]
  result[:PW] = password
  result[:PID] = partner_id
  result[:WID] = webex_id
  result[:Address1] = address_1
  result[:Address2] = address_2
  result[:City] = city
  result[:State] = state
  result[:ZipCode] = zip_code
  result[:Country] = country
  result[:AC] = computer
  result[:AS] = storage
  result[:LA] = admin
  result[:MW] = web_ex_type
  result[:PL] = partner_link
  result[:PT] = portal
  result[:MT] = meeting_type
  result[:TimeZone] = time_zone
  result[:BU] = back_url
  result[:OC] = one_click

  if result[:AT] == 'SU'
    result[:FN] = first_name
    result[:LN] = last_name
    result[:EM] = email
    result[:ForceChangeUserPwd] = password_change
  end

  if result[:AT] == 'EU'
    result[:NFN] = first_name
    result[:NLN] = last_name
    result[:NEM] = email
    result[:NPW] = new_password
    result[:NWID] = new_webex_id
  end
  merge_hash!(result)
end

#sign_up(condition = {}) ⇒ Object



31
32
33
34
35
# File 'lib/webex/user/registration.rb', line 31

def (condition={})
  option_required! :webex_id, :first_name, :last_name, :email, :password, :partner_id
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'SU')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end