Method: GitPivotalTrackerIntegration::Command::Configuration#api_token

Defined in:
lib/git-pivotal-tracker-integration/command/configuration.rb

#api_tokenString

Returns the user’s Pivotal Tracker API token. If this token has not been configured, prompts the user for the value. The value is checked for in the inherited Git configuration, but is stored in the global Git configuration so that it can be used across multiple repositories.

Returns:

  • (String)

    The user’s Pivotal Tracker API token



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/git-pivotal-tracker-integration/command/configuration.rb', line 35

def api_token
  api_token = Util::Git.get_config KEY_API_TOKEN, :inherited
  if api_token.empty?
    api_token = ask('Pivotal API Token (found at https://www.pivotaltracker.com/profile): ').strip
    Util::Git.set_config KEY_API_TOKEN, api_token, :global
    puts
  end
  self.check_config_project_id

  api_token
end