Class: Delphix::Response
- Inherits:
-
Object
- Object
- Delphix::Response
- Includes:
- Error
- Defined in:
- lib/delphix/response.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
Instance Method Summary collapse
-
#initialize(details = {}) ⇒ Response
constructor
The private new method accepts a reference string and a hash.
- #is_error? ⇒ Boolean
- #job ⇒ Object
- #status ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #wait_for_completion ⇒ Object
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
#details ⇒ Object
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
24 25 26 |
# File 'lib/delphix/response.rb', line 24 def is_error? @details['type'] == 'ErrorResult' end |
#job ⇒ Object
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 |
#status ⇒ Object
16 17 18 |
# File 'lib/delphix/response.rb', line 16 def status @details['status'] || 'unknown' end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/delphix/response.rb', line 38 def to_s "#{self.class.name}[#{type}, #{status}]" end |
#type ⇒ Object
12 13 14 |
# File 'lib/delphix/response.rb', line 12 def type @details['type'] || 'unknown' end |
#wait_for_completion ⇒ Object
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 |