Class: Cloudflare::CustomHostnames
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(hostname, metadata: nil, origin: nil, ssl: {}, **options) ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/cloudflare/custom_hostnames.rb', line 82
def create(hostname, metadata: nil, origin: nil, ssl: {}, **options)
payload = {hostname: hostname, ssl: {method: "http", type: "dv"}.merge(ssl), **options}
payload[:custom_metadata] = metadata if metadata
payload[:custom_origin_server] = origin if origin
CustomHostname.post(@resource, payload) do |resource, response|
value = response.read
result = value[:result]
metadata = response.
if id = result[:id]
resource = resource.with(path: id)
end
CustomHostname.new(resource, value: value, metadata: metadata)
end
end
|
#find_by_hostname(hostname) ⇒ Object
101
102
103
|
# File 'lib/cloudflare/custom_hostnames.rb', line 101
def find_by_hostname(hostname)
each(hostname: hostname).first
end
|
#representation ⇒ Object
78
79
80
|
# File 'lib/cloudflare/custom_hostnames.rb', line 78
def representation
CustomHostname
end
|