socketry / cloudflare

An asynchronous Ruby wrapper for the CloudFlare V4 API.
138 stars 86 forks source link

Delete/Update #35

Closed benhill closed 5 years ago

benhill commented 6 years ago

Hello! Thank you for this gem.

Question on DNS record delete syntax...

Tried several options, including this:

zone.dns_records.delete("name" => "ftp", :content_type => "application/json")

And I receive "Method DELETE not available for that URI."

Possible I am doing something obviously wrong.

ioquatix commented 6 years ago

Hmmm, I've never had to do that before. Can you check the API documentation and see what the correct method is?

chainum commented 6 years ago

It's supposed to be invoked like this:

zone.dns_records.find_by_name("ftp.domain.com").delete

Or delete the record by its id:

zone.dns_records.find_by_id("dns_record_id").delete

Or delete all dns records for a zone:

zone.dns_records.all.each(&:delete)

ioquatix commented 5 years ago

Thanks! I will add some specs.