Method: Fog::DNS::Dynect::Mock#delete_record

Defined in:
lib/fog/dynect/requests/dns/delete_record.rb

#delete_record(type, zone, fqdn, record_id) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/dynect/requests/dns/delete_record.rb', line 24

def delete_record(type, zone, fqdn, record_id)
  raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]

  raise Fog::DNS::Dynect::NotFound unless zone[:records][type].find { |record| record[:fqdn] == fqdn && record[:record_id] == record_id.to_i }

  zone[:records_to_delete] << {
    :type => type,
    :fqdn => fqdn,
    :record_id => record_id.to_i
  }

  response = Excon::Response.new
  response.status = 200

  response.body = {
    "status" => "success",
    "data" => {},
    "job_id" => Fog::Dynect::Mock.job_id,
    "msgs" => [{
      "INFO" => "delete: Record will be deleted on zone publish",
      "SOURCE" => "BLL",
      "ERR_CD" => nil,
      "LVL" => "INFO"
    }]
  }

  response
end