Class: Rosemary::BasicAuthClient

Inherits:
Client
  • Object
show all
Defined in:
lib/rosemary/basic_auth_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ BasicAuthClient

Returns a new instance of BasicAuthClient.



9
10
11
12
# File 'lib/rosemary/basic_auth_client.rb', line 9

def initialize(username, password)
  @username = username
  @password = password
end

Instance Attribute Details

#passwordObject (readonly)

The password to be used to authenticate the user against the OMS API



7
8
9
# File 'lib/rosemary/basic_auth_client.rb', line 7

def password
  @password
end

#usernameObject (readonly)

The username to be used to authenticate the user against the OMS API



4
5
6
# File 'lib/rosemary/basic_auth_client.rb', line 4

def username
  @username
end

Instance Method Details

#credentialsHash

The username and password credentials as a Hash

Returns:

  • (Hash)

    the credential hash.



16
17
18
# File 'lib/rosemary/basic_auth_client.rb', line 16

def credentials
  {:username => username, :password => password}
end

#inspectObject

Override inspect message to keep the password from showing up in any logfile.



22
23
24
# File 'lib/rosemary/basic_auth_client.rb', line 22

def inspect
  "#<#{self.class.name}:#{self.object_id} @username='#{username}'>"
end