Module: Delphix::Base

Includes:
Error
Included in:
Database, Environment, Group, Job, Repository, Source, SourceConfig
Defined in:
lib/delphix/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



5
6
7
# File 'lib/delphix/base.rb', line 5

def details
  @details
end

Instance Method Details

#base_endpointObject



39
40
41
# File 'lib/delphix/base.rb', line 39

def base_endpoint
  # Placeholder. Subclasses need to implement this
end

#initialize(reference = nil, details = nil) ⇒ Object

The private new method accepts a reference string and a hash



8
9
10
11
12
13
14
15
# File 'lib/delphix/base.rb', line 8

def initialize(reference=nil, details=nil)
  # FIXME change this, passing the reference does not make sense !!!
  if details == nil
    @details = { 'reference' => reference }
  else
    @details = details
  end
end

#nameObject



21
22
23
# File 'lib/delphix/base.rb', line 21

def name
  @details['name'] || ''
end

#referenceObject



25
26
27
# File 'lib/delphix/base.rb', line 25

def reference
  @details['reference'] || ''
end

#refresh_detailsObject



34
35
36
37
# File 'lib/delphix/base.rb', line 34

def refresh_details
  # TODO Subclasses should override this if needed
  @details = Delphix.get("#{base_endpoint}/#{reference}")['result']
end

#to_sObject



43
44
45
# File 'lib/delphix/base.rb', line 43

def to_s
  "#{self.class.name}[#{type}, #{name}, #{reference}]"
end

#typeObject



17
18
19
# File 'lib/delphix/base.rb', line 17

def type
  @details['type'] || 'unknown'
end