Class: HerokuDelayedJobAutoscale::Manager::Heroku
- Inherits:
-
Object
- Object
- HerokuDelayedJobAutoscale::Manager::Heroku
- Defined in:
- lib/heroku_delayed_job_autoscale/managers/heroku.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Heroku
constructor
A new instance of Heroku.
- #qty ⇒ Object
- #scale_down ⇒ Object
- #scale_up ⇒ Object
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(={}) username = [:username] || ENV['HEROKU_USERNAME'] password = [:password] || ENV['HEROKU_PASSWORD'] @app = [:app] || ENV['HEROKU_APP'] @client = ::Heroku::Client.new(username, password) end |
Instance Method Details
#qty ⇒ Object
13 14 15 |
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 13 def qty @client.info(@app)[:workers].to_i end |
#scale_down ⇒ Object
21 22 23 |
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 21 def scale_down @client.set_workers(@app, 0) end |
#scale_up ⇒ Object
17 18 19 |
# File 'lib/heroku_delayed_job_autoscale/managers/heroku.rb', line 17 def scale_up @client.set_workers(@app, 1) end |