Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namedotcom_update
require 'name_dot_com_api'
require 'pp'
api_token = "honoka"
api_token_ = "umi"
username = "umichankawaii-ote"
username_ = "umichankawaii"
record_id = ""
#
# Get global ip address
#
client = NameDotComApi::Client.new(username_,api_token_)
res = client.hello
current_ip = res['client_ip']
#
# Get dns records
#
res = client.list_dns_records('umichankawaii.org')
res['records'].each do | record |
record_id = record['record_id'] if record['name'] == "umi.umichankawaii.org" && record['type'] == "A"
end
#
# Delete a dns record
#
res = client.delete_dns_record("umichankawaii.org",record_id.to_i)
#
# Add a dns record
#
res = client.add_dns_record("umichankawaii.org","umi","A",current_ip,300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.