Class: OpsmanagerClient::Client::Internals::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/opsmanager_client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Job

Returns a new instance of Job.



20
21
22
23
24
25
26
# File 'lib/opsmanager_client/client.rb', line 20

def initialize(opts={})
  @type       = opts.fetch('identifier')
  @guid       = opts.fetch('guid')
  @properties = Hash[opts.fetch('properties', {}).map{|property| [property.fetch('identifier'), property.fetch('value',nil)] }]
  @product    = opts.fetch('product')
  @partitions = opts.fetch('partitions', []).map{|p| JobPartition.new(p) }
end

Instance Attribute Details

#guidObject (readonly)

Returns the value of attribute guid.



28
29
30
# File 'lib/opsmanager_client/client.rb', line 28

def guid
  @guid
end

#partitionsObject (readonly)

Returns the value of attribute partitions.



28
29
30
# File 'lib/opsmanager_client/client.rb', line 28

def partitions
  @partitions
end

#productObject (readonly)

Returns the value of attribute product.



28
29
30
# File 'lib/opsmanager_client/client.rb', line 28

def product
  @product
end

#propertiesObject (readonly)

Returns the value of attribute properties.



28
29
30
# File 'lib/opsmanager_client/client.rb', line 28

def properties
  @properties
end

#typeObject (readonly)

Returns the value of attribute type.



28
29
30
# File 'lib/opsmanager_client/client.rb', line 28

def type
  @type
end

Instance Method Details

#ipsObject



30
31
32
# File 'lib/opsmanager_client/client.rb', line 30

def ips
  product.ips.values_at(*partitions.map(&:guid)).flatten.compact.uniq
end