Class: Coach4rb::Proxy::Access

Inherits:
Base
  • Object
show all
Defined in:
lib/coach4rb/proxy.rb

Overview

This class provides a general access proxy for the cyber coach service. It is used to have global access to the cuber coach service in the perspective of a specific user.

Instance Attribute Summary (collapse)

Attributes inherited from Base

#coach

Instance Method Summary (collapse)

Methods inherited from Base

#method_missing, #valid?

Methods included from Mixin::BasicAuth

included

Constructor Details

- (Access) initialize(username, password, coach)

Creates an access proxy which provides global access to the cyber coach in the scope of the given user credentials.

Examples

Examples:

@proxy = Coach4rb::Proxy::Access.new 'arueedlinger', 'muha', @coach_client

Parameters:

  • username (String)
  • password (String)
  • coach (Coach)


97
98
99
100
101
102
# File 'lib/coach4rb/proxy.rb', line 97

def initialize(username, password, coach)
  @username = username
  @password = password
  @coach = coach
  @base64 = basic_auth_encryption(@username, @password)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Coach4rb::Proxy::Base

Instance Attribute Details

- (Object) password (readonly)

Returns the value of attribute password



84
85
86
# File 'lib/coach4rb/proxy.rb', line 84

def password
  @password
end

- (Object) username (readonly)

Returns the value of attribute username



84
85
86
# File 'lib/coach4rb/proxy.rb', line 84

def username
  @username
end

Instance Method Details

- (Hash) proxy_options

Returns an hash with basic auth http options.

Returns:

  • (Hash)


108
109
110
# File 'lib/coach4rb/proxy.rb', line 108

def proxy_options
  {authorization: @base64}
end