ovirt-engine-sdk 4.0.0.alpha10 → 4.0.0.alpha11
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.
- checksums.yaml +4 -4
- data/README.adoc +7 -2
- data/lib/ovirtsdk4/http.rb +46 -0
- data/lib/ovirtsdk4/readers.rb +1086 -1988
- data/lib/ovirtsdk4/services.rb +329 -329
- data/lib/ovirtsdk4/type.rb +1 -69
- data/lib/ovirtsdk4/version.rb +1 -1
- metadata +2 -2
data/lib/ovirtsdk4/type.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
module OvirtSDK4
|
18
18
|
|
19
19
|
##
|
20
|
-
# This module is a mixin that contains the
|
20
|
+
# This module is a mixin that contains the methods common to struct and list types.
|
21
21
|
#
|
22
22
|
module Type
|
23
23
|
|
@@ -39,72 +39,6 @@ module OvirtSDK4
|
|
39
39
|
@href = value
|
40
40
|
end
|
41
41
|
|
42
|
-
##
|
43
|
-
# Returns the reference to the connection that created this object.
|
44
|
-
#
|
45
|
-
# @return [Connection]
|
46
|
-
#
|
47
|
-
def connection
|
48
|
-
return @connection
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# Sets reference to the connection that created this object.
|
53
|
-
#
|
54
|
-
# @param value [Connection]
|
55
|
-
#
|
56
|
-
def connection=(value)
|
57
|
-
@connection = value
|
58
|
-
end
|
59
|
-
|
60
|
-
##
|
61
|
-
# Indicates if this structure is used as a link. When a structure is used as a link only the identifier and the
|
62
|
-
# `href` attributes will be returned by the server.
|
63
|
-
#
|
64
|
-
# @return [Boolean]
|
65
|
-
#
|
66
|
-
def is_link?
|
67
|
-
return @is_link
|
68
|
-
end
|
69
|
-
|
70
|
-
##
|
71
|
-
# Sets the value of the flag that indicates if this structure is used as a link.
|
72
|
-
#
|
73
|
-
# @param value [Boolean]
|
74
|
-
#
|
75
|
-
def is_link=(value)
|
76
|
-
@is_link = value
|
77
|
-
end
|
78
|
-
|
79
|
-
##
|
80
|
-
# Follows the `href` attribute of this structure, retrieves the object and returns it.
|
81
|
-
#
|
82
|
-
def follow_link
|
83
|
-
# Check that the "href" and "connection" attributes have values, as both are needed in order to retrieve
|
84
|
-
# the representation of the object:
|
85
|
-
if href.nil?
|
86
|
-
raise Error.new("Can't follow link because the \"href\" attribute does't have a value")
|
87
|
-
end
|
88
|
-
if connection.nil?
|
89
|
-
raise Error.new("Can't follow link because the \"connection\" attribute does't have a value")
|
90
|
-
end
|
91
|
-
|
92
|
-
# Check that the value of the "href" attribute is compatible with the base URL of the connection:
|
93
|
-
prefix = connection.url.path
|
94
|
-
if !prefix.end_with?('/')
|
95
|
-
prefix += '/'
|
96
|
-
end
|
97
|
-
if !href.start_with?(prefix)
|
98
|
-
raise Error.new("The URL \"#{href}\" isn't compatible with the base URL of the connection")
|
99
|
-
end
|
100
|
-
|
101
|
-
# Remove the prefix from the URL, follow the path to the relevant service and invoke the "get" method to
|
102
|
-
# retrieve its representation:
|
103
|
-
path = href[prefix.length..-1]
|
104
|
-
service = connection.service(path)
|
105
|
-
return service.get
|
106
|
-
end
|
107
|
-
|
108
42
|
end
|
109
43
|
|
110
44
|
##
|
@@ -118,8 +52,6 @@ module OvirtSDK4
|
|
118
52
|
#
|
119
53
|
def initialize(opts = {})
|
120
54
|
self.href = opts[:href]
|
121
|
-
self.connection = opts[:connection]
|
122
|
-
self.is_link = opts[:is_link]
|
123
55
|
end
|
124
56
|
|
125
57
|
end
|
data/lib/ovirtsdk4/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovirt-engine-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.alpha11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Hernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|