Class: Cloudflare::DNS::Records
Constant Summary
Representation::WRAPPER
Instance Method Summary
collapse
Methods included from Paginate
#each, #empty?, #find_by_id
#errors, #messages, #represent, #represent_message, #result, #results, #success?, #to_hash, #to_id
Instance Method Details
#create(type, name, content, **options) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# 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.
if id = result[:id]
resource = resource.with(path: id)
end
Record.new(resource, value: value, metadata: metadata)
end
end
|
#find_by_name(name) ⇒ Object
80
81
82
|
# File 'lib/cloudflare/dns.rb', line 80
def find_by_name(name)
each(name: name).find{|record| record.name == name}
end
|
#representation ⇒ Object
60
61
62
|
# File 'lib/cloudflare/dns.rb', line 60
def representation
Record
end
|