right_api_client 1.5.9 → 1.5.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/{CHANGELOG.rdoc → CHANGELOG.md} +14 -1
- data/Gemfile +1 -1
- data/{README.rdoc → README.md} +97 -58
- data/config/login.yml.example +9 -4
- data/lib/right_api_client/client.rb +196 -51
- data/lib/right_api_client/errors.rb +30 -0
- data/lib/right_api_client/helper.rb +67 -6
- data/lib/right_api_client/resource.rb +7 -8
- data/lib/right_api_client/resource_detail.rb +14 -10
- data/lib/right_api_client/resources.rb +7 -8
- data/lib/right_api_client/version.rb +1 -1
- data/login_to_client_irb.rb +1 -2
- data/right_api_client.gemspec +17 -17
- data/right_api_client.rconf +1 -1
- data/spec/{audit_entries_spec.rb → functional/audit_entries_spec.rb} +2 -4
- data/spec/{client_spec.rb → functional/client_spec.rb} +85 -12
- data/spec/spec_helper.rb +16 -34
- data/spec/support/mock_spec_helper.rb +36 -0
- data/spec/unit/helper_spec.rb +78 -0
- data/spec/{instance_facing_spec.rb → unit/instance_facing_spec.rb} +6 -7
- data/spec/{resource_detail_spec.rb → unit/resource_detail_spec.rb} +8 -9
- data/spec/unit/resource_spec.rb +24 -0
- data/spec/unit/resources_spec.rb +27 -0
- metadata +49 -46
- data/lib/right_api_client/exceptions.rb +0 -15
- data/spec/resource_spec.rb +0 -25
- data/spec/resources_spec.rb +0 -25
@@ -1,15 +0,0 @@
|
|
1
|
-
module RightApi
|
2
|
-
module Exceptions
|
3
|
-
class ApiException < RuntimeError
|
4
|
-
def initialize(message="")
|
5
|
-
super("Error: #{message}")
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class UnknownRouteException < ApiException
|
10
|
-
def initialize(message="")
|
11
|
-
super("Unknown action or route. #{message}")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/resource_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', __FILE__)
|
2
|
-
include MockSpecHelper
|
3
|
-
|
4
|
-
describe RightApi::Resource do
|
5
|
-
context "Given a logged in RightScale user" do
|
6
|
-
before(:each) do
|
7
|
-
given_user_facing_client
|
8
|
-
end
|
9
|
-
|
10
|
-
it "Should have the required methods for instances of the Resource class" do
|
11
|
-
resource = RightApi::Resource.process(@client, 'deployment', '/api/deployments/1')
|
12
|
-
resource.api_methods.sort.collect{|s| s.to_s}.should == ["destroy", "show", "update"]
|
13
|
-
end
|
14
|
-
|
15
|
-
it "Should have destroy/show/update for all instances of the Resource class" do
|
16
|
-
resource = RightApi::Resource.process(@client, 'session', '/api/session')
|
17
|
-
resource.api_methods.sort.should == [:destroy, :show, :update]
|
18
|
-
end
|
19
|
-
|
20
|
-
it "Should have an array of ResourceDetail instances for index calls" do
|
21
|
-
resources = RightApi::Resource.process(@client, 'deployment', '/api/deployments', [{}])
|
22
|
-
resources.first.class.should == RightApi::ResourceDetail
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/resources_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', __FILE__)
|
2
|
-
include MockSpecHelper
|
3
|
-
|
4
|
-
describe RightApi::Resources do
|
5
|
-
context "Given a logged in RightScale user" do
|
6
|
-
before(:each) do
|
7
|
-
given_user_facing_client
|
8
|
-
end
|
9
|
-
|
10
|
-
it "Should have the required methods for instances of the Resources class" do
|
11
|
-
resource = RightApi::Resources.new(@client, '/api/deployments', 'deployments')
|
12
|
-
resource.api_methods.sort.collect{|s| s.to_s}.should == ["create", "index"]
|
13
|
-
end
|
14
|
-
|
15
|
-
it "Should have index even for instances of the Resources class that do not support it" do
|
16
|
-
resource = RightApi::Resources.new(@client, '/api/tags', 'tags')
|
17
|
-
resource.api_methods.sort.collect{|s| s.to_s}.should == ["by_resource", "by_tag", "create", "index", "multi_add", "multi_delete"]
|
18
|
-
end
|
19
|
-
|
20
|
-
it "Should have resource-specific methods for instances of the Resources class" do
|
21
|
-
resource = RightApi::Resources.new(@client, '/api/backups', 'backups')
|
22
|
-
resource.api_methods.sort.collect{|s| s.to_s}.should == ["cleanup", "create", "index"]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|