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

#initialize(username, password, coach) ⇒ Access

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

Parameters:

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


93
94
95
96
97
98
# File 'lib/coach4rb/proxy.rb', line 93

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

#passwordObject (readonly)

Returns the value of attribute password.



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

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#proxy_optionsHash

Returns an hash with basic auth http options.

Returns:

  • (Hash)


104
105
106
# File 'lib/coach4rb/proxy.rb', line 104

def proxy_options
  {authorization: @base64}
end