Class: Farm::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/farm/http.rb

Class Method Summary collapse

Class Method Details

.heroku_run(cmd) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/farm/http.rb', line 6

def self.heroku_run(cmd)
  endpoint    = RestClient::Resource.new "https://api.heroku.com/apps/#{ENV['APP_NAME']}/ps",
                '', ENV['API_KEY']
  headers     = { :accept => 'application/json' }
  post_params = { :command => 'rake farm:run', :ps_env => { 'CMD' => cmd } }
  response    = endpoint.post post_params, headers
  JSON.parse response
end