addons-client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,16 +12,15 @@ module Addons
12
12
  wrap_request do
13
13
  addon_name, plan = slug.split(':')
14
14
  raise UserError, "No add-on name given" unless addon_name
15
- raise UserError, "No plan name given" unless plan
16
15
 
17
16
  if mocked?
18
17
  mocked_provision(addon_name)
19
18
  else
20
19
  payload = {
21
20
  :addon => addon_name,
22
- :plan => plan,
23
21
  :consumer_id => opts[:consumer_id] || DEFAULT_CONSUMER_ID
24
22
  }
23
+ payload.merge! :plan => plan if plan
25
24
  payload.merge! :options => opts[:options] if opts[:options]
26
25
  payload.merge! :rate => opts[:rate] if opts[:rate]
27
26
  payload.merge! :addons_id => opts[:addons_id] if opts[:addons_id]
@@ -1,5 +1,5 @@
1
1
  module Addons
2
2
  class Client
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -40,13 +40,13 @@ class PlanChangeTest < Addons::Client::TestCase
40
40
 
41
41
  def test_cmd_line_requires_resource_id
42
42
  assert_raises Addons::UserError, "Must supply resource id" do
43
- addons_client! "provision"
43
+ addons_client! "plan-change"
44
44
  end
45
45
  end
46
46
 
47
47
  def test_cmd_line_requires_plan_name
48
48
  assert_raises Addons::UserError, "Must supply plan after resource id" do
49
- addons_client! "provision ABC-123"
49
+ addons_client! "plan-change ABC-123"
50
50
  end
51
51
  end
52
52
 
@@ -17,10 +17,11 @@ class ProvisionTest < Addons::Client::TestCase
17
17
  end
18
18
  end
19
19
 
20
- def test_cmd_line_requires_plan
21
- assert_raises Addons::UserError, "No plan name given" do
22
- addons_client! "provision foo"
23
- end
20
+ def test_cmd_line_doesnt_require_plan
21
+ addons_client! "provision foo"
22
+ assert_requested(:post, target_url,
23
+ :body => { :addon => 'foo',
24
+ :consumer_id => 'api-client@localhost'})
24
25
  end
25
26
 
26
27
  def test_provisions_from_cmd_line
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addons-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-23 00:00:00.000000000Z
13
+ date: 2012-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
17
- requirement: &70283802755900 !ruby/object:Gem::Requirement
17
+ requirement: &70319713811360 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70283802755900
25
+ version_requirements: *70319713811360
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: configliere
28
- requirement: &70283802755480 !ruby/object:Gem::Requirement
28
+ requirement: &70319713810520 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70283802755480
36
+ version_requirements: *70319713810520
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: json
39
- requirement: &70283802755060 !ruby/object:Gem::Requirement
39
+ requirement: &70319713809040 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70283802755060
47
+ version_requirements: *70319713809040
48
48
  description: Addons Platform API client
49
49
  email:
50
50
  - csquared@gmail.com
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: -3382691232764267139
92
+ hash: -920029003357087713
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: -3382691232764267139
101
+ hash: -920029003357087713
102
102
  requirements: []
103
103
  rubyforge_project:
104
104
  rubygems_version: 1.8.15