oneview-sdk 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c08df41a56b6d4c00091f3f42452519714cece6
4
- data.tar.gz: f6525ea2ba7313139e4e1350767bb994fc22d65d
3
+ metadata.gz: 91b7cf426e8de07259908123559cb374c63c79ea
4
+ data.tar.gz: 62f35419a3b9d80c0f0144efb26e0d0884e280dc
5
5
  SHA512:
6
- metadata.gz: 124044a8cb577fd2549a1244bb6b733c9b08aac7fc94890d5f9c5e0a564c833af9b40c603c79868e7fb7957b351ace170d7977e15b0f522711823d7d7f9a0759
7
- data.tar.gz: 9998e95482b68cf9e691fd9a6e7ae031884a6a521003883187c7dc556920b6c491a62020e8db3d8f0dae8120871cd3d3002a3a2fa732895675cee769d78f2f9d
6
+ metadata.gz: 41146ff0c8599d2d5b769814cb1dedcd7abdefa994a1ff03399088af3b942cb6bc1328c0c0ca9a9786f914cac12634f978c102669ca75088f1da5fa40fb38af2
7
+ data.tar.gz: 045e6e936994e3af5de1fafe09703cb5d3e50640829da6966945a7717ecfc2a1cadc231eebd543f6317bb5f2f32fc0c2edec54d6c1946db05457490ba6bd6d75
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v5.0.5
2
+
3
+ #### Bug fixes & Enhancements
4
+ - [#273](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/273) 'retrieve!' and 'exists?' methods return false for existing Volumes on API500
5
+
1
6
  ## v5.0.4
2
7
 
3
8
  #### Bug fixes & Enhancements
@@ -127,6 +127,25 @@ module OneviewSDK
127
127
  new(client, client.response_handler(response))
128
128
  end
129
129
 
130
+ # Retrieve resource details based on this resource's name or URI.
131
+ # @note one of the UNIQUE_IDENTIFIERS, e.g. name or uri or properties['name'], must be specified in the resource
132
+ # @return [Boolean] Whether or not retrieve was successful
133
+ def retrieve!
134
+ return super unless @data['properties']
135
+ results = find_by_name_in_properties
136
+ return false unless results.size == 1
137
+ set_all(results.first.data)
138
+ true
139
+ end
140
+
141
+ # Check if a resource exists
142
+ # @note one of the UNIQUE_IDENTIFIERS, e.g. name or uri or properties['name'], must be specified in the resource
143
+ # @return [Boolean] Whether or not resource exists
144
+ def exists?
145
+ return super unless @data['properties']
146
+ find_by_name_in_properties.size == 1
147
+ end
148
+
130
149
  private
131
150
 
132
151
  # Gets the storage volume template URI
@@ -151,6 +170,15 @@ module OneviewSDK
151
170
  def generate_snapshot_data(name, description = nil)
152
171
  { description: description, name: name }
153
172
  end
173
+
174
+ # Gets the volume
175
+ # @raise [OneviewSDK::IncompleteResource] if the name parameter is not set
176
+ # @return [Array] the array of volumes
177
+ def find_by_name_in_properties
178
+ name = @data['properties']['name'] || @data['properties'][:name]
179
+ raise IncompleteResource, 'Must set resource name within the properties before trying to retrieve!' unless name
180
+ self.class.find_by(@client, 'name' => name)
181
+ end
154
182
  end
155
183
  end
156
184
  end
@@ -11,5 +11,5 @@
11
11
 
12
12
  # Gem version defined here
13
13
  module OneviewSDK
14
- VERSION = '5.0.4'.freeze
14
+ VERSION = '5.0.5'.freeze
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneview-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Diomede
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-09-22 00:00:00.000000000 Z
14
+ date: 2017-09-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor