class Argonaut::Cli

Attributes

gateway[R]

Public Class Methods

new(gateway:) click to toggle source
# File lib/argonaut/cli.rb, line 8
def initialize(gateway:)
  @gateway = gateway
end

Public Instance Methods

clear_reservations() click to toggle source
# File lib/argonaut/cli.rb, line 27
def clear_reservations
  @gateway.delete(path: "clear_reservations", data: nil)
end
find_app(app_name) click to toggle source
# File lib/argonaut/cli.rb, line 41
def find_app(app_name)
  data = { application_name: app_name }
  @gateway.fetch(path: "find_application", data: data)
end
initialize_configuration_file() click to toggle source
# File lib/argonaut/cli.rb, line 46
    def initialize_configuration_file
      return false if File.exist? Argonaut::Constants::SETTINGS_FILE

      File.open( Argonaut::Constants::SETTINGS_FILE, "w" ) do |f|
        f.write %q(
# The only required fields needed by the gem to function are api_token and url_root

api_token: YOUR_TOKEN
url_root: https://theargonaut-api.herokuapp.com

# Below are the optional settings to customize output

options:
  colorize_rows: true
  time_format: '%d %b %Y %l:%M %p'
  high_contrast_colors: true
)
      end
      true
    end
list_reservations() click to toggle source

Gets list of current user's reservations

# File lib/argonaut/cli.rb, line 23
def list_reservations
  @gateway.fetch(path: "list_reservations")
end
release!(env_name, app_name) click to toggle source
# File lib/argonaut/cli.rb, line 36
def release!(env_name, app_name)
  data = { application_name: app_name, environment_name: env_name }
  @gateway.delete(path: "reservations", data: data)
end
reservations(team_name_or_id) click to toggle source

Gets all the reservations for the given team

# File lib/argonaut/cli.rb, line 18
def reservations(team_name_or_id)
  @gateway.fetch(path: "teams/#{team_name_or_id}/reservations")
end
reserve!(env_name, app_name) click to toggle source
# File lib/argonaut/cli.rb, line 31
def reserve!(env_name, app_name)
  data = { application_name: app_name, environment_name: env_name }
  @gateway.post(path: "reservations", data: data)
end
teams() click to toggle source
# File lib/argonaut/cli.rb, line 12
def teams
  raw_data = @gateway.fetch(path: 'teams')
  raw_data['data']
end