Class: Delphix::Response

Inherits:
Object
  • Object
show all
Includes:
Error
Defined in:
lib/delphix/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details = {}) ⇒ Response

The private new method accepts a reference string and a hash



8
9
10
# File 'lib/delphix/response.rb', line 8

def initialize(details={})
  @details = details
end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



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

def details
  @details
end

Instance Method Details

#is_error?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/delphix/response.rb', line 24

def is_error?
  @details['type'] == 'ErrorResult'
end

#jobObject



28
29
30
31
# File 'lib/delphix/response.rb', line 28

def job
  return nil if @details['job'] == nil
  Delphix::Job.new( @details['job'])
end

#statusObject



16
17
18
# File 'lib/delphix/response.rb', line 16

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

#to_sObject



38
39
40
# File 'lib/delphix/response.rb', line 38

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

#typeObject



12
13
14
# File 'lib/delphix/response.rb', line 12

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

#wait_for_completionObject



33
34
35
36
# File 'lib/delphix/response.rb', line 33

def wait_for_completion
  return if is_error?
  job.wait_for_completion if job
end