Class: OurEelHacks::HerokuClient

Inherits:
Object
  • Object
show all
Defined in:
lib/our-eel-hacks/heroku-client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, api_key) ⇒ HerokuClient

Returns a new instance of HerokuClient.



5
6
7
8
# File 'lib/our-eel-hacks/heroku-client.rb', line 5

def initialize(logger, api_key)
  @logger = logger
  @api = Heroku::API.new(:api_key => api_key)
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



11
12
13
# File 'lib/our-eel-hacks/heroku-client.rb', line 11

def api
  @api
end

#loggerObject (readonly)

Returns the value of attribute logger.



10
11
12
# File 'lib/our-eel-hacks/heroku-client.rb', line 10

def logger
  @logger
end

Instance Method Details

#ps(app_name) ⇒ Object



13
14
15
16
# File 'lib/our-eel-hacks/heroku-client.rb', line 13

def ps(app_name)
  logger.info{ "Scaling Heroku API call: get ps #{app_name.inspect}" }
  api.get_ps(app_name).body
end

#ps_scale(app_name, ps_type, count) ⇒ Object



18
19
20
21
# File 'lib/our-eel-hacks/heroku-client.rb', line 18

def ps_scale(app_name, ps_type, count)
  logger.info{ "Scaling Heroku API call: post ps_scale #{[app_name, ps_type, count].inspect}" }
  api.post_ps_scale(app_name, ps_type, count)
end