right_api_client 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -1
- data/lib/right_api_client/client.rb +6 -1
- data/lib/right_api_client/version.rb +1 -1
- data/spec/audit_entries_spec.rb +66 -0
- data/spec/spec_helper.rb +3 -2
- metadata +11 -15
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
= right_api_client - CHANGELOG.rdoc
|
2
2
|
|
3
|
+
== right_api_client - 1.5.5
|
4
|
+
Fix crash on audit_entry.detail.show (text and not JSON).
|
5
|
+
|
3
6
|
== right_api_client - 1.5.4
|
4
7
|
Fix singular for audit_entries resources. Update rest-client gem version to 1.6.7.
|
5
8
|
|
@@ -10,4 +13,4 @@ Add support for audit_entries resources. Update RConf ruby version to ruby-1.9.2
|
|
10
13
|
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).
|
11
14
|
|
12
15
|
== right_api_client - 1.5.1
|
13
|
-
Initial public release, supports all of the calls in RightScale API 1.5.
|
16
|
+
Initial public release, supports all of the calls in RightScale API 1.5.
|
@@ -146,7 +146,12 @@ module RightApi
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
data =
|
149
|
+
data = if resource_type == 'text'
|
150
|
+
{ 'text' => body }
|
151
|
+
else
|
152
|
+
JSON.parse(body)
|
153
|
+
end
|
154
|
+
|
150
155
|
[resource_type, path, data]
|
151
156
|
end
|
152
157
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
|
5
|
+
describe RightApi::Client do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
|
9
|
+
creds = File.expand_path('../../config/login.yml', __FILE__)
|
10
|
+
|
11
|
+
begin
|
12
|
+
@client = RightApi::Client.new(YAML.load_file(creds))
|
13
|
+
rescue Exception => e
|
14
|
+
puts "=" * 80
|
15
|
+
puts "WARNING: please provide a valid config/login.yml file"
|
16
|
+
puts
|
17
|
+
puts e.message
|
18
|
+
puts "=" * 80
|
19
|
+
end
|
20
|
+
|
21
|
+
server_arrays =
|
22
|
+
@client.server_arrays.index
|
23
|
+
|
24
|
+
@server_array =
|
25
|
+
server_arrays.find { |sa| sa.name.match(/test/i) } ||
|
26
|
+
server_arrays.first
|
27
|
+
|
28
|
+
raise "sorry, can't test, no server arrays in your RS" unless @server_array
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#audit_entries' do
|
32
|
+
|
33
|
+
describe '#create' do
|
34
|
+
|
35
|
+
it 'creates audit entries' do
|
36
|
+
|
37
|
+
ae = @client.audit_entries.create(:audit_entry => {
|
38
|
+
'auditee_href' => @server_array.href,
|
39
|
+
'summary' => "right_api_client test #{$$}-#{Time.now.to_f}",
|
40
|
+
'detail' => 'sacrificing goats to make it work'
|
41
|
+
})
|
42
|
+
|
43
|
+
ae.class.should == RightApi::Resource
|
44
|
+
ae.show.href.should match(/^\/api\/audit_entries\/[a-z0-9]+$/)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'AuditEntry resource' do
|
50
|
+
|
51
|
+
describe '#detail' do
|
52
|
+
|
53
|
+
it 'returns the detail plain text' do
|
54
|
+
|
55
|
+
ae = @client.audit_entries.create(:audit_entry => {
|
56
|
+
'auditee_href' => @server_array.href,
|
57
|
+
'summary' => "right_api_client test #{$$}-#{Time.now.to_f}",
|
58
|
+
'detail' => "and it's 1984"
|
59
|
+
})
|
60
|
+
|
61
|
+
ae.show.detail.show.text.should == "and it's 1984"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,8 @@ require 'simplecov'
|
|
2
2
|
SimpleCov.start if ENV["COVERAGE"]
|
3
3
|
require File.expand_path('../../lib/right_api_client', __FILE__)
|
4
4
|
require 'spec'
|
5
|
-
require '
|
5
|
+
require 'pp'
|
6
|
+
require 'yaml'
|
6
7
|
|
7
8
|
Spec::Runner.configure do |config|
|
8
9
|
config.mock_with :flexmock
|
@@ -38,4 +39,4 @@ module MockSpecHelper
|
|
38
39
|
}]}'])
|
39
40
|
@client = RightApi::Client.new(:instance_token => 'instance_token', :account_id => '1')
|
40
41
|
end
|
41
|
-
end
|
42
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: right_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.5.
|
5
|
+
version: 1.5.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- RightScale, Inc.
|
@@ -10,11 +10,12 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-20 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|
18
|
+
prerelease: false
|
18
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
20
|
none: false
|
20
21
|
requirements:
|
@@ -22,10 +23,10 @@ dependencies:
|
|
22
23
|
- !ruby/object:Gem::Version
|
23
24
|
version: "0"
|
24
25
|
type: :runtime
|
25
|
-
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
|
+
prerelease: false
|
29
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
31
|
none: false
|
31
32
|
requirements:
|
@@ -33,10 +34,10 @@ dependencies:
|
|
33
34
|
- !ruby/object:Gem::Version
|
34
35
|
version: 1.6.7
|
35
36
|
type: :runtime
|
36
|
-
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rake
|
40
|
+
prerelease: false
|
40
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
@@ -44,10 +45,10 @@ dependencies:
|
|
44
45
|
- !ruby/object:Gem::Version
|
45
46
|
version: 0.8.7
|
46
47
|
type: :development
|
47
|
-
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rspec
|
51
|
+
prerelease: false
|
51
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
53
54
|
requirements:
|
@@ -55,10 +56,10 @@ dependencies:
|
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: 1.3.0
|
57
58
|
type: :development
|
58
|
-
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: flexmock
|
62
|
+
prerelease: false
|
62
63
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
64
|
none: false
|
64
65
|
requirements:
|
@@ -66,10 +67,10 @@ dependencies:
|
|
66
67
|
- !ruby/object:Gem::Version
|
67
68
|
version: 0.8.7
|
68
69
|
type: :development
|
69
|
-
prerelease: false
|
70
70
|
version_requirements: *id005
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: simplecov
|
73
|
+
prerelease: false
|
73
74
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
75
|
none: false
|
75
76
|
requirements:
|
@@ -77,10 +78,10 @@ dependencies:
|
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: 0.4.2
|
79
80
|
type: :development
|
80
|
-
prerelease: false
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: bundler
|
84
|
+
prerelease: false
|
84
85
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
86
|
none: false
|
86
87
|
requirements:
|
@@ -88,7 +89,6 @@ dependencies:
|
|
88
89
|
- !ruby/object:Gem::Version
|
89
90
|
version: "0"
|
90
91
|
type: :development
|
91
|
-
prerelease: false
|
92
92
|
version_requirements: *id007
|
93
93
|
description: "\n\
|
94
94
|
The right_api_client gem simplifies the use of RightScale's MultiCloud API. It provides\n\
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- login_to_client_irb.rb
|
121
121
|
- right_api_client.gemspec
|
122
122
|
- right_api_client.rconf
|
123
|
+
- spec/audit_entries_spec.rb
|
123
124
|
- spec/client_spec.rb
|
124
125
|
- spec/instance_facing_spec.rb
|
125
126
|
- spec/resource_detail_spec.rb
|
@@ -140,18 +141,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
141
|
requirements:
|
141
142
|
- - ">="
|
142
143
|
- !ruby/object:Gem::Version
|
143
|
-
hash: 3281147269510564278
|
144
|
-
segments:
|
145
|
-
- 0
|
146
144
|
version: "0"
|
147
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
146
|
none: false
|
149
147
|
requirements:
|
150
148
|
- - ">="
|
151
149
|
- !ruby/object:Gem::Version
|
152
|
-
hash: 3281147269510564278
|
153
|
-
segments:
|
154
|
-
- 0
|
155
150
|
version: "0"
|
156
151
|
requirements: []
|
157
152
|
|
@@ -162,6 +157,7 @@ specification_version: 3
|
|
162
157
|
summary: RightScale MultiCloud API HTTP Client
|
163
158
|
test_files:
|
164
159
|
- config/login.yml.example
|
160
|
+
- spec/audit_entries_spec.rb
|
165
161
|
- spec/client_spec.rb
|
166
162
|
- spec/instance_facing_spec.rb
|
167
163
|
- spec/resource_detail_spec.rb
|