Class: MockServer::DnsRecord
- Inherits:
-
Object
- Object
- MockServer::DnsRecord
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#dns_class ⇒ Object
Returns the value of attribute dns_class.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
-
#weight ⇒ Object
Returns the value of attribute weight.
Class Method Summary collapse
- .a_record(name, ip) ⇒ Object
- .aaaa_record(name, ip) ⇒ Object
- .cname_record(name, cname) ⇒ Object
- .from_hash(data) ⇒ Object
- .mx_record(name, priority, exchange) ⇒ Object
- .ptr_record(name, pointer) ⇒ Object
- .srv_record(name, priority, weight, port, target) ⇒ Object
- .txt_record(name, text) ⇒ Object
Instance Method Summary collapse
-
#initialize(name: nil, type: nil, dns_class: nil, ttl: nil, value: nil, priority: nil, weight: nil, port: nil) ⇒ DnsRecord
constructor
A new instance of DnsRecord.
- #to_h ⇒ Object
Constructor Details
#initialize(name: nil, type: nil, dns_class: nil, ttl: nil, value: nil, priority: nil, weight: nil, port: nil) ⇒ DnsRecord
Returns a new instance of DnsRecord.
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 |
# File 'lib/mockserver/models.rb', line 1707 def initialize(name: nil, type: nil, dns_class: nil, ttl: nil, value: nil, priority: nil, weight: nil, port: nil) @name = name @type = type @dns_class = dns_class @ttl = ttl @value = value @priority = priority @weight = weight @port = port end |
Instance Attribute Details
#dns_class ⇒ Object
Returns the value of attribute dns_class.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def dns_class @dns_class end |
#name ⇒ Object
Returns the value of attribute name.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def port @port end |
#priority ⇒ Object
Returns the value of attribute priority.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def priority @priority end |
#ttl ⇒ Object
Returns the value of attribute ttl.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def value @value end |
#weight ⇒ Object
Returns the value of attribute weight.
1704 1705 1706 |
# File 'lib/mockserver/models.rb', line 1704 def weight @weight end |
Class Method Details
.a_record(name, ip) ⇒ Object
1747 1748 1749 |
# File 'lib/mockserver/models.rb', line 1747 def self.a_record(name, ip) new(name: name, type: 'A', value: ip) end |
.aaaa_record(name, ip) ⇒ Object
1751 1752 1753 |
# File 'lib/mockserver/models.rb', line 1751 def self.aaaa_record(name, ip) new(name: name, type: 'AAAA', value: ip) end |
.cname_record(name, cname) ⇒ Object
1755 1756 1757 |
# File 'lib/mockserver/models.rb', line 1755 def self.cname_record(name, cname) new(name: name, type: 'CNAME', value: cname) end |
.from_hash(data) ⇒ Object
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 |
# File 'lib/mockserver/models.rb', line 1732 def self.from_hash(data) return nil if data.nil? new( name: data['name'], type: data['type'], dns_class: data['dnsClass'], ttl: data['ttl'], value: data['value'], priority: data['priority'], weight: data['weight'], port: data['port'] ) end |
.mx_record(name, priority, exchange) ⇒ Object
1759 1760 1761 |
# File 'lib/mockserver/models.rb', line 1759 def self.mx_record(name, priority, exchange) new(name: name, type: 'MX', priority: priority, value: exchange) end |
.ptr_record(name, pointer) ⇒ Object
1771 1772 1773 |
# File 'lib/mockserver/models.rb', line 1771 def self.ptr_record(name, pointer) new(name: name, type: 'PTR', value: pointer) end |
.srv_record(name, priority, weight, port, target) ⇒ Object
1763 1764 1765 |
# File 'lib/mockserver/models.rb', line 1763 def self.srv_record(name, priority, weight, port, target) new(name: name, type: 'SRV', priority: priority, weight: weight, port: port, value: target) end |
.txt_record(name, text) ⇒ Object
1767 1768 1769 |
# File 'lib/mockserver/models.rb', line 1767 def self.txt_record(name, text) new(name: name, type: 'TXT', value: text) end |
Instance Method Details
#to_h ⇒ Object
1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 |
# File 'lib/mockserver/models.rb', line 1719 def to_h result = {} result['name'] = @name unless @name.nil? result['type'] = @type unless @type.nil? result['dnsClass'] = @dns_class unless @dns_class.nil? result['ttl'] = @ttl unless @ttl.nil? result['value'] = @value unless @value.nil? result['priority'] = @priority unless @priority.nil? result['weight'] = @weight unless @weight.nil? result['port'] = @port unless @port.nil? result end |