right_api_client 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,8 @@
1
1
  = right_api_client - CHANGELOG.rdoc
2
2
 
3
3
 
4
+ == right_api_client - 1.5.2
5
+ Fix issues with client when using Ruby 1.8.7 (note that right_api_client has not been fully tested with 1.8.7 yet).
6
+
4
7
  == right_api_client - 1.5.1
5
8
  Initial public release, supports all of the calls in RightScale API 1.5.
@@ -195,7 +195,7 @@ module RightApi
195
195
  # Generic delete
196
196
  def do_delete(path)
197
197
  begin
198
- @rest_client[path].delete(headers) do |response|
198
+ @rest_client[path].delete(headers) do |response, request, result|
199
199
  case response.code
200
200
  when 200, 204
201
201
  else
@@ -215,7 +215,7 @@ module RightApi
215
215
  # Generic put
216
216
  def do_put(path, params={})
217
217
  begin
218
- @rest_client[path].put(params, headers) do |response|
218
+ @rest_client[path].put(params, headers) do |response, request, result|
219
219
  case response.code
220
220
  when 204
221
221
  else
@@ -2,7 +2,7 @@
2
2
  module RightApi
3
3
  class Client
4
4
  API_VERSION = '1.5'
5
- CLIENT_VERSION = '1'
5
+ CLIENT_VERSION = '2'
6
6
  VERSION = "#{API_VERSION}.#{CLIENT_VERSION}"
7
7
  end
8
8
  end
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.date = Time.now.utc.strftime("%Y-%m-%d")
8
8
  s.require_path = 'lib'
9
- s.authors = [ 'Ali Khajeh-Hosseini' ]
10
- s.email = [ 'alikhajeh1@gmail.com' ]
9
+ s.authors = [ 'Ali Khajeh-Hosseini, Natalie Schauser, Nagender Paduru' ]
10
+ s.email = [ 'ali@rightscale.com' ]
11
11
  s.homepage = 'https://github.com/rightscale/right_api_client'
12
12
  s.summary = 'RightScale MultiCloud API HTTP Client'
