class Cloudflare::DNS::Records

Public Instance Methods

create(type, name, content, **options) click to toggle source
# File lib/cloudflare/dns.rb, line 64
def create(type, name, content, **options)
        payload = {type: type, name: name, content: content, **options}
        
        Record.post(@resource, payload) do |resource, response|
                value = response.read
                result = value[:result]
                metadata = response.headers
                
                if id = result[:id]
                        resource = resource.with(path: id)
                end
                
                Record.new(resource, value: value, metadata: metadata)
        end
end
find_by_name(name) click to toggle source
# File lib/cloudflare/dns.rb, line 80
def find_by_name(name)
        each(name: name).find{|record| record.name == name}
end
representation() click to toggle source
# File lib/cloudflare/dns.rb, line 60
def representation
        Record
end