Class: NeetoDeploy::CLI::Processes::Scale

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

Constant Summary

Constants included from Session

Session::CONSOLE_EXECUTABLE

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Constants

#process_url, #processes_url

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 inherited from Base

#create_config_dir

Constructor Details

#initialize(options:) ⇒ Scale

Returns a new instance of Scale.



15
16
17
18
19
20
# File 'lib/neeto_deploy/cli/processes/scale.rb', line 15

def initialize(options:)
  super()
  @app_slug = options[:app]
  @process_type = options[:process_type]
  @dyno_count = options[:dyno_count]
end

Instance Attribute Details

#app_slugObject (readonly)

Returns the value of attribute app_slug.



13
14
15
# File 'lib/neeto_deploy/cli/processes/scale.rb', line 13

def app_slug
  @app_slug
end

#dyno_countObject (readonly)

Returns the value of attribute dyno_count.



13
14
15
# File 'lib/neeto_deploy/cli/processes/scale.rb', line 13

def dyno_count
  @dyno_count
end

#process_typeObject (readonly)

Returns the value of attribute process_type.



13
14
15
# File 'lib/neeto_deploy/cli/processes/scale.rb', line 13

def process_type
  @process_type
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
# File 'lib/neeto_deploy/cli/processes/scale.rb', line 22

def run
  ui.execute_with_loading("Scaling #{process_type}...") do
    @response = send_patch_request(process_url(process_type), { app_slug:, dyno_count: })
  end

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

  ui.success(JSON.parse(@response.body)["message"])
end