Class: SwaggerPetstore::HttpBasicCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_petstore/http/auth/http_basic.rb

Overview

Data class for HttpBasicCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username:, passwprd:) ⇒ HttpBasicCredentials

Returns a new instance of HttpBasicCredentials.

Raises:

  • (ArgumentError)


35
36
37
38
39
40
41
# File 'lib/swagger_petstore/http/auth/http_basic.rb', line 35

def initialize(username:, passwprd:)
  raise ArgumentError, 'username cannot be nil' if username.nil?
  raise ArgumentError, 'passwprd cannot be nil' if passwprd.nil?

  @username = username
  @passwprd = passwprd
end

Instance Attribute Details

#passwprdObject (readonly)

Returns the value of attribute passwprd.



33
34
35
# File 'lib/swagger_petstore/http/auth/http_basic.rb', line 33

def passwprd
  @passwprd
end

#usernameObject (readonly)

Returns the value of attribute username.



33
34
35
# File 'lib/swagger_petstore/http/auth/http_basic.rb', line 33

def username
  @username
end

Instance Method Details

#clone_with(username: nil, passwprd: nil) ⇒ Object



43
44
45
46
47
48
# File 'lib/swagger_petstore/http/auth/http_basic.rb', line 43

def clone_with(username: nil, passwprd: nil)
  username ||= self.username
  passwprd ||= self.passwprd

  HttpBasicCredentials.new(username: username, passwprd: passwprd)
end