13
13
  s.description = %{
@@ -25,7 +25,6 @@ in making HTTP calls and translating their responses.
25
25
  s.add_development_dependency 'rake', '0.8.7'
26
26
  s.add_development_dependency 'rspec', '1.3.0'
27
27
  s.add_development_dependency 'flexmock', '0.8.7'
28
- s.add_development_dependency 'ruby-debug19', '0.11.6'
29
28
  s.add_development_dependency 'simplecov', '0.4.2'
30
29
  s.add_development_dependency 'bundler'
31
30
  end
@@ -18,16 +18,25 @@ describe RightApi::Client do
18
18
  @client.session.index.message.should == 'You have successfully logged into the RightScale API.'
19
19
  end
20
20
 
21
- it "Should return a cookies Hash with a 'domain' and a '_session_id'" do
22
- @client.cookies.class.should == Hash
23
- @client.cookies.keys.sort.should == %w[ _session_id domain rs_gbl ]
21
+ it "Should return valid cookies" do
22
+ @client.cookies.class.should == Hash
23
+ @client.cookies['_session_id'].should_not be_nil
24
+ @client.cookies['domain'].should match /rightscale.com$/
25
+ @client.cookies.keys.sort.last.should match /^rs_gbl/ # HACK: not quite sane sanity check
24
26
  end
25
27
 
26
28
  it "Should accept a cookie argument when creating a new client" do
27
- client1 = RightApi::Client.new(:cookies => @client.cookies)
28
- client2 = RightApi::Client.new(YAML.load_file(File.expand_path(@creds, __FILE__)))
29
+ my_hash = YAML.load_file(File.expand_path(@creds, __FILE__))
30
+ my_hash.delete(:email)
31
+ my_hash.delete(:password)
32
+ my_hash.delete(:cookies)
33
+ my_hash[:cookies] = @client.cookies
34
+ client1 = RightApi::Client.new(my_hash)
35
+ client1.cookies.should == @client.cookies
36
+ end
29
37
 
30
- client1.cookies.should == @client.cookies
38
+ it "Should accept a YAML argument when creating a new client" do
39
+ client2 = RightApi::Client.new(YAML.load_file(File.expand_path(@creds, __FILE__)))
31
40
  client2.cookies.should_not == @client.cookies
32
41
  end
33
42
 
@@ -57,4 +66,4 @@ describe RightApi::Client do
57
66
  new_deployment2.destroy.should be_nil
58
67
  end
59
68
  end
60
- end
69
+ end
@@ -8,7 +8,7 @@ describe RightApi::Client do
8
8
  end
9
9
 
10
10
  it "Should have the required methods for the client" do
11
- @client.api_methods.sort.should == [:backups, :get_instance, :live_tasks, :volume_attachments, :volume_snapshots, :volume_types, :volumes]
11
+ @client.api_methods.sort.collect{|s| s.to_s}.should == ["backups", "get_instance", "live_tasks", "volume_attachments", "volume_snapshots", "volume_types", "volumes"]
12
12
  end
13
13
 
14
14
  it "Should return an instance of the Resource class when user provides an id" do
@@ -9,32 +9,32 @@ describe RightApi::ResourceDetail do
9
9
 
10
10
  it "Should have the required methods for instances of the ResourceDetail class" do
11
11
  resource = RightApi::ResourceDetail.new(@client, 'deployment', '/api/deployments/1', {})
12
- resource.api_methods.sort.should == [:destroy, :links, :show, :update]
12
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["destroy", "links", "show", "update"]
13
13
  end
14
14
 
15
15
  it "Should not have destroy/show/update for instances of the ResourceDetail class that do not support them" do
16
16
  resource = RightApi::ResourceDetail.new(@client, 'session', '/api/session', {})
17
- resource.api_methods.sort.should == [:links]
17
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["links"]
18
18
  end
19
19
 
20
20
  it "Should have resource-specific methods for instances of the ResourceDetail class" do
21
21
  resource = RightApi::ResourceDetail.new(@client, 'deployment', '/api/deployments/1',
22
22
  {:attribute1 => 'value1', :attribute2 => 'value2'})
23
- resource.api_methods.sort.should == [:attribute1, :attribute2, :destroy, :links, :show, :update]
23
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["attribute1", "attribute2", "destroy", "links", "show", "update"]
24
24
  end
25
25
 
26
26
  it "Should have the links for instances of the ResourceDetail class" do
27
27
  resource = RightApi::ResourceDetail.new(@client, 'deployment', '/api/deployments/1',
28
28
  {'links' => [{'rel' => 'link1', 'href' => 'link1_href'},
29
29
  {'rel' => 'link2', 'href' => 'link2_href'}]})
30
- resource.api_methods.sort.should == [:destroy, :link1, :link2, :links, :show, :update]
30
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["destroy", "link1", "link2", "links", "show", "update"]
31
31
  end
32
32
 
33
33
  it "Should have the actions for instances of the ResourceDetail class" do
34
34
  resource = RightApi::ResourceDetail.new(@client, 'deployment', '/api/deployments/1',
35
35
  {'links' => [{'rel' => 'self', 'href' => 'self'}],
36
36
  'actions' => [{'rel' => 'action1'}, {'rel' => 'action2'}]})
37
- resource.api_methods.sort.should == [:action1, :action2, :destroy, :href, :links, :show, :update]
37
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["action1", "action2", "destroy", "href", "links", "show", "update"]
38
38
 
39
39
  flexmock(@rest_client).should_receive(:post).with({}, @header, Proc).and_return('ok')
40
40
  resource.action1.should == 'ok'
@@ -42,7 +42,7 @@ describe RightApi::ResourceDetail do
42
42
 
43
43
  it "Should have live_tasks for the 'instance' resource" do
44
44
  resource = RightApi::ResourceDetail.new(@client, 'instance', '/api/instances/1', {})
45
- resource.api_methods.sort.should == [:links, :live_tasks, :show, :update]
45
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["links", "live_tasks", "show", "update"]
46
46
  flexmock(RightApi::Resource).should_receive(:process).with(@client, 'live_task', '/api/instances/1/live/tasks/1').and_return('ok')
47
47
  resource.live_tasks(:id => '1').should == 'ok'
48
48
  end
@@ -53,7 +53,7 @@ describe RightApi::ResourceDetail do
53
53
  {'href' => '/api/servers/1', 'rel' => 'self'},
54
54
  {'href' => '/api/clouds/1/instances/1', 'rel' => 'current_instance'}],
55
55
  'current_instance' => {'links' => [{'href' => '/api/clouds/1/instances/1', 'rel' => 'self'}]}})
