vas 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/vas.rb +44 -1
- data/lib/vas/gemfire/agent_instances.rb +4 -3
- data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
- data/lib/vas/gemfire/agent_node_instances.rb +2 -2
- data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/application_code.rb +13 -12
- data/lib/vas/gemfire/application_code_images.rb +13 -11
- data/lib/vas/gemfire/cache_server_instances.rb +20 -12
- data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
- data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
- data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/disk_stores.rb +19 -11
- data/lib/vas/gemfire/gemfire.rb +4 -4
- data/lib/vas/gemfire/groups.rb +17 -10
- data/lib/vas/gemfire/installations.rb +12 -3
- data/lib/vas/gemfire/live_application_codes.rb +2 -2
- data/lib/vas/gemfire/locator_instances.rb +23 -13
- data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
- data/lib/vas/gemfire/locator_node_instances.rb +22 -14
- data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/gemfire/nodes.rb +27 -6
- data/lib/vas/gemfire/pending_application_codes.rb +7 -2
- data/lib/vas/gemfire/statistics.rb +18 -11
- data/lib/vas/rabbitmq/groups.rb +6 -4
- data/lib/vas/rabbitmq/installations.rb +14 -6
- data/lib/vas/rabbitmq/instances.rb +9 -6
- data/lib/vas/rabbitmq/live_configurations.rb +3 -3
- data/lib/vas/rabbitmq/node_instances.rb +2 -2
- data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
- data/lib/vas/rabbitmq/nodes.rb +11 -8
- data/lib/vas/rabbitmq/plugin_images.rb +14 -7
- data/lib/vas/rabbitmq/plugins.rb +29 -20
- data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
- data/lib/vas/shared/collection.rb +34 -11
- data/lib/vas/shared/configuration.rb +16 -9
- data/lib/vas/shared/deletable.rb +34 -0
- data/lib/vas/shared/groups.rb +26 -15
- data/lib/vas/shared/installation_images.rb +18 -10
- data/lib/vas/shared/installations.rb +22 -22
- data/lib/vas/shared/instance.rb +40 -19
- data/lib/vas/shared/live_configuration.rb +42 -0
- data/lib/vas/shared/logs.rb +27 -14
- data/lib/vas/shared/mutable_collection.rb +13 -5
- data/lib/vas/shared/node_configuration.rb +74 -0
- data/lib/vas/shared/node_instances.rb +32 -14
- data/lib/vas/shared/nodes.rb +37 -14
- data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
- data/lib/vas/shared/resource.rb +12 -2
- data/lib/vas/shared/security.rb +11 -4
- data/lib/vas/shared/state_resource.rb +1 -1
- data/lib/vas/sqlfire/agent_instances.rb +98 -0
- data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_logs.rb +39 -0
- data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
- data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/groups.rb +58 -0
- data/lib/vas/sqlfire/installation_images.rb +39 -0
- data/lib/vas/sqlfire/installations.rb +61 -0
- data/lib/vas/sqlfire/locator_instances.rb +210 -0
- data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_logs.rb +39 -0
- data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
- data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/nodes.rb +73 -0
- data/lib/vas/sqlfire/server_instances.rb +192 -0
- data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_logs.rb +39 -0
- data/lib/vas/sqlfire/server_node_instances.rb +86 -0
- data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
- data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
- data/lib/vas/sqlfire/sqlfire.rb +44 -0
- data/lib/vas/tc_server/applications.rb +32 -21
- data/lib/vas/tc_server/configuration.rb +1 -1
- data/lib/vas/tc_server/groups.rb +7 -4
- data/lib/vas/tc_server/installations.rb +16 -6
- data/lib/vas/tc_server/instances.rb +25 -13
- data/lib/vas/tc_server/live_configurations.rb +11 -1
- data/lib/vas/tc_server/logs.rb +4 -2
- data/lib/vas/tc_server/node_applications.rb +21 -17
- data/lib/vas/tc_server/node_instances.rb +23 -9
- data/lib/vas/tc_server/node_live_configurations.rb +39 -0
- data/lib/vas/tc_server/node_revisions.rb +15 -10
- data/lib/vas/tc_server/nodes.rb +15 -8
- data/lib/vas/tc_server/revision_images.rb +16 -10
- data/lib/vas/tc_server/revisions.rb +20 -16
- data/lib/vas/tc_server/tc_server.rb +5 -5
- data/lib/vas/tc_server/template_images.rb +13 -7
- data/lib/vas/tc_server/templates.rb +21 -13
- data/lib/vas/util/client.rb +15 -6
- data/lib/vas/vfabric/agent_image.rb +1 -1
- data/lib/vas/vfabric/nodes.rb +4 -11
- data/lib/vas/vfabric/v_fabric.rb +2 -2
- data/lib/vas/vfabric_administration_server.rb +37 -6
- data/lib/vas/web_server/configuration.rb +29 -0
- data/lib/vas/web_server/groups.rb +44 -0
- data/lib/vas/web_server/installation_images.rb +54 -0
- data/lib/vas/web_server/installations.rb +52 -0
- data/lib/vas/web_server/instances.rb +65 -0
- data/lib/vas/web_server/live_configurations.rb +39 -0
- data/lib/vas/web_server/logs.rb +37 -0
- data/lib/vas/web_server/node_instances.rb +39 -0
- data/lib/vas/web_server/node_live_configurations.rb +39 -0
- data/lib/vas/web_server/nodes.rb +53 -0
- data/lib/vas/web_server/pending_configurations.rb +39 -0
- data/lib/vas/web_server/web_server.rb +43 -0
- metadata +137 -76
data/lib/vas/rabbitmq/groups.rb
CHANGED
@@ -29,15 +29,17 @@ module RabbitMq
|
|
29
29
|
# A RabbitMQ group
|
30
30
|
class Group < Shared::Group
|
31
31
|
|
32
|
-
# @return [Instances] the group's instances
|
33
|
-
attr_reader :instances
|
34
|
-
|
35
32
|
# @private
|
36
33
|
def initialize(location, client)
|
37
34
|
super(location, client, Node, Installations)
|
38
|
-
|
35
|
+
|
36
|
+
@instances_location = Util::LinkUtils.get_link_href(details, 'group-instances')
|
39
37
|
end
|
40
38
|
|
39
|
+
# @return [Instances] the group's instances
|
40
|
+
def instances
|
41
|
+
@instances ||= Instances.new(@instances_location, client)
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
end
|
@@ -18,14 +18,14 @@ module RabbitMq
|
|
18
18
|
|
19
19
|
# Used to enumerate, create, and delete RabbitMQ installations
|
20
20
|
class Installations < Shared::Installations
|
21
|
-
|
21
|
+
|
22
22
|
# @private
|
23
23
|
def initialize(location, client)
|
24
24
|
super(location, client, Installation)
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
# A RabbitMQ installation
|
30
30
|
class Installation < Shared::Installation
|
31
31
|
|
@@ -34,11 +34,19 @@ module RabbitMq
|
|
34
34
|
super(location, client, InstallationImage, Group)
|
35
35
|
end
|
36
36
|
|
37
|
+
# Reloads the installation's details from the server
|
38
|
+
#
|
39
|
+
# @return [void]
|
40
|
+
def reload
|
41
|
+
super
|
42
|
+
@instances = nil
|
43
|
+
end
|
44
|
+
|
37
45
|
# @return [Instance[]] the instances that are using the installation
|
38
46
|
def instances
|
39
|
-
|
47
|
+
@instances ||= create_resources_from_links('group-instance', Instance)
|
40
48
|
end
|
41
|
-
|
49
|
+
|
42
50
|
end
|
43
|
-
|
51
|
+
|
44
52
|
end
|
@@ -21,7 +21,7 @@ module RabbitMq
|
|
21
21
|
|
22
22
|
# @private
|
23
23
|
def initialize(location, client)
|
24
|
-
super(location, client,
|
24
|
+
super(location, client, 'group-instances', Instance)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Creates a new instance
|
@@ -32,7 +32,7 @@ module RabbitMq
|
|
32
32
|
# @return [Instance] the new instance
|
33
33
|
def create(installation, name)
|
34
34
|
payload = { :installation => installation.location, :name => name }
|
35
|
-
|
35
|
+
super(payload, 'group-instance')
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -40,9 +40,6 @@ module RabbitMq
|
|
40
40
|
# A RabbitMQ instance
|
41
41
|
class Instance < Shared::Instance
|
42
42
|
|
43
|
-
# @return [Plugins] the instance's plugins
|
44
|
-
attr_reader :plugins
|
45
|
-
|
46
43
|
# @private
|
47
44
|
def initialize(location, client)
|
48
45
|
super(location, client, Group, Installation, LiveConfigurations, PendingConfigurations, NodeInstance, 'node-instance')
|
@@ -55,7 +52,13 @@ module RabbitMq
|
|
55
52
|
#
|
56
53
|
# @return [void]
|
57
54
|
def update(installation)
|
58
|
-
client.post(location, { :installation => installation.location })
|
55
|
+
client.post(location, { :installation => installation.location })
|
56
|
+
reload
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Plugins] the instance's plugins
|
60
|
+
def plugins
|
61
|
+
@plugins ||= Plugins.new(Util::LinkUtils.get_link_href(details, 'plugins'), client)
|
59
62
|
end
|
60
63
|
|
61
64
|
end
|
@@ -21,17 +21,17 @@ module RabbitMq
|
|
21
21
|
|
22
22
|
# @private
|
23
23
|
def initialize(location, client)
|
24
|
-
super(location, client,
|
24
|
+
super(location, client, 'live-configurations', LiveConfiguration)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# A live configuration file in a RabbitMQ instance
|
30
|
-
class LiveConfiguration < Shared::
|
30
|
+
class LiveConfiguration < Shared::LiveConfiguration
|
31
31
|
|
32
32
|
# @private
|
33
33
|
def initialize(location, client)
|
34
|
-
super(location, client,
|
34
|
+
super(location, client, 'group-instance', Instance, NodeLiveConfiguration)
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -21,7 +21,7 @@ module RabbitMq
|
|
21
21
|
|
22
22
|
# @private
|
23
23
|
def initialize(location, client)
|
24
|
-
super(location, client,
|
24
|
+
super(location, client, 'node-instances', NodeInstance)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
@@ -31,7 +31,7 @@ module RabbitMq
|
|
31
31
|
|
32
32
|
# @private
|
33
33
|
def initialize(location, client)
|
34
|
-
super(location, client, Node, Logs, Instance, 'group-instance')
|
34
|
+
super(location, client, Node, Logs, Instance, 'group-instance', NodeLiveConfigurations)
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# vFabric Administration Server Ruby API
|
2
|
+
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
module RabbitMq
|
18
|
+
|
19
|
+
# Used to enumerate a node instance's live configuration
|
20
|
+
class NodeLiveConfigurations < Shared::Collection
|
21
|
+
|
22
|
+
# @private
|
23
|
+
def initialize(location, client)
|
24
|
+
super(location, client, 'node-live-configurations', NodeLiveConfiguration)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# A live configuration file in a node instance
|
30
|
+
class NodeLiveConfiguration < Shared::NodeConfiguration
|
31
|
+
|
32
|
+
# @private
|
33
|
+
def initialize(location, client)
|
34
|
+
super(location, client, 'node-instance', NodeInstance, LiveConfiguration)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/lib/vas/rabbitmq/nodes.rb
CHANGED
@@ -15,34 +15,37 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
module RabbitMq
|
18
|
-
|
18
|
+
|
19
19
|
# Used to enumerate RabbitMQ nodes
|
20
20
|
class Nodes < Shared::Collection
|
21
21
|
|
22
22
|
# @private
|
23
23
|
def initialize(location, client)
|
24
|
-
super(location, client,
|
24
|
+
super(location, client, 'nodes', Node)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# A RabbitMQ node
|
30
30
|
class Node < Shared::GroupableNode
|
31
|
-
|
32
|
-
# @return [NodeInstances] the node's instances
|
33
|
-
attr_reader :instances
|
34
31
|
|
35
32
|
# @private
|
36
33
|
def initialize(location, client)
|
37
34
|
super(location, client, Group)
|
38
|
-
@
|
35
|
+
@instances_location = Util::LinkUtils.get_link_href(details, 'node-instances')
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [NodeInstances] the node's instances
|
39
|
+
def instances
|
40
|
+
@instances ||= NodeInstances.new(@instances_location, client)
|
39
41
|
end
|
40
42
|
|
41
43
|
# @return [String] a string representation of the node
|
42
|
-
def to_s
|
43
|
-
"#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}'
|
44
|
+
def to_s
|
45
|
+
"#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' ipv4_addresses='#{ipv4_addresses}' ipv6_addresses='#{ipv6_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' metadata='#{metadata}'>"
|
44
46
|
end
|
45
47
|
|
48
|
+
|
46
49
|
end
|
47
50
|
|
48
51
|
end
|
@@ -30,7 +30,7 @@ module RabbitMq
|
|
30
30
|
#
|
31
31
|
# @return [PluginImage] the new plugin image
|
32
32
|
def create(path)
|
33
|
-
|
33
|
+
create_image(path)
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -38,6 +38,8 @@ module RabbitMq
|
|
38
38
|
# A plugin image
|
39
39
|
class PluginImage < Shared::Resource
|
40
40
|
|
41
|
+
include Shared::Deletable
|
42
|
+
|
41
43
|
# The plugin image's name
|
42
44
|
attr_reader :name
|
43
45
|
|
@@ -51,21 +53,26 @@ module RabbitMq
|
|
51
53
|
def initialize(location, client)
|
52
54
|
super(location, client)
|
53
55
|
|
54
|
-
@name = details[
|
55
|
-
@version = details[
|
56
|
+
@name = details['name']
|
57
|
+
@version = details['version']
|
56
58
|
@size = details['size']
|
57
59
|
end
|
58
60
|
|
61
|
+
# Reloads the plugin image's details from the server
|
62
|
+
# @return [void]
|
63
|
+
def reload
|
64
|
+
super
|
65
|
+
@plugins = nil
|
66
|
+
end
|
67
|
+
|
59
68
|
# @return [Plugin[]] the plugins that have been created from this plugin image
|
60
69
|
def plugins
|
61
|
-
plugins
|
62
|
-
Util::LinkUtils.get_link_hrefs(client.get(location), "plugin").each { |plugin_location| plugins << Plugin.new(plugin_location, client)}
|
63
|
-
plugins
|
70
|
+
@plugins ||= create_resources_from_links('plugin', Plugin)
|
64
71
|
end
|
65
72
|
|
66
73
|
# @return [String] a string representation of the plugin image
|
67
74
|
def to_s
|
68
|
-
"#<#{self.class} name='#@name' version='#@version'>"
|
75
|
+
"#<#{self.class} name='#@name' size='#@size' version='#@version'>"
|
69
76
|
end
|
70
77
|
|
71
78
|
end
|
data/lib/vas/rabbitmq/plugins.rb
CHANGED
@@ -18,44 +18,53 @@ module RabbitMq
|
|
18
18
|
|
19
19
|
# Used to enumerate, create, and delete plugins
|
20
20
|
class Plugins < Shared::MutableCollection
|
21
|
-
|
22
|
-
def initialize(location, client)
|
23
|
-
super(location, client,
|
21
|
+
|
22
|
+
def initialize(location, client)
|
23
|
+
super(location, client, 'plugins', Plugin)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Creates a plugin from the +plugin_image+
|
27
|
+
# @return [Plugin] the new plugin
|
27
28
|
def create(plugin_image)
|
28
|
-
|
29
|
+
super({:image => plugin_image.location}, 'plugin')
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
end
|
32
33
|
|
33
34
|
# A plugin in a RabbitMQ instance
|
34
35
|
class Plugin < Shared::Resource
|
35
36
|
|
37
|
+
include Shared::Deletable
|
38
|
+
|
36
39
|
# @return [String] the plugin's version
|
37
40
|
attr_reader :version
|
38
41
|
|
39
42
|
# @return [String] the plugin's name
|
40
43
|
attr_reader :name
|
41
|
-
|
42
|
-
# @return [Instance] the instance that contains the plugin
|
43
|
-
attr_reader :instance
|
44
|
-
|
45
|
-
# @return [PluginImage] the plugin image, if any, that was used to create the plugin
|
46
|
-
attr_reader :plugin_image
|
47
|
-
|
44
|
+
|
48
45
|
# @private
|
49
46
|
def initialize(location, client)
|
50
47
|
super(location, client)
|
51
|
-
|
48
|
+
|
52
49
|
@name = details['name']
|
53
50
|
@version = details['version']
|
54
|
-
|
51
|
+
|
52
|
+
@instance_location = Util::LinkUtils.get_link_href(details, 'group-instance')
|
55
53
|
@state_location = Util::LinkUtils.get_link_href(details, 'state')
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [PluginImage] the plugin image, if any, that was used to create the plugin
|
57
|
+
def plugin_image
|
58
|
+
if @plugin_image.nil?
|
59
|
+
plugin_image_location = Util::LinkUtils.get_link_href(details, 'plugin-image')
|
60
|
+
@plugin_image = PluginImage.new(plugin_image_location, client) unless plugin_image_location.nil?
|
61
|
+
end
|
62
|
+
@plugin_image
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Instance] the instance that contains the plugin
|
66
|
+
def instance
|
67
|
+
@instance ||= Instance.new(@instance_location, client)
|
59
68
|
end
|
60
69
|
|
61
70
|
# @return [String] the state of the plugin
|
@@ -67,16 +76,16 @@ module RabbitMq
|
|
67
76
|
#
|
68
77
|
# @return [void]
|
69
78
|
def enable
|
70
|
-
client.post(@state_location, {
|
79
|
+
client.post(@state_location, {:status => 'ENABLED'})
|
71
80
|
end
|
72
81
|
|
73
82
|
# Disables the plugin
|
74
83
|
#
|
75
84
|
# @return [void]
|
76
85
|
def disable
|
77
|
-
client.post(@state_location, {
|
86
|
+
client.post(@state_location, {:status => 'DISABLED'})
|
78
87
|
end
|
79
|
-
|
88
|
+
|
80
89
|
# @return [String] a string representation of the plugin
|
81
90
|
def to_s
|
82
91
|
"#<#{self.class} name='#@name' version='#@version'>"
|
@@ -37,10 +37,10 @@ module RabbitMq
|
|
37
37
|
|
38
38
|
json = client.get(location)
|
39
39
|
|
40
|
-
@groups = Groups.new(Util::LinkUtils.get_link_href(json,
|
41
|
-
@installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json,
|
42
|
-
@plugin_images = PluginImages.new(Util::LinkUtils.get_link_href(json,
|
43
|
-
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json,
|
40
|
+
@groups = Groups.new(Util::LinkUtils.get_link_href(json, 'groups'), client)
|
41
|
+
@installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, 'installation-images'), client)
|
42
|
+
@plugin_images = PluginImages.new(Util::LinkUtils.get_link_href(json, 'plugin-images'), client)
|
43
|
+
@nodes = Nodes.new(Util::LinkUtils.get_link_href(json, 'nodes'), client)
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
@@ -19,34 +19,57 @@ module Shared
|
|
19
19
|
# @abstract A dynamic collection of items
|
20
20
|
class Collection < Shared::Resource
|
21
21
|
|
22
|
+
include Enumerable
|
23
|
+
|
22
24
|
private
|
23
|
-
|
25
|
+
|
24
26
|
attr_reader :entry_class
|
25
|
-
|
27
|
+
|
26
28
|
public
|
27
29
|
|
28
30
|
# @private
|
29
31
|
def initialize(location, client, type, entry_class)
|
30
|
-
super(location, client)
|
31
32
|
@type = type
|
32
33
|
@entry_class = entry_class
|
34
|
+
super(location, client)
|
33
35
|
end
|
34
36
|
|
35
|
-
|
37
|
+
def reload
|
38
|
+
super
|
39
|
+
@items = nil
|
40
|
+
end
|
41
|
+
|
42
|
+
# Calls the block once for each item in the collection.
|
36
43
|
#
|
37
44
|
# @yieldparam item an item in the collection
|
38
45
|
#
|
39
46
|
# @return [void]
|
40
47
|
def each
|
41
|
-
items
|
48
|
+
@items ||= create_collection_entries
|
49
|
+
@items.each { |item| yield item }
|
50
|
+
end
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
52
|
+
private
|
53
|
+
|
54
|
+
def create_collection_entries
|
55
|
+
entries_json = details[@type]
|
56
|
+
if entries_json
|
57
|
+
entries_json.collect { |json| create_entry(Util::LinkUtils.get_self_link_href(json)) }
|
58
|
+
else
|
59
|
+
[]
|
47
60
|
end
|
48
61
|
end
|
49
|
-
|
62
|
+
|
63
|
+
def create_entry(location)
|
64
|
+
entry = @entry_class.new(location, client)
|
65
|
+
|
66
|
+
if @entry_class.include?(Deletable)
|
67
|
+
entry.collection = self
|
68
|
+
end
|
69
|
+
|
70
|
+
entry
|
71
|
+
end
|
72
|
+
|
50
73
|
end
|
51
|
-
|
74
|
+
|
52
75
|
end
|