heroku-api 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +8 -2
- data/lib/heroku/api.rb +1 -0
- data/lib/heroku/api/attachments.rb +14 -0
- data/lib/heroku/api/features.rb +1 -1
- data/lib/heroku/api/mock.rb +2 -0
- data/lib/heroku/api/mock/apps.rb +2 -0
- data/lib/heroku/api/mock/attachments.rb +19 -0
- data/lib/heroku/api/mock/features.rb +15 -5
- data/lib/heroku/api/version.rb +1 -1
- data/test/test_attachments.rb +23 -0
- data/test/test_features.rb +1 -1
- metadata +14 -10
data/changelog.txt
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5 09/11/2012
|
2
|
+
================
|
3
|
+
|
4
|
+
add get_attachments and mocks
|
5
|
+
update enable features usage and mocks to use 200/201 based on update/create
|
6
|
+
|
7
|
+
0.3.4 08/15/2012
|
2
8
|
================
|
3
9
|
|
4
10
|
update excon to get SSLv3 fix
|
5
11
|
|
6
|
-
0.3.3
|
12
|
+
0.3.3 08/15/2012
|
7
13
|
================
|
8
14
|
|
9
15
|
update to more realistic self signed cert in tests
|
data/lib/heroku/api.rb
CHANGED
data/lib/heroku/api/features.rb
CHANGED
data/lib/heroku/api/mock.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'heroku/api/mock/addons'
|
2
2
|
require 'heroku/api/mock/apps'
|
3
|
+
require 'heroku/api/mock/attachments'
|
3
4
|
require 'heroku/api/mock/collaborators'
|
4
5
|
require 'heroku/api/mock/config_vars'
|
5
6
|
require 'heroku/api/mock/domains'
|
@@ -23,6 +24,7 @@ module Heroku
|
|
23
24
|
hash[key] = {
|
24
25
|
:addons => {},
|
25
26
|
:apps => [],
|
27
|
+
:attachments => {},
|
26
28
|
:collaborators => {},
|
27
29
|
:config_vars => {},
|
28
30
|
:domains => {},
|
data/lib/heroku/api/mock/apps.rb
CHANGED
@@ -9,6 +9,7 @@ module Heroku
|
|
9
9
|
with_mock_app(mock_data, app) do |app_data|
|
10
10
|
mock_data[:addons].delete(app)
|
11
11
|
mock_data[:apps].delete(app_data)
|
12
|
+
mock_data[:attachments].delete(app)
|
12
13
|
mock_data[:collaborators].delete(app)
|
13
14
|
mock_data[:config_vars].delete(app)
|
14
15
|
mock_data[:domains].delete(app)
|
@@ -88,6 +89,7 @@ module Heroku
|
|
88
89
|
|
89
90
|
mock_data[:addons][app] = []
|
90
91
|
mock_data[:apps] << app_data
|
92
|
+
mock_data[:attachments][app] = []
|
91
93
|
mock_data[:collaborators][app] = [{
|
92
94
|
'access' => 'edit',
|
93
95
|
'email' => 'email@example.com',
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Heroku
|
2
|
+
class API
|
3
|
+
module Mock
|
4
|
+
|
5
|
+
# stub GET /apps/:app/attachments
|
6
|
+
Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/attachments}) do |params|
|
7
|
+
request_params, mock_data = parse_stub_params(params)
|
8
|
+
app, _ = request_params[:captures][:path]
|
9
|
+
with_mock_app(mock_data, app) do
|
10
|
+
{
|
11
|
+
:body => Heroku::API::OkJson.encode(mock_data[:attachments][app]),
|
12
|
+
:status => 200
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -69,7 +69,7 @@ module Heroku
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# stub POST /features/:feature
|
72
|
-
Excon.stub(:expects => 200, :method => :post, :path => %r{^/features/([^/]+)$}) do |params|
|
72
|
+
Excon.stub(:expects => [200, 201], :method => :post, :path => %r{^/features/([^/]+)$}) do |params|
|
73
73
|
request_params, mock_data = parse_stub_params(params)
|
74
74
|
app = request_params[:query].has_key?('app') && request_params[:query]['app']
|
75
75
|
feature, _ = request_params[:captures][:path]
|
@@ -80,16 +80,26 @@ module Heroku
|
|
80
80
|
# feature exists
|
81
81
|
case feature_data['kind']
|
82
82
|
when 'app'
|
83
|
-
mock_data[:features][:app][app]
|
83
|
+
status = if mock_data[:features][:app][app].include?(feature_data)
|
84
|
+
200
|
85
|
+
else
|
86
|
+
mock_data[:features][:app][app] << feature_data
|
87
|
+
201
|
88
|
+
end
|
84
89
|
{
|
85
90
|
:body => Heroku::API::OkJson.encode(feature_data),
|
86
|
-
:status =>
|
91
|
+
:status => status
|
87
92
|
}
|
88
93
|
when 'user'
|
89
|
-
mock_data[:features][:user]
|
94
|
+
status = if mock_data[:features][:user].include(feature_data)
|
95
|
+
200
|
96
|
+
else
|
97
|
+
mock_data[:features][:user] << feature_data
|
98
|
+
201
|
99
|
+
end
|
90
100
|
{
|
91
101
|
:body => '',
|
92
|
-
:status =>
|
102
|
+
:status => status
|
93
103
|
}
|
94
104
|
end
|
95
105
|
else
|
data/lib/heroku/api/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
|
+
|
3
|
+
class TestAttachments < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def test_get_attachments
|
6
|
+
with_app do |app_data|
|
7
|
+
response = heroku.get_attachments(app_data['name'])
|
8
|
+
|
9
|
+
assert_equal(200, response.status)
|
10
|
+
assert_equal(
|
11
|
+
[],
|
12
|
+
response.body
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_attachments_app_not_found
|
18
|
+
assert_raises(Heroku::API::Errors::NotFound) do
|
19
|
+
heroku.get_attachments(random_name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/test/test_features.rb
CHANGED
@@ -65,7 +65,7 @@ class TestFeatures < MiniTest::Unit::TestCase
|
|
65
65
|
with_app do |app_data|
|
66
66
|
response = heroku.post_feature('user_env_compile', app_data['name'])
|
67
67
|
|
68
|
-
assert_equal(
|
68
|
+
assert_equal(201, response.status)
|
69
69
|
assert_equal(@feature_data.merge('enabled' => true), response.body)
|
70
70
|
end
|
71
71
|
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.
|
4
|
+
version: 0.3.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-
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
16
|
-
requirement: &
|
16
|
+
requirement: &70278785472920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.16.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70278785472920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70278785471860 !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: *
|
35
|
+
version_requirements: *70278785471860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70278785471240 !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: *
|
46
|
+
version_requirements: *70278785471240
|
47
47
|
description: Ruby Client for the Heroku API
|
48
48
|
email:
|
49
49
|
- wesley@heroku.com
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/heroku/api.rb
|
63
63
|
- lib/heroku/api/addons.rb
|
64
64
|
- lib/heroku/api/apps.rb
|
65
|
+
- lib/heroku/api/attachments.rb
|
65
66
|
- lib/heroku/api/collaborators.rb
|
66
67
|
- lib/heroku/api/config_vars.rb
|
67
68
|
- lib/heroku/api/domains.rb
|
@@ -73,6 +74,7 @@ files:
|
|
73
74
|
- lib/heroku/api/mock.rb
|
74
75
|
- lib/heroku/api/mock/addons.rb
|
75
76
|
- lib/heroku/api/mock/apps.rb
|
77
|
+
- lib/heroku/api/mock/attachments.rb
|
76
78
|
- lib/heroku/api/mock/cache/get_addons.json
|
77
79
|
- lib/heroku/api/mock/cache/get_features.json
|
78
80
|
- lib/heroku/api/mock/cache/get_user.json
|
@@ -98,6 +100,7 @@ files:
|
|
98
100
|
- test/data/site.key
|
99
101
|
- test/test_addons.rb
|
100
102
|
- test/test_apps.rb
|
103
|
+
- test/test_attachments.rb
|
101
104
|
- test/test_collaborators.rb
|
102
105
|
- test/test_config_vars.rb
|
103
106
|
- test/test_domains.rb
|
@@ -125,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
128
|
version: '0'
|
126
129
|
segments:
|
127
130
|
- 0
|
128
|
-
hash:
|
131
|
+
hash: 3188437513510408421
|
129
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
133
|
none: false
|
131
134
|
requirements:
|
@@ -134,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
137
|
version: '0'
|
135
138
|
segments:
|
136
139
|
- 0
|
137
|
-
hash:
|
140
|
+
hash: 3188437513510408421
|
138
141
|
requirements: []
|
139
142
|
rubyforge_project:
|
140
143
|
rubygems_version: 1.8.15
|
@@ -146,6 +149,7 @@ test_files:
|
|
146
149
|
- test/data/site.key
|
147
150
|
- test/test_addons.rb
|
148
151
|
- test/test_apps.rb
|
152
|
+
- test/test_attachments.rb
|
149
153
|
- test/test_collaborators.rb
|
150
154
|
- test/test_config_vars.rb
|
151
155
|
- test/test_domains.rb
|