Class: Vonage::NetworkAuthentication

Inherits:
AbstractAuthentication show all
Defined in:
lib/vonage/network_authentication.rb

Defined Under Namespace

Classes: ClientAuthentication, ServerAuthentication

Instance Method Summary collapse

Methods inherited from AbstractAuthentication

#initialize

Constructor Details

This class inherits a constructor from Vonage::AbstractAuthentication

Instance Method Details

#client_authenticationObject



14
15
16
# File 'lib/vonage/network_authentication.rb', line 14

def client_authentication
  @client_authentication ||= ClientAuthentication.new(@config)
end

#server_authenticationObject



18
19
20
# File 'lib/vonage/network_authentication.rb', line 18

def server_authentication
  @server_authentication ||= ServerAuthentication.new(@config)
end

#update(object, data) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/vonage/network_authentication.rb', line 6

def update(object, data)
  return unless object.is_a?(Net::HTTPRequest)

  token = self.public_send(data[:auth_flow]).token(**data)

  object['Authorization'] = 'Bearer ' + token
end