Sha256: 3ab4a73eae866eb7eda7948dac9234680ed3d0dded40fac1ac683f24768655c8

Contents?: true

Size: 2 KB

Versions: 3

Compression:

Stored size: 2 KB

Contents

module Heroku
  class API

    # GET /apps/:app/ps
    def get_ps(app)
      request(
        :expects  => 200,
        :method   => :get,
        :path     => "/apps/#{app}/ps"
      )
    end

    # POST /apps/:app/ps
    def post_ps(app, command, options={})
      options = { 'command' => command }.merge(options)
      request(
        :expects  => 200,
        :method   => :post,
        :path     => "/apps/#{app}/ps",
        :query    => ps_options(options)
      )
    end

    # POST /apps/:app/ps/restart
    def post_ps_restart(app, options={})
      request(
        :expects  => 200,
        :method   => :post,
        :path     => "/apps/#{app}/ps/restart",
        :query    => options
      )
    end

    # POST /apps/:app/ps/scale
    def post_ps_scale(app, type, quantity)
      request(
        :expects  => 200,
        :method   => :post,
        :path     => "/apps/#{app}/ps/scale",
        :query    => {
          'type'  => type,
          'qty'   => quantity
        }
      )
    end

    # POST /apps/:app/ps/stop
    def post_ps_stop(app, options)
      request(
        :expects  => 200,
        :method   => :post,
        :path     => "/apps/#{app}/ps/stop",
        :query    => options
      )
    end

    # PUT /apps/:app/dynos
    def put_dynos(app, dynos)
      request(
        :expects  => 200,
        :method   => :put,
        :path     => "/apps/#{app}/dynos",
        :query    => {'dynos' => dynos}
      )
    end

    # PUT /apps/:app/workers
    def put_workers(app, workers)
      request(
        :expects  => 200,
        :method   => :put,
        :path     => "/apps/#{app}/workers",
        :query    => {'workers' => workers}
      )
    end

    # PUT /apps/:app/formation
    def put_formation(app, options)
      options.each { |process, size| options[process] = {'size' => size} }
      request(
        :body     => Heroku::API::OkJson.encode(options),
        :expects  => 200,
        :method   => :put,
        :path     => "/apps/#{app}/formation"
      )
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heroku-api-0.3.14 lib/heroku/api/processes.rb
heroku-api-0.3.13 lib/heroku/api/processes.rb
heroku-api-0.3.12 lib/heroku/api/processes.rb