Class: AuthBasic
- Inherits:
-
Object
- Object
- AuthBasic
- Includes:
- AuthProvider
- Defined in:
- lib/sideko_hacker_news.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #add_auth(http_client, req_kwargs) ⇒ Object
-
#initialize(username: nil, password: nil) ⇒ AuthBasic
constructor
A new instance of AuthBasic.
Constructor Details
#initialize(username: nil, password: nil) ⇒ AuthBasic
Returns a new instance of AuthBasic.
34 35 36 37 |
# File 'lib/sideko_hacker_news.rb', line 34 def initialize(username: nil, password: nil) @username = username @password = password end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
32 33 34 |
# File 'lib/sideko_hacker_news.rb', line 32 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
32 33 34 |
# File 'lib/sideko_hacker_news.rb', line 32 def username @username end |
Instance Method Details
#add_auth(http_client, req_kwargs) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/sideko_hacker_news.rb', line 39 def add_auth(http_client, req_kwargs) if !@username.nil? && !@password.nil? http_client = http_client.basic_auth(user: @username, pass: @password) end return http_client, req_kwargs end |