heroku-api 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ 0.1.4 05/09/2012
2
+ ================
3
+
4
+ # add DELETE /domains
5
+ # add POST /login
6
+
1
7
  0.1.3 05/03/2012
2
8
  ================
3
9
 
@@ -22,6 +22,7 @@ require "heroku/api/collaborators"
22
22
  require "heroku/api/config_vars"
23
23
  require "heroku/api/domains"
24
24
  require "heroku/api/keys"
25
+ require "heroku/api/login"
25
26
  require "heroku/api/logs"
26
27
  require "heroku/api/processes"
27
28
  require "heroku/api/releases"
@@ -10,6 +10,15 @@ module Heroku
10
10
  )
11
11
  end
12
12
 
13
+ # DELETE /apps/:app/domains
14
+ def delete_domains(app)
15
+ request(
16
+ :expects => 200,
17
+ :method => :delete,
18
+ :path => "/apps/#{app}/domains"
19
+ )
20
+ end
21
+
13
22
  # GET /apps/:app/domains
14
23
  def get_domains(app)
15
24
  request(
@@ -0,0 +1,14 @@
1
+ module Heroku
2
+ class API
3
+
4
+ def post_login(username, password)
5
+ request(
6
+ :expects => 200,
7
+ :method => :post,
8
+ :path => '/login',
9
+ :query => { 'username' => username, 'password' => password }
10
+ )
11
+ end
12
+
13
+ end
14
+ end
@@ -4,6 +4,7 @@ require 'heroku/api/mock/collaborators'
4
4
  require 'heroku/api/mock/config_vars'
5
5
  require 'heroku/api/mock/domains'
6
6
  require 'heroku/api/mock/keys'
7
+ require 'heroku/api/mock/login'
7
8
  require 'heroku/api/mock/logs'
8
9
  require 'heroku/api/mock/processes'
9
10
  require 'heroku/api/mock/releases'
@@ -23,6 +23,19 @@ module Heroku
23
23
  end
24
24
  end
25
25
 
26
+ # stub DELETE /apps/:app/domains/:domain
27
+ Excon.stub(:expects => 200, :method => :delete, :path => %r{^/apps/([^/]+)/domains$} ) do |params|
28
+ request_params, mock_data = parse_stub_params(params)
29
+ app, _ = request_params[:captures][:path]
30
+ with_mock_app(mock_data, app) do |app_data|
31
+ mock_data[:domains][app] = []
32
+ {
33
+ :body => "",
34
+ :status => 200
35
+ }
36
+ end
37
+ end
38
+
26
39
  # stub GET /apps/:app/domains
27
40
  Excon.stub(:expects => 200, :method => :get, :path => %r{^/apps/([^/]+)/domains$} ) do |params|
28
41
  request_params, mock_data = parse_stub_params(params)
@@ -0,0 +1,22 @@
1
+ module Heroku
2
+ class API
3
+ module Mock
4
+
5
+ # stub POST /login
6
+ Excon.stub(:expects => 200, :method => :post, :path => '/login') do |params|
7
+ request_params, mock_data = parse_stub_params(params)
8
+ {
9
+ :body => {
10
+ 'api_key' => SecureRandom.hex(20),
11
+ 'email' => 'email@example.com',
12
+ 'id' => '123456@users.heroku.com',
13
+ 'verified' => true,
14
+ 'verified_at' => timestamp
15
+ },
16
+ :status => 200
17
+ }
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -19,6 +19,17 @@ class TestDomains < MiniTest::Unit::TestCase
19
19
  end
20
20
  end
21
21
 
22
+ def test_delete_domains
23
+ with_app do |app_data|
24
+ heroku.post_addon(app_data['name'], 'custom_domains:basic')
25
+ heroku.post_domain(app_data['name'], 'example.com')
26
+ response = heroku.delete_domains(app_data['name'])
27
+
28
+ assert_equal(200, response.status)
29
+ assert_equal("", response.body)
30
+ end
31
+ end
32
+
22
33
  def test_get_domains
23
34
  with_app do |app_data|
24
35
  response = heroku.get_domains(app_data['name'])
@@ -0,0 +1,12 @@
1
+ require "#{File.dirname(__FILE__)}/test_helper"
2
+
3
+ class TestLogin < MiniTest::Unit::TestCase
4
+
5
+ def test_post_login
6
+ # FIXME: user/pass will only work in mock for now, maybe use ENV
7
+ response = heroku.post_login('email@example.com', 'fake_password')
8
+
9
+ assert_equal(200, response.status)
10
+ end
11
+
12
+ 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.1.3
4
+ version: 0.1.4
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-03 00:00:00.000000000 Z
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
16
- requirement: &70122010935080 !ruby/object:Gem::Requirement
16
+ requirement: &70151743651300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.13.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70122010935080
24
+ version_requirements: *70151743651300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70122010934400 !ruby/object:Gem::Requirement
27
+ requirement: &70151743650600 !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: *70122010934400
35
+ version_requirements: *70151743650600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70122010933620 !ruby/object:Gem::Requirement
38
+ requirement: &70151743649800 !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: *70122010933620
46
+ version_requirements: *70151743649800
47
47
  description: Ruby Client for the Heroku API
48
48
  email:
49
49
  - wesley@heroku.com
@@ -67,6 +67,7 @@ files:
67
67
  - lib/heroku/api/domains.rb
68
68
  - lib/heroku/api/errors.rb
69
69
  - lib/heroku/api/keys.rb
70
+ - lib/heroku/api/login.rb
70
71
  - lib/heroku/api/logs.rb
71
72
  - lib/heroku/api/mock.rb
72
73
  - lib/heroku/api/mock/addons.rb
@@ -77,6 +78,7 @@ files:
77
78
  - lib/heroku/api/mock/config_vars.rb
78
79
  - lib/heroku/api/mock/domains.rb
79
80
  - lib/heroku/api/mock/keys.rb
81
+ - lib/heroku/api/mock/login.rb
80
82
  - lib/heroku/api/mock/logs.rb
81
83
  - lib/heroku/api/mock/processes.rb
82
84
  - lib/heroku/api/mock/releases.rb
@@ -95,6 +97,7 @@ files:
95
97
  - test/test_domains.rb
96
98
  - test/test_helper.rb
97
99
  - test/test_keys.rb
100
+ - test/test_login.rb
98
101
  - test/test_logs.rb
99
102
  - test/test_processes.rb
100
103
  - test/test_releases.rb
@@ -132,6 +135,7 @@ test_files:
132
135
  - test/test_domains.rb
133
136
  - test/test_helper.rb
134
137
  - test/test_keys.rb
138
+ - test/test_login.rb
135
139
  - test/test_logs.rb
136
140
  - test/test_processes.rb
137
141
  - test/test_releases.rb