Class: Webex::User::Partner
- Inherits:
-
Object
- Object
- Webex::User::Partner
- Includes:
- Webex, Webex::User
- Defined in:
- lib/webex/user/partner.rb
Overview
comment
Constant Summary
Constants included from Webex::User
Constants included from Webex
Instance Attribute Summary collapse
-
#back_type ⇒ Object
Returns the value of attribute back_type.
-
#back_url ⇒ Object
Returns the value of attribute back_url.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#new_password ⇒ Object
Returns the value of attribute new_password.
-
#password ⇒ Object
Returns the value of attribute password.
-
#session ⇒ Object
Returns the value of attribute session.
-
#ticket ⇒ Object
Returns the value of attribute ticket.
-
#webex_id ⇒ Object
Returns the value of attribute webex_id.
Instance Method Summary collapse
- #generate_params(overwrite_params = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Partner
constructor
A new instance of Partner.
- #login ⇒ Object
- #logout ⇒ Object
Methods included from Webex::User
Methods included from Webex
#env_attributes!, #option_required!
Constructor Details
#initialize(attributes = {}) ⇒ Partner
Returns a new instance of Partner.
9 10 11 12 13 |
# File 'lib/webex/user/partner.rb', line 9 def initialize(attributes = {}) attributes.each { |k, v| send("#{k}=", v) } env_attributes! option_required! :webex_id, :back_type, :back_url end |
Instance Attribute Details
#back_type ⇒ Object
Returns the value of attribute back_type.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def back_type @back_type end |
#back_url ⇒ Object
Returns the value of attribute back_url.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def back_url @back_url end |
#email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def last_name @last_name end |
#new_password ⇒ Object
Returns the value of attribute new_password.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def new_password @new_password end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def password @password end |
#session ⇒ Object
Returns the value of attribute session.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def session @session end |
#ticket ⇒ Object
Returns the value of attribute ticket.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def ticket @ticket end |
#webex_id ⇒ Object
Returns the value of attribute webex_id.
7 8 9 |
# File 'lib/webex/user/partner.rb', line 7 def webex_id @webex_id end |
Instance Method Details
#generate_params(overwrite_params = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/webex/user/partner.rb', line 25 def generate_params(overwrite_params = {}) result = {} result[:AT] = overwrite_params[:api_type] result[:WID] = webex_id result[:MU] = back_type result[:BU] = back_url if result[:AT] == 'LI' result[:TK] = ticket result[:PW] = password result[:EM] = email result[:SK] = session result[:FN] = first_name result[:LN] = last_name result[:NPW] = new_password end result.delete_if { |k, v| v.nil? } end |
#login ⇒ Object
15 16 17 18 |
# File 'lib/webex/user/partner.rb', line 15 def login res = Net::HTTP.post_form post_url, generate_params(api_type: 'LI') Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }] end |
#logout ⇒ Object
20 21 22 23 |
# File 'lib/webex/user/partner.rb', line 20 def logout res = Net::HTTP.post_form post_url, generate_params(api_type: 'LO') Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }] end |