Method: Echochamber::Request.get_token

Defined in:
lib/echochamber/request.rb

.get_token(credentials) ⇒ String

Retrieves the authentication token

Parameters:

Returns:

  • (String)

    Valid authentication token



32
33
34
35
36
37
# File 'lib/echochamber/request.rb', line 32

def self.get_token(credentials)
  headers = { :content_type => :json, :accept => :json  }
  response = post(ENDPOINT.fetch(:token), credentials, headers)
  response_body = JSON.parse(response.body)
  response_body.fetch("accessToken")
end