class Cloudflare::CustomHostnames

Public Instance Methods

create(hostname, metadata: nil, origin: nil, ssl: {}, **options) click to toggle source
# 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.headers
                
                if id = result[:id]
                        resource = resource.with(path: id)
                end
                
                CustomHostname.new(resource, value: value, metadata: metadata)
        end
end
find_by_hostname(hostname) click to toggle source
# File lib/cloudflare/custom_hostnames.rb, line 101
def find_by_hostname(hostname)
        each(hostname: hostname).first
end
representation() click to toggle source
# File lib/cloudflare/custom_hostnames.rb, line 78
def representation
        CustomHostname
end