Module: Delphix::Base
- Includes:
- Error
- Included in:
- Database, Environment, Group, Job, Repository, Source, SourceConfig
- Defined in:
- lib/delphix/base.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
Instance Method Summary collapse
- #base_endpoint ⇒ Object
-
#initialize(reference = nil, details = nil) ⇒ Object
The private new method accepts a reference string and a hash.
- #name ⇒ Object
- #reference ⇒ Object
- #refresh_details ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
5 6 7 |
# File 'lib/delphix/base.rb', line 5 def details @details end |
Instance Method Details
#base_endpoint ⇒ Object
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 |
#name ⇒ Object
21 22 23 |
# File 'lib/delphix/base.rb', line 21 def name @details['name'] || '' end |
#reference ⇒ Object
25 26 27 |
# File 'lib/delphix/base.rb', line 25 def reference @details['reference'] || '' end |
#refresh_details ⇒ Object
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_s ⇒ Object
43 44 45 |
# File 'lib/delphix/base.rb', line 43 def to_s "#{self.class.name}[#{type}, #{name}, #{reference}]" end |
#type ⇒ Object
17 18 19 |
# File 'lib/delphix/base.rb', line 17 def type @details['type'] || 'unknown' end |