heroku-api 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/changelog.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 0.2.5 06/13/2012
2
+ ================
3
+
4
+ make post_release release param optional (defaults to latest)
5
+ fix for contructing addon_params
6
+ fail gracefully on non-http-status errors
7
+
1
8
  0.2.4 05/31/2012
2
9
  ================
3
10
 
@@ -20,7 +20,7 @@ module Heroku
20
20
  end
21
21
 
22
22
  # POST /apps/:app/releases/:release
23
- def post_release(app, release)
23
+ def post_release(app, release=nil)
24
24
  request(
25
25
  :expects => 200,
26
26
  :method => :post,
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
data/lib/heroku/api.rb CHANGED
@@ -58,9 +58,7 @@ module Heroku
58
58
  def request(params, &block)
59
59
  begin
60
60
  response = @connection.request(params, &block)
61
- rescue Excon::Errors::SocketError => error
62
- raise error
63
- rescue Excon::Errors::Error => error
61
+ rescue Excon::Errors::HTTPStatusError => error
64
62
  klass = case error.response.status
65
63
  when 401 then Heroku::API::Errors::Unauthorized
66
64
  when 402 then Heroku::API::Errors::VerificationRequired
@@ -106,7 +104,10 @@ module Heroku
106
104
  end
107
105
 
108
106
  def addon_params(params)
109
- {:config => params}
107
+ params.inject({}) do |accum, (key, value)|
108
+ accum["config[#{key}]"] = value
109
+ accum
110
+ end
110
111
  end
111
112
 
112
113
  def ps_options(params)
data/test/test_addons.rb CHANGED
@@ -101,6 +101,18 @@ class TestAddons < MiniTest::Unit::TestCase
101
101
  end
102
102
  end
103
103
 
104
+ def test_post_add_on_with_config_parses_config_correctly
105
+ with_app do |app_data|
106
+ addon_post_path = "/apps/#{app_data['name']}/addons/deployhooks:http"
107
+ Excon.stub({:method => :post, :path => addon_post_path}) do |params|
108
+ {:body => params[:query], :status => 200}
109
+ end
110
+ response = heroku.post_addon(app_data['name'], 'deployhooks:http', {"url"=>"http://example.com"})
111
+ assert_equal({ "config[url]" => "http://example.com"}, response.body)
112
+ end
113
+ Excon.stubs.shift
114
+ end
115
+
104
116
  def test_post_addon_addon_already_installed
105
117
  with_app do |app_data|
106
118
  assert_raises(Heroku::API::Errors::RequestFailed) do
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.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-31 00:00:00.000000000 Z
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
16
- requirement: &70256555193800 !ruby/object:Gem::Requirement
16
+ requirement: &70106232313520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70256555193800
24
+ version_requirements: *70106232313520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70256555193240 !ruby/object:Gem::Requirement
27
+ requirement: &70106232312560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70256555193240
35
+ version_requirements: *70106232312560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70256555192640 !ruby/object:Gem::Requirement
38
+ requirement: &70106232311820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70256555192640
46
+ version_requirements: *70106232311820
47
47
  description: Ruby Client for the Heroku API
48
48
  email:
49
49
  - wesley@heroku.com
@@ -119,12 +119,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  - - ! '>='
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
+ segments:
123
+ - 0
124
+ hash: -1608937311142232836
122
125
  required_rubygems_version: !ruby/object:Gem::Requirement
123
126
  none: false
124
127
  requirements:
125
128
  - - ! '>='
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
131
+ segments:
132
+ - 0
133
+ hash: -1608937311142232836
128
134
  requirements: []
129
135
  rubyforge_project:
130
136
  rubygems_version: 1.8.15