Class: Zoom::Client::OAuth

Inherits:
Zoom::Client show all
Defined in:
lib/zoom/clients/oauth.rb

Constant Summary

Constants included from Actions::Webinar

Actions::Webinar::RECURRENCE_KEYS, Actions::Webinar::SETTINGS_KEYS

Constants included from Actions::Recording

Actions::Recording::RECORDING_SETTINGS_KEYS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Zoom::Client

#auth_token, #headers, #oauth_request_headers, #request_headers

Methods included from Actions::IM::Chat

#chat_get, #chat_list, #get_chat_channels, #get_chat_user_channels

Methods included from Actions::Webinar

#past_webinar_list, #webinar_create, #webinar_delete, #webinar_get, #webinar_list, #webinar_panelist_list, #webinar_poll_get, #webinar_polls_list, #webinar_registrant_add, #webinar_registrant_get, #webinar_registrants_list, #webinar_registrants_status_update, #webinar_update

Methods included from Actions::User

#user_assistants_create, #user_assistants_delete, #user_assistants_delete_all, #user_assistants_list, #user_create, #user_delete, #user_email_check, #user_get, #user_list, #user_password_update, #user_permissions, #user_recordings_list, #user_schedulers_delete, #user_schedulers_delete_all, #user_schedulers_list, #user_settings_get, #user_settings_update, #user_token, #user_update, #user_vanity_name

Methods included from Actions::Token

#access_tokens, #data_compliance, #refresh_tokens, #revoke_tokens

Methods included from Actions::SipAudio

#sip_trunk_numbers_delete, #sip_trunks_delete, #sip_trunks_get, #sip_trunks_internal_callout_countries_add, #sip_trunks_internal_callout_country_delete, #sip_trunks_internal_callout_country_list, #sip_trunks_internal_numbers_add, #sip_trunks_internal_numbers_delete, #sip_trunks_internal_numbers_list, #sip_trunks_numbers_assign, #sip_trunks_numbers_list

Methods included from Actions::Roles

#roles_assign, #roles_create, #roles_get, #roles_list, #roles_members, #roles_unassign

Methods included from Actions::Report

#daily_report, #meeting_details_report, #meeting_participants_report, #webinar_participants_report

Methods included from Actions::Recording

#meeting_recording_file_delete, #meeting_recording_get, #meeting_recording_settings_get, #meeting_recording_settings_update, #recording_list

Methods included from Actions::Phone

#call_logs, #call_recordings, #phone_users_list

Methods included from Actions::Meeting

#livestream, #meeting_add_registrant, #meeting_create, #meeting_delete, #meeting_get, #meeting_invitation, #meeting_list, #meeting_registrant_questions, #meeting_update, #meeting_update_status, #past_meeting_details, #past_meeting_participants

Methods included from Actions::Groups

#groups_get, #groups_list

Methods included from Actions::Dashboard

#dashboard_crc, #dashboard_meeting_details, #dashboard_meeting_participants, #dashboard_meetings

Methods included from Actions::Billing

#billing_get, #billing_plans_list, #billing_plans_subscribe, #billing_plans_usage, #billing_update

Methods included from Actions::Account

#account_create, #account_delete, #account_get, #account_get_locked_settings, #account_list, #account_managed_domains, #account_options_update, #account_settings_get, #account_settings_update, #account_trusted_domains

Constructor Details

#initialize(config) ⇒ OAuth

Auth_token is sent in the header (auth_code, auth_token, redirect_uri) -> oauth API Returns (access_token, refresh_token)

(auth_token, refresh_token) -> oauth refresh API Returns (access_token, refresh_token)



15
16
17
18
19
20
21
22
23
24
# File 'lib/zoom/clients/oauth.rb', line 15

def initialize(config)
  Zoom::Params.new(config).permit( %i[auth_token auth_code redirect_uri access_token refresh_token timeout])
  Zoom::Params.new(config).require_one_of(%i[access_token refresh_token auth_code])
  if (config.keys & [:auth_code, :redirect_uri]).any?
    Zoom::Params.new(config).require( %i[auth_code redirect_uri])
  end

  config.each { |k, v| instance_variable_set("@#{k}", v) }
  self.class.default_timeout(@timeout || 20)
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



6
7
8
# File 'lib/zoom/clients/oauth.rb', line 6

def access_token
  @access_token
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



6
7
8
# File 'lib/zoom/clients/oauth.rb', line 6

def expires_at
  @expires_at
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



6
7
8
# File 'lib/zoom/clients/oauth.rb', line 6

def expires_in
  @expires_in
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



6
7
8
# File 'lib/zoom/clients/oauth.rb', line 6

def refresh_token
  @refresh_token
end

Instance Method Details

#authObject



26
27
28
# File 'lib/zoom/clients/oauth.rb', line 26

def auth
  refresh_token ? refresh : oauth
end

#oauthObject



36
37
38
39
40
# File 'lib/zoom/clients/oauth.rb', line 36

def oauth
  response = access_tokens(auth_code: @auth_code, redirect_uri: @redirect_uri)
  set_tokens(response)
  response
end

#refreshObject



30
31
32
33
34
# File 'lib/zoom/clients/oauth.rb', line 30

def refresh
  response = refresh_tokens(refresh_token: @refresh_token)
  set_tokens(response)
  response
end

#revokeObject



42
43
44
45
46
# File 'lib/zoom/clients/oauth.rb', line 42

def revoke
  response = revoke_tokens(access_token: @access_token)
  set_tokens(response)
  response
end