Class: NeetoDeploy::CLI::Env::List

Inherits:
Base
  • Object
show all
Includes:
Constants, Session
Defined in:
lib/neeto_deploy/cli/env/list.rb

Constant Summary

Constants included from Session

Session::CONSOLE_EXECUTABLE

Constants included from Constants

Constants::NEETO_DEPLOY_CLI_API_ENVIRONMENT_VARIABLES_URL

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Session

#auth_headers, #console_executable_name, #json_auth_headers, #os, require_app_option, #send_delete_request, #send_get_request, #send_patch_request, #send_post_request

Methods included from Constants

#environment_variables_url

Methods inherited from Base

#create_config_dir

Constructor Details

#initialize(options:) ⇒ List

Returns a new instance of List.



19
20
21
22
23
# File 'lib/neeto_deploy/cli/env/list.rb', line 19

def initialize(options:)
  super()
  @app_slug = options[:app]
  @is_json_format = options[:json]
end

Instance Attribute Details

#app_slugObject (readonly)

Returns the value of attribute app_slug.



17
18
19
# File 'lib/neeto_deploy/cli/env/list.rb', line 17

def app_slug
  @app_slug
end

#is_json_formatObject (readonly)

Returns the value of attribute is_json_format.



17
18
19
# File 'lib/neeto_deploy/cli/env/list.rb', line 17

def is_json_format
  @is_json_format
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/neeto_deploy/cli/env/list.rb', line 25

def run
  ui.execute_with_loading("Fetching environment variables...") do
    @response = send_get_request(environment_variables_url, { app_slug: })
  end

  ui.error(@response["error"] || @response.message) and return unless @response.success?

  data = is_json_format ? json_data(@response["environment_variables"]) : table_data(@response["environment_variables"])
  ui.info(data)
end