Module: Nucleus::Adapters::V1::Heroku::Authentication
- Included in:
- Nucleus::Adapters::V1::Heroku
- Defined in:
- lib/nucleus/adapters/v1/heroku/authentication.rb
Overview
Authentication functionality to support the Heroku API
Instance Method Summary collapse
Instance Method Details
#auth_client ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nucleus/adapters/v1/heroku/authentication.rb', line 8 def auth_client log.debug "Authenticate @ #{@endpoint_url}" TokenAuthClient.new @check_certificates do |verify_ssl, username, password| response = Excon.post("#{@endpoint_url}/login", query: { username: username, password: password }, ssl_verify_peer: verify_ssl) # Heroku returns 404 for invalid credentials, then we do not return an API token if response.status == 404 nil else # extract the token response_parsed = JSON.parse(response.body) response_parsed['api_key'] end end end |