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.
1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 |
# File 'lib/mockserver/models.rb', line 1346 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.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def dns_class @dns_class end |
#name ⇒ Object
Returns the value of attribute name.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def port @port end |
#priority ⇒ Object
Returns the value of attribute priority.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def priority @priority end |
#ttl ⇒ Object
Returns the value of attribute ttl.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def value @value end |
#weight ⇒ Object
Returns the value of attribute weight.
1343 1344 1345 |
# File 'lib/mockserver/models.rb', line 1343 def weight @weight end |
Class Method Details
.a_record(name, ip) ⇒ Object
1386 1387 1388 |
# File 'lib/mockserver/models.rb', line 1386 def self.a_record(name, ip) new(name: name, type: 'A', value: ip) end |
.aaaa_record(name, ip) ⇒ Object
1390 1391 1392 |
# File 'lib/mockserver/models.rb', line 1390 def self.aaaa_record(name, ip) new(name: name, type: 'AAAA', value: ip) end |
.cname_record(name, cname) ⇒ Object
1394 1395 1396 |
# File 'lib/mockserver/models.rb', line 1394 def self.cname_record(name, cname) new(name: name, type: 'CNAME', value: cname) end |
.from_hash(data) ⇒ Object
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 |
# File 'lib/mockserver/models.rb', line 1371 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
1398 1399 1400 |
# File 'lib/mockserver/models.rb', line 1398 def self.mx_record(name, priority, exchange) new(name: name, type: 'MX', priority: priority, value: exchange) end |
.ptr_record(name, pointer) ⇒ Object
1410 1411 1412 |
# File 'lib/mockserver/models.rb', line 1410 def self.ptr_record(name, pointer) new(name: name, type: 'PTR', value: pointer) end |
.srv_record(name, priority, weight, port, target) ⇒ Object
1402 1403 1404 |
# File 'lib/mockserver/models.rb', line 1402 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
1406 1407 1408 |
# File 'lib/mockserver/models.rb', line 1406 def self.txt_record(name, text) new(name: name, type: 'TXT', value: text) end |
Instance Method Details
#to_h ⇒ Object
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 |
# File 'lib/mockserver/models.rb', line 1358 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 |