Class: Dynectastic::Zone

Inherits:
Resource show all
Defined in:
lib/dynectastic/zone.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#factory, #last_request, #session

Instance Method Summary collapse

Methods inherited from Resource

#attributes=, #delete, #get, #initialize, #post, #put

Constructor Details

This class inherits a constructor from Dynectastic::Resource

Instance Attribute Details

#contactObject

Returns the value of attribute contact.



5
6
7
# File 'lib/dynectastic/zone.rb', line 5

def contact
  @contact
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/dynectastic/zone.rb', line 5

def name
  @name
end

#serialObject

Returns the value of attribute serial.



5
6
7
# File 'lib/dynectastic/zone.rb', line 5

def serial
  @serial
end

#serial_styleObject

Returns the value of attribute serial_style.



5
6
7
# File 'lib/dynectastic/zone.rb', line 5

def serial_style
  @serial_style
end

#ttlObject

Returns the value of attribute ttl.



5
6
7
# File 'lib/dynectastic/zone.rb', line 5

def ttl
  @ttl
end

#zone_typeObject (readonly)

Returns the value of attribute zone_type.



6
7
8
# File 'lib/dynectastic/zone.rb', line 6

def zone_type
  @zone_type
end

Instance Method Details

#destroyObject



42
43
44
# File 'lib/dynectastic/zone.rb', line 42

def destroy
  factory.destroy(name)
end

#freezeObject



25
26
27
28
29
30
31
# File 'lib/dynectastic/zone.rb', line 25

def freeze
  if factory.freeze(name)
    @frozen = true
  else
    job
  end
end

#frozen?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/dynectastic/zone.rb', line 50

def frozen?
  @frozen
end

#publishObject



17
18
19
20
21
22
23
# File 'lib/dynectastic/zone.rb', line 17

def publish
  if factory.publish(name)
    @published = true
  else
    job
  end
end

#published?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/dynectastic/zone.rb', line 46

def published?
  @published
end

#saveObject



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

def save
  payload = {
    'rname'        => contact,
    'serial_style' => serial,
    'ttl'          => ttl
  }
  self.attributes = post("#{ factory.entity_base }/#{ name }", :body => payload)
end

#unfreezeObject



33
34
35
36
37
38
39
40
# File 'lib/dynectastic/zone.rb', line 33

def unfreeze
  if factory.unfreeze(name)
    @frozen = false
    true
  else
    job
  end
end