Class: Zoom::Client::ServerToServerOAuth

Inherits:
Zoom::Client show all
Defined in:
lib/zoom/clients/server_to_server_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

#bearer_authorization_header, #headers, #oauth_request_headers, #request_headers

Methods included from Actions

determine_request_options, extract_path_keys, make_request, parse_path

Constructor Details

#initialize(config) ⇒ ServerToServerOAuth

Returns a new instance of ServerToServerOAuth.



8
9
10
11
12
13
14
# File 'lib/zoom/clients/server_to_server_oauth.rb', line 8

def initialize(config)
  Zoom::Params.new(config).permit(i[access_token  client_id client_secret timeout])
  Zoom::Params.new(config).require_one_of(i[access_token ])

  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/server_to_server_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/server_to_server_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/server_to_server_oauth.rb', line 6

def expires_in
  @expires_in
end

Instance Method Details

#authObject



16
17
18
19
20
# File 'lib/zoom/clients/server_to_server_oauth.rb', line 16

def auth
  response = (account_id: @account_id)
  set_tokens(response)
  response
end

#auth_tokenObject



22
23
24
25
26
# File 'lib/zoom/clients/server_to_server_oauth.rb', line 22

def auth_token
  return Base64.urlsafe_encode64("#{@client_id}:#{@client_secret}") if @client_id && @client_secret

  Base64.urlsafe_encode64("#{Zoom.configuration.api_key}:#{Zoom.configuration.api_secret}")
end