socketry/cloudflare

Updating entry with DNS and HTTP Proxy (CDN)

brunchybit opened this issue · 4 comments

Not sure if this is something I'm missing in the options for managing records with cloudflare, or if this is something missing in the gem, but whenever I manage a record via the gem, the setting for DNS and HTTP proxy (CDN) is toggled to off.
screen shot 2016-06-30 at 10 29 56 am

Is there an option I'm missing, or is this not supported by the current implementation on the gem?

Thanks for the assistance.

This is something we should test.

I think the latest version should fix this using the v4 API.

FYI, the following code results in the proxied feature being disabled:

connection = Cloudflare.connect(key: key, email: email)
zone = connection.zones.find_by_name('example.com')
existing_record = zone.dns_records.find_by_name('batman.example.com')
if existing_record
  existing_record.update_content('192.168.1.2')
end

This works:

connection = Cloudflare.connect(key: key, email: email)
zone = connection.zones.find_by_name('example.com')
existing_record = zone.dns_records.find_by_name('batman.example.com')
if existing_record
  existing_record.put(
    {
      'type': 'A',
      'name': 'batman',
      'content': '192.168.1.2',
      'proxied': true
    }.to_json,
    :content_type => 'application/json'
  )
end

Do you want to submit a PR?