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.
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 |
# File 'lib/mockserver/models.rb', line 1374 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.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def dns_class @dns_class end |
#name ⇒ Object
Returns the value of attribute name.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def port @port end |
#priority ⇒ Object
Returns the value of attribute priority.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def priority @priority end |
#ttl ⇒ Object
Returns the value of attribute ttl.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def value @value end |
#weight ⇒ Object
Returns the value of attribute weight.
1371 1372 1373 |
# File 'lib/mockserver/models.rb', line 1371 def weight @weight end |
Class Method Details
.a_record(name, ip) ⇒ Object
1414 1415 1416 |
# File 'lib/mockserver/models.rb', line 1414 def self.a_record(name, ip) new(name: name, type: 'A', value: ip) end |
.aaaa_record(name, ip) ⇒ Object
1418 1419 1420 |
# File 'lib/mockserver/models.rb', line 1418 def self.aaaa_record(name, ip) new(name: name, type: 'AAAA', value: ip) end |
.cname_record(name, cname) ⇒ Object
1422 1423 1424 |
# File 'lib/mockserver/models.rb', line 1422 def self.cname_record(name, cname) new(name: name, type: 'CNAME', value: cname) end |
.from_hash(data) ⇒ Object
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 |
# File 'lib/mockserver/models.rb', line 1399 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
1426 1427 1428 |
# File 'lib/mockserver/models.rb', line 1426 def self.mx_record(name, priority, exchange) new(name: name, type: 'MX', priority: priority, value: exchange) end |
.ptr_record(name, pointer) ⇒ Object
1438 1439 1440 |
# File 'lib/mockserver/models.rb', line 1438 def self.ptr_record(name, pointer) new(name: name, type: 'PTR', value: pointer) end |
.srv_record(name, priority, weight, port, target) ⇒ Object
1430 1431 1432 |
# File 'lib/mockserver/models.rb', line 1430 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
1434 1435 1436 |
# File 'lib/mockserver/models.rb', line 1434 def self.txt_record(name, text) new(name: name, type: 'TXT', value: text) end |
Instance Method Details
#to_h ⇒ Object
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 |
# File 'lib/mockserver/models.rb', line 1386 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 |