Class: TeamcityRestClient::HttpBasicAuthentication
- Inherits:
-
Authentication
- Object
- Authentication
- TeamcityRestClient::HttpBasicAuthentication
- Defined in:
- lib/teamcity-rest-client.rb
Instance Method Summary collapse
-
#initialize(host, port, user, password, openuri_options = {}) ⇒ HttpBasicAuthentication
constructor
A new instance of HttpBasicAuthentication.
- #to_s ⇒ Object
- #url(path, params = {}) ⇒ Object
Methods inherited from Authentication
Constructor Details
#initialize(host, port, user, password, openuri_options = {}) ⇒ HttpBasicAuthentication
Returns a new instance of HttpBasicAuthentication.
119 120 121 122 |
# File 'lib/teamcity-rest-client.rb', line 119 def initialize host, port, user, password, = {} super({:http_basic_authentication => [user, password]}.merge()) @host, @port, @user, @password = host, port, user, password end |
Instance Method Details
#to_s ⇒ Object
130 131 132 |
# File 'lib/teamcity-rest-client.rb', line 130 def to_s "HttpBasicAuthentication #{@user}:#{@password}" end |
#url(path, params = {}) ⇒ Object
124 125 126 127 128 |
# File 'lib/teamcity-rest-client.rb', line 124 def url path, params = {} auth_path = path.start_with?("/httpAuth/") ? path : "/httpAuth#{path}" query_string = !params.empty? ? "?#{query_string_for(params)}" : "" "http://#{@host}:#{@port}#{auth_path}#{query_string}" end |