softlayer_api 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/softlayer/base.rb
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
#
|
37
37
|
|
38
38
|
module SoftLayer
|
39
|
-
VERSION = "1.0.
|
39
|
+
VERSION = "1.0.5" # version history at the bottom of the file.
|
40
40
|
|
41
41
|
# The base URL of the SoftLayer API's REST-like endpoints available to the public internet.
|
42
42
|
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/rest/v3/'
|
@@ -76,4 +76,6 @@ end # module SoftLayer
|
|
76
76
|
# JN. Thanks!
|
77
77
|
#
|
78
78
|
# 1.0.4 - Fixed a bug where the result_limit and result_offset object filters were just not working.
|
79
|
+
#
|
80
|
+
# 1.0.5 - Fixed a bug where empty hashes and empty arrays would not generate meaningful object masks
|
79
81
|
#
|
@@ -26,6 +26,8 @@
|
|
26
26
|
|
27
27
|
class Hash
|
28
28
|
def to_sl_object_mask(base = "")
|
29
|
+
return base if(self.empty?)
|
30
|
+
|
29
31
|
# ask the children to convert themselves with the key as the base
|
30
32
|
masked_children = self.map { |key, value| result = value.to_sl_object_mask(key); }.flatten
|
31
33
|
|
@@ -36,6 +38,7 @@ end
|
|
36
38
|
|
37
39
|
class Array
|
38
40
|
def to_sl_object_mask(base = "")
|
41
|
+
return base if self.empty?
|
39
42
|
self.map { |item| item.to_sl_object_mask(base) }.flatten
|
40
43
|
end
|
41
44
|
end
|
@@ -28,7 +28,7 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
|
28
28
|
|
29
29
|
require 'rubygems'
|
30
30
|
require 'softlayer_api'
|
31
|
-
require '
|
31
|
+
require 'rspec'
|
32
32
|
|
33
33
|
describe SoftLayer::APIParameterFilter, "#object_with_id" do
|
34
34
|
it "should intitialize with empty parameter values" do
|
data/test/SoftLayer_Service.rb
CHANGED
@@ -28,8 +28,8 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
|
28
28
|
|
29
29
|
require 'rubygems'
|
30
30
|
require 'softlayer_api'
|
31
|
-
require '
|
32
|
-
require '
|
31
|
+
require 'rspec'
|
32
|
+
require 'rspec/autorun'
|
33
33
|
|
34
34
|
describe SoftLayer::Service, "#new" do
|
35
35
|
before(:each) do
|
@@ -28,8 +28,8 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
|
28
28
|
|
29
29
|
require 'rubygems'
|
30
30
|
require 'softlayer_api'
|
31
|
-
require '
|
32
|
-
require '
|
31
|
+
require 'rspec'
|
32
|
+
require 'rspec/autorun'
|
33
33
|
|
34
34
|
describe String, "#to_sl_object_mask" do
|
35
35
|
it "should echo back a string with no base" do
|
@@ -50,8 +50,8 @@ describe String, "#to_sl_object_mask" do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe Array,"#to_sl_object_mask" do
|
53
|
-
it "should return
|
54
|
-
[].to_sl_object_mask.should eql(
|
53
|
+
it "should return and empty string if run on an empty array" do
|
54
|
+
[].to_sl_object_mask.should eql("")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should call to_sl_object_mask passing the base to all its elements" do
|
@@ -70,6 +70,10 @@ describe Array,"#to_sl_object_mask" do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
describe Hash, "#to_sl_object_mask" do
|
73
|
+
it "should return an empty string if run on an empty hash" do
|
74
|
+
{}.to_sl_object_mask.should eql("")
|
75
|
+
end
|
76
|
+
|
73
77
|
it "should call to_sl_object_mask on values with the key as the base" do
|
74
78
|
proxy = "value"
|
75
79
|
proxy.should_receive(:to_sl_object_mask).with("key").and_return("key.value")
|
@@ -80,4 +84,9 @@ describe Hash, "#to_sl_object_mask" do
|
|
80
84
|
it "should resolve the mapped values with the base provided" do
|
81
85
|
{"top" => [ "middle1", {"middle2" => "end"}]}.to_sl_object_mask.should eql(["top.middle1", "top.middle2.end"])
|
82
86
|
end
|
87
|
+
|
88
|
+
it "should handle a complex hash object mask with an inner empty hash" do
|
89
|
+
{ "ipAddress" => { "ipAddress" => {}}}.to_sl_object_mask.should eql(["ipAddress.ipAddress"])
|
90
|
+
end
|
91
|
+
|
83
92
|
end
|
metadata
CHANGED
@@ -1,43 +1,34 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: softlayer_api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 1.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.5
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- SoftLayer Development Team
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: json
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
16
|
+
requirement: &70161596543420 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :runtime
|
31
|
-
|
32
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70161596543420
|
25
|
+
description: The softlayer_api gem offers a convenient mechanism for invoking the
|
26
|
+
services of the SoftLayer API from Ruby.
|
33
27
|
email: sldn@softlayer.com
|
34
28
|
executables: []
|
35
|
-
|
36
29
|
extensions: []
|
37
|
-
|
38
30
|
extra_rdoc_files: []
|
39
|
-
|
40
|
-
files:
|
31
|
+
files:
|
41
32
|
- README.textile
|
42
33
|
- LICENSE.textile
|
43
34
|
- lib/softlayer/base.rb
|
@@ -51,35 +42,28 @@ files:
|
|
51
42
|
- examples/createTicket.rb
|
52
43
|
- examples/openTickets.rb
|
53
44
|
- examples/ticket_info.rb
|
54
|
-
has_rdoc: true
|
55
45
|
homepage: http://sldn.softlayer.com/
|
56
46
|
licenses: []
|
57
|
-
|
58
47
|
post_install_message:
|
59
48
|
rdoc_options: []
|
60
|
-
|
61
|
-
require_paths:
|
49
|
+
require_paths:
|
62
50
|
- lib
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
- 0
|
76
|
-
version: "0"
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
77
63
|
requirements: []
|
78
|
-
|
79
64
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.8.11
|
81
66
|
signing_key:
|
82
67
|
specification_version: 3
|
83
68
|
summary: Library for accessing the SoftLayer portal API
|
84
69
|
test_files: []
|
85
|
-
|