Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quick update to signalflare using API v4 wrapper
require 'rubyflare'
ip = { content: `curl -s`.chomp }
zone_name = ""
hostnames = ['', '', '']
email = 'EMAIL-HERE'
api_key = 'API-KEY-HERE'
cloudflare = Rubyflare.connect_with(email, api_key)
zone_id = cloudflare.get('zones'){ |z| z[:name] == zone_name }.first[:id]
records = cloudflare.get("zones/#{zone_id}/dns_records") { |r| hostnames.include? r[:name] }
records.each do |record|
dns_record = cloudflare.put("zones/#{zone_id}/dns_records/#{record[:id]}", record.merge(ip))
p dns_record.result
rescue => e
p e.response
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.