56
- resource.api_methods.sort.should == [:current_instance, :destroy, :href, :links, :show, :update]
56
+ resource.api_methods.collect{|s| s.to_s}.sort.should == ["current_instance", "destroy", "href", "links", "show", "update"]
57
57
  end
58
58
  end
59
59
  end
@@ -9,7 +9,7 @@ describe RightApi::Resource do
9
9
 
10
10
  it "Should have the required methods for instances of the Resource class" do
11
11
  resource = RightApi::Resource.process(@client, 'deployment', '/api/deployments/1')
12
- resource.api_methods.sort.should == [:destroy, :show, :update]
12
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["destroy", "show", "update"]
13
13
  end
14
14
 
15
15
  it "Should not have destroy/show/update for instances of the Resource class that do not support them" do
@@ -9,17 +9,17 @@ describe RightApi::Resources do
9
9
 
10
10
  it "Should have the required methods for instances of the Resources class" do
11
11
  resource = RightApi::Resources.new(@client, '/api/deployments', 'deployments')
12
- resource.api_methods.sort.should == [:create, :index]
12
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["create", "index"]
13
13
  end
14
14
 
15
15
  it "Should not have index for instances of the Resources class that do not support it" do
16
16
  resource = RightApi::Resources.new(@client, '/api/tags', 'tags')
17
- resource.api_methods.sort.should == [:by_resource, :by_tag, :multi_add, :multi_delete]
17
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["by_resource", "by_tag", "multi_add", "multi_delete"]
18
18
  end
19
19
 
20
20
  it "Should have resource-specific methods for instances of the Resources class" do
21
21
  resource = RightApi::Resources.new(@client, '/api/backups', 'backups')
22
- resource.api_methods.sort.should == [:cleanup, :create, :index]
22
+ resource.api_methods.sort.collect{|s| s.to_s}.should == ["cleanup", "create", "index"]
23
23
  end
24
24
  end
25
25
  end
metadata CHANGED
@@ -2,15 +2,15 @@
2
2
  name: right_api_client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.5.1
5
+ version: 1.5.2
6
6
  platform: ruby
7
7
  authors:
8
- - Ali Khajeh-Hosseini
8
+ - Ali Khajeh-Hosseini, Natalie Schauser, Nagender Paduru
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-28 00:00:00 +01:00
13
+ date: 2011-09-09 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -68,20 +68,9 @@ dependencies:
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: ruby-debug19
73
- requirement: &id006 !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - "="
77
- - !ruby/object:Gem::Version
78
- version: 0.11.6
79
- type: :development
80
- prerelease: false
81
- version_requirements: *id006
82
71
  - !ruby/object:Gem::Dependency
83
72
  name: simplecov
84
- requirement: &id007 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
85
74
  none: false
86
75
  requirements:
87
76
  - - "="
@@ -89,10 +78,10 @@ dependencies:
89
78
  version: 0.4.2
90
79
  type: :development
91
80
  prerelease: false
92
- version_requirements: *id007
81
+ version_requirements: *id006
93
82
  - !ruby/object:Gem::Dependency
94
83
  name: bundler
95
- requirement: &id008 !ruby/object:Gem::Requirement
84
+ requirement: &id007 !ruby/object:Gem::Requirement
96
85
  none: false
97
86
  requirements:
98
87
  - - ">="
@@ -100,13 +89,13 @@ dependencies:
100
89
  version: "0"
101
90
  type: :development
102
91
  prerelease: false
103
- version_requirements: *id008
92
+ version_requirements: *id007
104
93
  description: "\n\
105
94
  The right_api_client gem simplifies the use of RightScale's MultiCloud API. It provides\n\
106
95
  a simple object model of the API resources, and handles all of the fine details involved\n\
107
96
  in making HTTP calls and translating their responses.\n "
108
97
  email:
109
- - alikhajeh1@gmail.com
98
+ - ali@rightscale.com
110
99
  executables: []
111
100
 
112
101
  extensions: []
@@ -151,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
140
  requirements:
152
141
  - - ">="
153
142
  - !ruby/object:Gem::Version
154
- hash: 2710163890528289054
143
+ hash: -1047381825894058411
155
144
  segments:
156
145
  - 0
157
146
  version: "0"
@@ -160,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
149
  requirements:
161
150
  - - ">="
162
151
  - !ruby/object:Gem::Version
163
- hash: 2710163890528289054
152
+ hash: -1047381825894058411
164
153
  segments:
165
154
  - 0
166
155
  version: "0"