heroku-api 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -16,6 +16,7 @@ Start by creating a connection to Heroku with your credentials:
16
16
 
17
17
  heroku = Heroku::API.new(:api_key => API_KEY) # use API Key
18
18
  heroku = Heroku::API.new(:username => USERNAME, :password => PASSWORD) # use username and password
19
+ heroku = Heroku::API.new(:headers => {'User-Agent' => 'custom'}) # use custom header
19
20
 
20
21
  NOTE: You can leave out the `:api_key` if `ENV['HEROKU_API_KEY']` is set instead.
21
22
 
@@ -30,39 +31,39 @@ For additional details about any of the commands, see the [API docs](http://api-
30
31
 
31
32
  ### Add-ons
32
33
 
33
- heroku.delete_addon('app', 'addon') # remove 'addon' add-on from an 'app' app
34
- heroku.get_addons # see a listing of all available add-ons
35
- heroku.get_addons('app') # see listing of installed add-ons for 'app' app
36
- heroku.post_addon('app', 'addon') # add 'addon' add-on to 'app' app
37
- heroku.put_addon('app', 'addon') # update 'addon' add-on on 'app' app
34
+ heroku.delete_addon(APP, ADD_ON) # remove the ADD_ON add-on from the app named APP
35
+ heroku.post_addon(APP, ADD_ON) # add ADD_ON add-on to an the app named APP
36
+ heroku.put_addon(APP, ADD_ON) # update the ADD_ON add-on on the app named APP
37
+ heroku.get_addons # see a listing of all available add-ons
38
+ heroku.get_addons(APP) # see listing of installed add-ons for the app named APP
38
39
 
39
40
  ### Apps
40
41
 
41
- heroku.delete_app('app') # delete an app named 'app'
42
+ heroku.delete_app(APP) # delete the app named APP
42
43
  heroku.get_apps # get a list of your apps
43
- heroku.get_app('app') # get info about an app named 'app'
44
+ heroku.get_app(APP) # get info about the app named APP
44
45
  heroku.post_app # create an app with a generated name and the default stack
45
- heroku.post_app('name' => 'app') # create an app with a specified name
46
- heroku.post_app_maintenance('app', '1') # toggle maintenance mode
46
+ heroku.post_app_maintenance(APP, '1') # toggle maintenance mode for the app named APP
47
+ heroku.post_app('name' => 'app') # create an app with a specified name, APP
47
48
  heroku.put_app('name' => 'myapp') # update an app to have a different name
48
49
 
49
50
  ### Collaborators
50
51
 
51
- heroku.delete_collaborator('app', 'email@example.com') # remove 'email@example.com' collaborator from 'app' app
52
- heroku.get_collaborators('app') # list collaborators for 'app' app
53
- heroku.post_collaborator('app', 'email@example.com') # add 'email@example.com' collaborator to 'app' app
52
+ heroku.delete_collaborator(APP, 'email@example.com') # remove 'email@example.com' collaborator from APP app
53
+ heroku.get_collaborators(APP) # list collaborators for APP app
54
+ heroku.post_collaborator(APP, 'email@example.com') # add 'email@example.com' collaborator to APP app
54
55
 
55
56
  ### Config Variables
56
57
 
57
- heroku.delete_config_var('app', 'KEY') # remove 'KEY' key from 'app' app
58
- heroku.get_config_vars('app') # get list of config vars for 'app' app
59
- heroku.put_config_vars('app', 'KEY' => 'value') # set 'KEY' key to 'value' for 'app' app
58
+ heroku.delete_config_var(APP, KEY) # remove KEY key from APP app
59
+ heroku.get_config_vars(APP) # get list of config vars for APP app
60
+ heroku.put_config_vars(APP, KEY => 'value') # set KEY key to 'value' for APP app
60
61
 
61
62
  ### Domains
62
63
 
63
- heroku.delete_domain('app', 'example.com') # remove the 'example.com' domain from the 'app' app
64
- heroku.get_domains('app') # list configured domains for the 'app' app
65
- heroku.post_domain('app', 'example.com') # add 'example.com' domain to the 'app' app
64
+ heroku.delete_domain(APP, 'example.com') # remove the 'example.com' domain from the APP app
65
+ heroku.get_domains(APP) # list configured domains for the APP app
66
+ heroku.post_domain(APP, 'example.com') # add 'example.com' domain to the APP app
66
67
 
67
68
  ### Keys
68
69
 
@@ -73,31 +74,31 @@ For additional details about any of the commands, see the [API docs](http://api-
73
74
 
74
75
  ### Logs
75
76
 
76
- heroku.get_logs('app') # return logs information for 'app' app
77
+ heroku.get_logs(APP) # return logs information for APP app
77
78
 
78
79
  ### Processes
79
80
 
80
- heroku.get_ps('app') # list current processes for 'app' app
81
- heroku.post_ps('app', 'command') # run 'command' command in context of 'app' app
82
- heroku.post_ps_restart('app') # restart all processes for 'app' app
83
- heroku.post_ps_scale('app', 'type', 'quantity') # scale 'type' type processes to 'quantity' for 'app' app
84
- heroku.post_ps_stop('app', 'ps' => 'web.1') # stop 'web.1' process for 'app' app
85
- heroku.post_ps_stop('app', 'type' => 'web') # stop all 'web' processes for 'app' app
86
- heroku.put_dynos('app', 'dynos') # set number of dynos for bamboo app 'app' to 'dynos'
87
- heroku.put_workers('app', 'workers') # set number of workers for bamboo app 'app' to 'workers'
88
-
89
- heroku.post_ps_restart('app', 'ps' => 'web.1') # restart 'web.1' process for 'app' app
90
-
81
+ heroku.get_ps(APP) # list current processes for APP app
82
+ heroku.post_ps(APP, 'command') # run 'command' command in context of APP app
83
+ heroku.post_ps_restart(APP) # restart all processes for APP app
84
+ heroku.post_ps_scale(APP, TYPE, QTY) # scale TYPE type processes to QTY for APP app
85
+ heroku.post_ps_stop(APP, 'ps' => 'web.1') # stop 'web.1' process for APP app
86
+ heroku.post_ps_stop(APP, 'type' => 'web') # stop all 'web' processes for APP app
87
+ heroku.post_ps_restart(APP, 'ps' => 'web.1') # restart 'web.1' process for APP app
88
+ heroku.put_dynos(APP, DYNOS) # set number of dynos for bamboo app APP to DYNOS
89
+ heroku.put_workers(APP, WORKERS) # set number of workers for bamboo app APP to WORKERS
90
+ heroku.post_ps_scale(APP, 'worker', WORKERS) # set number of workers for cedar app APP to WORKERS
91
+
91
92
  ### Releases
92
93
 
93
- heroku.get_releases('app') # list of releases for 'app' app
94
- heroku.get_release('app', 'v#') # get details of 'v#' release for 'app' app
95
- heroku.post_release('app', 'v#') # rollback 'app' app to 'v#' release
94
+ heroku.get_releases(APP) # list of releases for the APP app
95
+ heroku.get_release(APP, 'v#') # get details of 'v#' release for APP app
96
+ heroku.post_release(APP, 'v#') # rollback APP app to 'v#' release
96
97
 
97
98
  ### Stacks
98
99
 
99
- heroku.get_stack('app') # list available stacks
100
- heroku.put_stack('app', 'stack') # migrate 'app' app to 'stack' stack
100
+ heroku.get_stack(APP) # list available stacks
101
+ heroku.put_stack(APP, STACK) # migrate APP app to STACK stack
101
102
 
102
103
  ### User
103
104
 
@@ -1,3 +1,14 @@
1
+ 0.3.8 02/27/2012
2
+ ================
3
+
4
+ document custom headers
5
+ remove SHARED_DATABASE from mocks
6
+ clarify cedar scaling
7
+ clarify README examples
8
+ return more helpful error for blank app
9
+ add legacy tier to mocks
10
+
11
+
1
12
  0.3.7 11/19/2012
2
13
  ================
3
14
 
@@ -77,7 +77,12 @@ module Heroku
77
77
  when 401 then Heroku::API::Errors::Unauthorized
78
78
  when 402 then Heroku::API::Errors::VerificationRequired
79
79
  when 403 then Heroku::API::Errors::Forbidden
80
- when 404 then Heroku::API::Errors::NotFound
80
+ when 404
81
+ if error.request[:path].match /\/apps\/\/.*/
82
+ Heroku::API::Errors::NilApp
83
+ else
84
+ Heroku::API::Errors::NotFound
85
+ end
81
86
  when 408 then Heroku::API::Errors::Timeout
82
87
  when 422 then Heroku::API::Errors::RequestFailed
83
88
  when 423 then Heroku::API::Errors::Locked
@@ -19,6 +19,8 @@ module Heroku
19
19
  class Timeout < ErrorWithResponse; end
20
20
  class Locked < ErrorWithResponse; end
21
21
  class RequestFailed < ErrorWithResponse; end
22
+ class NilApp < ErrorWithResponse; end
23
+
22
24
  end
23
25
  end
24
26
  end
@@ -52,8 +52,7 @@ module Heroku
52
52
  'BUNDLE_WITHOUT' => 'development:test',
53
53
  'DATABASE_URL' => 'postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username',
54
54
  'LANG' => 'en_US.UTF-8',
55
- 'RACK_ENV' => 'production',
56
- 'SHARED_DATABASE_URL' => 'postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username'
55
+ 'RACK_ENV' => 'production'
57
56
  }
58
57
  else
59
58
  {}
@@ -78,6 +78,7 @@ module Heroku
78
78
  'owner_email' => 'email@example.com',
79
79
  'slug_size' => nil,
80
80
  'stack' => stack,
81
+ 'tier' => "legacy",
81
82
  'requested_stack' => nil,
82
83
  'git_url' => "git@heroku.com:#{app}.git",
83
84
  'repo_migrate_status' => 'complete',
@@ -36,6 +36,9 @@ module Heroku
36
36
  end
37
37
  end
38
38
 
39
+ # stub DELETE /apps//domains/:domain
40
+ Excon.stub({:method => :delete, :path => %r{^/apps//domains/([^/]+)$} }, {:status => 404})
41
+
39
42
  # stub GET /apps/:app/domains
40
43
  Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/domains$} ) do |params|
41
44
  request_params, mock_data = parse_stub_params(params)
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+
3
+ class TestErrorConditions < MiniTest::Unit::TestCase
4
+
5
+ def test_request_without_app_returns_a_sensible_error
6
+ assert_raises(Heroku::API::Errors::NilApp) do
7
+ heroku.delete_domain("", 'example.com')
8
+ end
9
+ end
10
+
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
@@ -119,6 +119,7 @@ files:
119
119
  - test/test_collaborators.rb
120
120
  - test/test_config_vars.rb
121
121
  - test/test_domains.rb
122
+ - test/test_error_conditions.rb
122
123
  - test/test_features.rb
123
124
  - test/test_helper.rb
124
125
  - test/test_keys.rb
@@ -141,12 +142,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
142
  - - ! '>='
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
145
+ segments:
146
+ - 0
147
+ hash: -2193435040644309504
144
148
  required_rubygems_version: !ruby/object:Gem::Requirement
145
149
  none: false
146
150
  requirements:
147
151
  - - ! '>='
148
152
  - !ruby/object:Gem::Version
149
153
  version: '0'
154
+ segments:
155
+ - 0
156
+ hash: -2193435040644309504
150
157
  requirements: []
151
158
  rubyforge_project:
152
159
  rubygems_version: 1.8.23
@@ -162,6 +169,7 @@ test_files:
162
169
  - test/test_collaborators.rb
163
170
  - test/test_config_vars.rb
164
171
  - test/test_domains.rb
172
+ - test/test_error_conditions.rb
165
173
  - test/test_features.rb
166
174
  - test/test_helper.rb
167
175
  - test/test_keys.rb
@@ -172,4 +180,3 @@ test_files:
172
180
  - test/test_ssl_endpoints.rb
173
181
  - test/test_stacks.rb
174
182
  - test/test_user.rb
175
- has_rdoc: