Module: NS1::API::Records

Defined in:
lib/ns1/api/records.rb

Instance Method Summary collapse

Instance Method Details

#create_record(zone, domain, type, params = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/ns1/api/records.rb', line 13

def create_record(zone, domain, type, params = {})
  raise NS1::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NS1::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NS1::MissingParameter, "type cannot be blank" if blank?(type)
  validate_required!(params, :answers)
  params = params.merge(zone: zone, domain: domain, type: type)
  perform_request(HTTP_PUT, "/v1/zones/#{zone}/#{domain}/#{type}", params)
end

#delete_record(zone, domain, type) ⇒ Object



29
30
31
32
33
34
# File 'lib/ns1/api/records.rb', line 29

def delete_record(zone, domain, type)
  raise NS1::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NS1::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NS1::MissingParameter, "type cannot be blank" if blank?(type)
  perform_request(HTTP_DELETE, "/v1/zones/#{zone}/#{domain}/#{type}")
end

#modify_record(zone, domain, type, params) ⇒ Object



22
23
24
25
26
27
# File 'lib/ns1/api/records.rb', line 22

def modify_record(zone, domain, type, params)
  raise NS1::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NS1::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NS1::MissingParameter, "type cannot be blank" if blank?(type)
  perform_request(HTTP_POST, "/v1/zones/#{zone}/#{domain}/#{type}", params)
end

#record(zone, domain, type) ⇒ Object



6
7
8
9
10
11
# File 'lib/ns1/api/records.rb', line 6

def record(zone, domain, type)
  raise NS1::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NS1::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NS1::MissingParameter, "type cannot be blank" if blank?(type)
  perform_request(HTTP_GET, "/v1/zones/#{zone}/#{domain}/#{type}")
end