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

#common_body, #console_executable_name, #headers, #os, require_app_option, #send_delete_request, #send_get_request, #send_patch_request, #send_post_request, #session_token

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.



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

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.



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

def app_slug
  @app_slug
end

#is_json_formatObject (readonly)

Returns the value of attribute is_json_format.



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

def is_json_format
  @is_json_format
end

Instance Method Details

#runObject



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

def run
  response = send_get_request(
    environment_variables_url, {
      app_slug:
    }
  )

  ui.error(response) and return unless response.success?

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