Class: Delphix::Group

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/delphix/group.rb

Instance Attribute Summary

Attributes included from Base

#details

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#name, #reference, #refresh_details, #to_s, #type

Constructor Details

#initialize(reference, details = nil) ⇒ Group

Returns a new instance of Group.



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

def initialize(reference, details=nil)
  super(reference, details)
end

Class Method Details

.create(name) ⇒ Object

class methods



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/delphix/group.rb', line 25

def self.create(name)
  body = {
    :type => 'Group',
    :name => name
  }
  ref = Delphix.post('/resources/json/delphix/group', body.to_json)['result']

  # create a new skeleton group object
  group = Delphix::Group.new ref

  # refresh the object from DE
  group.refresh_details

  group
end

.listObject



41
42
43
44
45
46
47
48
# File 'lib/delphix/group.rb', line 41

def self.list
  groups = Delphix::BaseArray.new
  result = Delphix.get('/resources/json/delphix/group')['result']
  result.each do |group|
    groups << Delphix::Group.new(group['reference'],group)
  end
  groups
end

Instance Method Details

#base_endpointObject

inherited operations



19
20
21
# File 'lib/delphix/group.rb', line 19

def base_endpoint
  '/resources/json/delphix/group'
end

#deleteObject

basic operations



11
12
13
# File 'lib/delphix/group.rb', line 11

def delete
  Delphix::Response.new( Delphix.delete("#{base_endpoint}/#{reference}"))
end