class Dynomatic::Scaler
Attributes
heroku_token[RW]
Public Class Methods
new(heroku_token, heroku_app)
click to toggle source
# File lib/dynomatic/scaler.rb, line 7 def initialize(heroku_token, heroku_app) @heroku_token = heroku_token @heroku_app = heroku_app end
Public Instance Methods
scale_to(dyno_count, type: "worker")
click to toggle source
# File lib/dynomatic/scaler.rb, line 12 def scale_to(dyno_count, type: "worker") Rails.logger.info "Scaling #{type} to #{dyno_count}" client.formation.update(heroku_app, type, {quantity: dyno_count}) end
start!(type)
click to toggle source
# File lib/dynomatic/scaler.rb, line 18 def start!(type) scale_to(1, type: type) end
stop!(type)
click to toggle source
# File lib/dynomatic/scaler.rb, line 22 def stop!(type) scale_to(0, type: type) end
Private Instance Methods
client()
click to toggle source
# File lib/dynomatic/scaler.rb, line 28 def client @client = ::PlatformAPI.connect_oauth(heroku_token) end