Class: Softlayer::Mock::Dns::Domain

Inherits:
Softlayer::Mock show all
Defined in:
lib/softlayer/mock/dns/domain.rb,
lib/softlayer/mock/dns/domain/resource_record/soa_type.rb

Defined Under Namespace

Classes: ResourceRecord

Instance Attribute Summary

Attributes inherited from Softlayer::Mock

#id

Class Method Summary collapse

Methods inherited from Softlayer::Mock

add_attributes, all, find, find_by_key, get_class_from_return_object, message_to_params, request, save_on_database

Class Method Details

.create_object(attrs = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/softlayer/mock/dns/domain.rb', line 5

def self.create_object(attrs=nil)
  domain = add_attributes(attrs)
  resource_record = ResourceRecord::SoaType
  domain.resource_records = []
  resource_record_attrs = {
    :data => "ns1.softlayer.com.",
    :domain_id => 1846064,
    :expire => 604800,
    :host => "@",
    :id => all.length + 1,
    :minimum => 3600,
    :refresh => 3600,
    :responsible_person => "root.#{domain.name}.",
    :retry => 300,
    :ttl => 86400,
    :type => "SOA",
    :domain => "*1"
  }
  domain.resource_records.push(resource_record.create_object(resource_record_attrs))
  domain.resource_records.push(resource_record.find('ns1'))
  domain.resource_records.push(resource_record.find('ns2'))
  key = domain.name.split(".")[0]
  save_on_database(key,domain)
end