Class: Myra::DnsRecord
- Inherits:
-
Object
- Object
- Myra::DnsRecord
- Defined in:
- lib/myra/objects/dns_record.rb
Defined Under Namespace
Classes: Type
Constant Summary collapse
- PATH =
'/dnsRecords'
- MAP =
{ # response field => target field 'name' => 'name', 'value' => 'value', 'ttl' => 'ttl', 'alternativeCname' => 'alternative_cname', 'active' => 'active', 'recordType' => 'type' }.freeze
Instance Attribute Summary collapse
-
#active ⇒ Object
(also: #active?)
Returns the value of attribute active.
-
#alternative_cname ⇒ Object
Returns the value of attribute alternative_cname.
-
#created ⇒ Object
Returns the value of attribute created.
-
#deleted ⇒ Object
writeonly
Sets the attribute deleted.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #deleted? ⇒ Boolean
-
#initialize(id: nil) ⇒ DnsRecord
constructor
A new instance of DnsRecord.
- #to_hash ⇒ Object
Constructor Details
Instance Attribute Details
#active ⇒ Object Also known as: active?
Returns the value of attribute active.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def active @active end |
#alternative_cname ⇒ Object
Returns the value of attribute alternative_cname.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def alternative_cname @alternative_cname end |
#created ⇒ Object
Returns the value of attribute created.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def created @created end |
#deleted=(value) ⇒ Object (writeonly)
Sets the attribute deleted
15 16 17 |
# File 'lib/myra/objects/dns_record.rb', line 15 def deleted=(value) @deleted = value end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/myra/objects/dns_record.rb', line 12 def id @id end |
#modified ⇒ Object
Returns the value of attribute modified.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def modified @modified end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def name @name end |
#ttl ⇒ Object
Returns the value of attribute ttl.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
13 14 15 |
# File 'lib/myra/objects/dns_record.rb', line 13 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/myra/objects/dns_record.rb', line 37 def self.from_hash(hash) domain = new(id: hash['id']) hash.each do |k, v| next unless MAP.key? k domain.send "#{MAP[k]}=", v end domain.modified = DateTime.parse(hash['modified']) domain.created = DateTime.parse(hash['created']) domain end |
Instance Method Details
#deleted? ⇒ Boolean
53 54 55 |
# File 'lib/myra/objects/dns_record.rb', line 53 def deleted? @deleted end |
#to_hash ⇒ Object
48 49 50 51 |
# File 'lib/myra/objects/dns_record.rb', line 48 def to_hash return new_record_hash if id.nil? record_hash end |