Class: HerokuDelayedJobAutoscale::Manager::Heroku

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku_delayed_job_autoscale/managers/heroku.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Heroku

Returns a new instance of Heroku.



6
7
8
9
10
11
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 6

def initialize(options={})
  username = options[:username] || ENV['HEROKU_USERNAME']
  password = options[:password] || ENV['HEROKU_PASSWORD']
  @app     = options[:app]      || ENV['HEROKU_APP']
  @client = ::Heroku::Client.new(username, password)
end

Instance Method Details

#qtyObject



13
14
15
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 13

def qty
  @client.info(@app)[:workers].to_i
end

#scale_downObject



21
22
23
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 21

def scale_down
  @client.set_workers(@app, 0)
end

#scale_upObject



17
18
19
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 17

def scale_up
  @client.set_workers(@app, 1)
end