Class: Heroku::API

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/api/apps_v3.rb,
lib/heroku/api/releases_v3.rb

Instance Method Summary collapse

Instance Method Details

#get_app_buildpacks_v3(app) ⇒ Object


3
4
5
6
7
8
9
10
11
# File 'lib/heroku/api/apps_v3.rb', line 3

def get_app_buildpacks_v3(app)
  headers = { 'Accept' => 'application/vnd.heroku+json; version=3' }
  request(
  :expects  => [ 200, 206 ],
  :headers  => headers,
  :method   => :get,
  :path     => "/apps/#{app}/buildpack-installations"
  )
end

#get_releases_v3(app, range = nil) ⇒ Object


3
4
5
6
7
8
9
10
11
12
# File 'lib/heroku/api/releases_v3.rb', line 3

def get_releases_v3(app, range=nil)
  headers = { 'Accept' => 'application/vnd.heroku+json; version=3' }
  headers.merge!('Range' => range) if range
  request(
    :expects  => [ 200, 206 ],
    :headers  => headers,
    :method   => :get,
    :path     => "/apps/#{app}/releases"
  )
end

#post_release_v3(app, slug_id, opts = {}) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/heroku/api/releases_v3.rb', line 14

def post_release_v3(app, slug_id, opts={})
  headers = {
    'Accept'       => 'application/vnd.heroku+json; version=3',
    'Content-Type' => 'application/json'
  }
  headers.merge!('Heroku-Deploy-Type' => opts[:deploy_type]) if opts[:deploy_type]
  headers.merge!('Heroku-Deploy-Source' => opts[:deploy_source]) if opts[:deploy_source]

  body = { 'slug' => slug_id }
  body.merge!('description' => opts[:description]) if opts[:description]

  request(
    :expects  => 201,
    :headers  => headers,
    :method   => :post,
    :path     => "/apps/#{app}/releases",
    :body     => Heroku::Helpers.json_encode(body)
  )
end

#put_app_buildpacks_v3(app, body = {}) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/heroku/api/apps_v3.rb', line 13

def put_app_buildpacks_v3(app, body={})
  headers = {
    'Accept'       => 'application/vnd.heroku+json; version=3',
    'Content-Type' => 'application/json'
  }
  request(
  :expects  => 200,
  :headers  => headers,
  :method   => :put,
  :path     => "/apps/#{app}/buildpack-installations",
  :body     => Heroku::Helpers.json_encode(body)
  )
end