heroku-api 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb78b67088d699c2a0477c2ee68bf160d3a930db
4
+ data.tar.gz: 267dd8a9b5c5454c050a2859c5d1945e7ed062e6
5
+ SHA512:
6
+ metadata.gz: 336c3c6c37d289beba85c8ee126dc1892cdc0f86992e326777a74a135c15929b0f9b6b0bc34999099d6e86964a0291f429015237d84d196e890b16a6f3e8d179
7
+ data.tar.gz: c68842cd687f2df68df04c07c8e286c37d6aeaad0fc764f9aafa42da7692d5d6e5e860779f0ef5c78866b8037749816104d8ace810204e0ed6fa61d7eeb53565
data/README.md CHANGED
@@ -88,7 +88,8 @@ For additional details about any of the commands, see the [API docs](http://api-
88
88
  heroku.put_dynos(APP, DYNOS) # set number of dynos for bamboo app APP to DYNOS
89
89
  heroku.put_workers(APP, WORKERS) # set number of workers for bamboo app APP to WORKERS
90
90
  heroku.post_ps_scale(APP, 'worker', WORKERS) # set number of workers for cedar app APP to WORKERS
91
-
91
+ heroku.put_formation(APP, 'web' => '2X') # set dyno size to '2X' for all 'web' processes for APP app
92
+
92
93
  ### Releases
93
94
 
94
95
  heroku.get_releases(APP) # list of releases for the APP app
data/changelog.txt CHANGED
@@ -1,3 +1,9 @@
1
+ 0.3.12 06/11/2013
2
+ =================
3
+
4
+ add put_formation
5
+ bump excon dep
6
+
1
7
  0.3.11 05/21/2013
2
8
  =================
3
9
 
data/heroku-api.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_runtime_dependency 'excon', '~>0.22.1'
19
+ s.add_runtime_dependency 'excon', '~>0.23.0'
20
20
 
21
21
  s.add_development_dependency 'minitest'
22
22
  s.add_development_dependency 'rake'
data/lib/heroku/api.rb CHANGED
@@ -93,15 +93,14 @@ module Heroku
93
93
  else Heroku::API::Errors::ErrorWithResponse
94
94
  end
95
95
 
96
+ decompress_response!(error.response)
96
97
  reerror = klass.new(error.message, error.response)
97
98
  reerror.set_backtrace(error.backtrace)
98
99
  raise(reerror)
99
100
  end
100
101
 
101
102
  if response.body && !response.body.empty?
102
- if response.headers['Content-Encoding'] == 'gzip'
103
- response.body = Zlib::GzipReader.new(StringIO.new(response.body)).read
104
- end
103
+ decompress_response!(response)
105
104
  begin
106
105
  response.body = Heroku::API::OkJson.decode(response.body)
107
106
  rescue
@@ -117,6 +116,11 @@ module Heroku
117
116
 
118
117
  private
119
118
 
119
+ def decompress_response!(response)
120
+ return unless response.headers['Content-Encoding'] == 'gzip'
121
+ response.body = Zlib::GzipReader.new(StringIO.new(response.body)).read
122
+ end
123
+
120
124
  def app_params(params)
121
125
  app_params = {}
122
126
  params.each do |key, value|
@@ -193,6 +193,22 @@ module Heroku
193
193
  end
194
194
  end
195
195
 
196
+ # stub PUT /apps/:app/formation
197
+ Excon.stub(:expects => 200, :method => :put, :path => %r{^/apps/([^/]+)/formation}) do |params|
198
+ request_params, mock_data = parse_stub_params(params)
199
+ app, _ = request_params[:captures][:path]
200
+ with_mock_app(mock_data, app) do
201
+ new_resize_vars = request_params[:body]
202
+ process = mock_data[:ps][app].first["process"].split('.')[0]
203
+ size = new_resize_vars[process]["size"][/(\d+)/]
204
+ mock_data[:ps][app].first.merge!({'size' => size})
205
+ {
206
+ :body => Heroku::API::OkJson.encode(get_mock_processes(mock_data, app)),
207
+ :status => 200
208
+ }
209
+ end
210
+ end
211
+
196
212
  end
197
213
  end
198
214
  end
@@ -73,5 +73,17 @@ module Heroku
73
73
  :query => {'workers' => workers}
74
74
  )
75
75
  end
76
+
77
+ # PUT /apps/:app/formation
78
+ def put_formation(app, options)
79
+ options.each { |process, size| options[process] = {'size' => size} }
80
+ request(
81
+ :body => Heroku::API::OkJson.encode(options),
82
+ :expects => 200,
83
+ :method => :put,
84
+ :path => "/apps/#{app}/formation"
85
+ )
86
+ end
87
+
76
88
  end
77
89
  end
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.3.11"
3
+ VERSION = "0.3.12"
4
4
  end
5
5
  end
data/test/test_addons.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestAddons < MiniTest::Unit::TestCase
3
+ class TestAddons < Minitest::Test
4
4
 
5
5
  def test_delete_addon_addon_not_found
6
6
  with_app do |app_data|
data/test/test_apps.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestApps < MiniTest::Unit::TestCase
3
+ class TestApps < Minitest::Test
4
4
 
5
5
  def test_delete_app
6
6
  with_app do |app_data|
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestAttachments < MiniTest::Unit::TestCase
3
+ class TestAttachments < Minitest::Test
4
4
 
5
5
  def test_get_attachments
6
6
  with_app do |app_data|
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestCollaborators < MiniTest::Unit::TestCase
3
+ class TestCollaborators < Minitest::Test
4
4
 
