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.
@@ -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
@@ -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
@@ -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