Class: Opsmgr::Api::ProductManifestResult

Inherits:
Result
  • Object
show all
Defined in:
lib/opsmgr/api/results.rb

Defined Under Namespace

Classes: Product, Stemcell

Instance Attribute Summary

Attributes inherited from Result

#message

Instance Method Summary collapse

Methods inherited from Result

#success?

Constructor Details

#initialize(manifest_hash) ⇒ ProductManifestResult

Returns a new instance of ProductManifestResult.



213
214
215
# File 'lib/opsmgr/api/results.rb', line 213

def initialize(manifest_hash)
  @manifest_hash = manifest_hash
end

Instance Method Details

#releasesObject



217
218
219
# File 'lib/opsmgr/api/results.rb', line 217

def releases
  manifest_hash.fetch('releases').map { |h| Product.new(h.fetch('name'), h.fetch('version')) }
end

#stemcellObject



221
222
223
224
# File 'lib/opsmgr/api/results.rb', line 221

def stemcell
  stemcell_hash = manifest_hash.fetch('resource_pools').first.fetch('stemcell')
  Stemcell.new(stemcell_hash.fetch('name'), stemcell_hash.fetch('version'))
end