5
5
  def test_delete_collaborator
6
6
  with_app do |app_data|
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestConfigVars < MiniTest::Unit::TestCase
3
+ class TestConfigVars < Minitest::Test
4
4
 
5
5
  def test_delete_app_config_var
6
6
  with_app('stack' => 'cedar') do |app_data|
data/test/test_domains.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestDomains < MiniTest::Unit::TestCase
3
+ class TestDomains < Minitest::Test
4
4
 
5
5
  def test_delete_domain_app_not_found
6
6
  assert_raises(Heroku::API::Errors::NotFound) do
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestErrorConditions < MiniTest::Unit::TestCase
3
+ class TestErrorConditions < Minitest::Test
4
4
 
5
5
  def test_request_without_app_returns_a_sensible_error
6
6
  assert_raises(Heroku::API::Errors::NilApp) do
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestFeatures < MiniTest::Unit::TestCase
3
+ class TestFeatures < Minitest::Test
4
4
 
5
5
  def setup
6
6
  @feature_data ||= begin
data/test/test_keys.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestKeys < MiniTest::Unit::TestCase
3
+ class TestKeys < Minitest::Test
4
4
  KEY_DATA = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz29znMi/UJX/nvkRSO5FFugKhU9DkkI53E0vXUnP8zeLFxMgyUqmXryPVjWtGzz2LRWqjm14SbqHAmM44pGHVfBIp6wCKBWSUYGv/FxOulwYgtWzz4moxWLZrFyWWgJAnehcVUifHNgzKwT2ovWm2ns52681Z8yFK3K8/uLStDjLIaPePEOaxaTvgIxZNsfyEoXoHcyTPwdR1GtQuDTuDYqYmjmPCoKybYnXrTQ1QFuQxDneBkswQYSl0H2aLf3uBK4F01hr+azXQuSe39eSV4I/TqzmNJlanpILT9Jz3/J1i4r6brpF3AxLnFnb9ufIbzQAIa/VZIulfrZkcBsUl david@carbon.local"
5
5
 
6
6
  def test_delete_key_key_not_found
data/test/test_login.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestLogin < MiniTest::Unit::TestCase
3
+ class TestLogin < Minitest::Test
4
4
 
5
5
  def test_post_login
6
6
  # FIXME: user/pass will only work in mock for now, maybe use ENV
data/test/test_logs.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestLogs < MiniTest::Unit::TestCase
3
+ class TestLogs < Minitest::Test
4
4
 
5
5
  def test_get_logs
6
6
  with_app do |app_data|
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestProcesses < MiniTest::Unit::TestCase
3
+ class TestProcesses < Minitest::Test
4
4
 
5
5
  def test_get_ps
6
6
  with_app do |app_data|
@@ -242,4 +242,14 @@ class TestProcesses < MiniTest::Unit::TestCase
242
242
  end
243
243
  end
244
244
 
245
+ def test_put_formation
246
+ with_app do |app_data|
247
+ response = heroku.put_formation(app_data['name'], {"web" => "2X"})
248
+ ps = response.body.first
249
+
250
+ assert_equal(200, response.status)
251
+ assert_equal('2', ps['size'])
252
+ end
253
+ end
254
+
245
255
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestReleases < MiniTest::Unit::TestCase
3
+ class TestReleases < Minitest::Test
4
4
 
5
5
  def test_get_releases
6
6
  with_app do |app_data|
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestSslEndpoints < MiniTest::Unit::TestCase
3
+ class TestSslEndpoints < Minitest::Test
4
4
 
5
5
  def test_delete_ssl_endpoint
6
6
  skip if MOCK
data/test/test_stacks.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestStacks < MiniTest::Unit::TestCase
3
+ class TestStacks < Minitest::Test
4
4
 
5
5
  def test_get_stack
6
6
  with_app do |app_data|
data/test/test_user.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
- class TestUser < MiniTest::Unit::TestCase
3
+ class TestUser < Minitest::Test
4
4
 
5
5
  def test_get_user
6
6
  response = heroku.get_user
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
5
- prerelease:
4
+ version: 0.3.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - geemus (Wesley Beary)
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2013-06-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: excon
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.22.1
19
+ version: 0.23.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 0.22.1
26
+ version: 0.23.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Ruby Client for the Heroku API
@@ -132,27 +125,26 @@ files:
132
125
  - test/test_user.rb
133
126
  homepage: http://github.com/heroku/heroku.rb
134
127
  licenses: []
128
+ metadata: {}
135
129
  post_install_message:
136
130
  rdoc_options: []
137
131
  require_paths:
138
132
  - lib
139
133
  required_ruby_version: !ruby/object:Gem::Requirement
140
- none: false
141
134
  requirements:
142
- - - ! '>='
135
+ - - '>='
143
136
  - !ruby/object:Gem::Version
144
137
  version: '0'
145
138
  required_rubygems_version: !ruby/object:Gem::Requirement
146
- none: false
147
139
  requirements:
148
- - - ! '>='
140
+ - - '>='
149
141
  - !ruby/object:Gem::Version
150
142
  version: '0'
151
143
  requirements: []
152
144
  rubyforge_project:
153
- rubygems_version: 1.8.23
145
+ rubygems_version: 2.0.3
154
146
  signing_key:
155
- specification_version: 3
147
+ specification_version: 4
156
148
  summary: Ruby Client for the Heroku API
157
149
  test_files:
158
150
  - test/data/site.crt