Class: TortoiseLabs::DNS::Record
- Inherits:
-
Object
- Object
- TortoiseLabs::DNS::Record
- Defined in:
- lib/tortoiselabs/dns.rb
Overview
DNS record class
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prio ⇒ Object
readonly
Returns the value of attribute prio.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#zoneid ⇒ Object
Returns the value of attribute zoneid.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(rhash) ⇒ Record
constructor
A new instance of Record.
- #modify(new_content, subdomain = @name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(rhash) ⇒ Record
Returns a new instance of Record.
71 72 73 74 |
# File 'lib/tortoiselabs/dns.rb', line 71 def initialize(rhash) @id, @name, @content = rhash["id"], rhash["name"], rhash["content"] @prio, @ttl, @type = rhash["prio"], rhash["ttl"], rhash["type"] end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def name @name end |
#prio ⇒ Object (readonly)
Returns the value of attribute prio.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def prio @prio end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def ttl @ttl end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
68 69 70 |
# File 'lib/tortoiselabs/dns.rb', line 68 def type @type end |
#zoneid ⇒ Object
Returns the value of attribute zoneid.
69 70 71 |
# File 'lib/tortoiselabs/dns.rb', line 69 def zoneid @zoneid end |
Instance Method Details
#delete ⇒ Object
82 83 84 85 |
# File 'lib/tortoiselabs/dns.rb', line 82 def delete resp = TortoiseLabs::Client.get("/dns/zone/#{@zoneid}/record/#{@id}/delete") Zone.new(JSON.parse(resp)["zone"]) end |
#modify(new_content, subdomain = @name) ⇒ Object
76 77 78 79 80 |
# File 'lib/tortoiselabs/dns.rb', line 76 def modify(new_content, subdomain = @name) TortoiseLabs::Client.post("/dns/zone/#{@zoneid}/record/#{@id}", {:content => new_content, :subdomain => subdomain}) Zone.list.values.select { |z| z.id == zoneid }[0] end |
#to_s ⇒ Object
87 88 89 |
# File 'lib/tortoiselabs/dns.rb', line 87 def to_s "#{@type}:#{@name}" end |