Class: Cloudflare::CustomHostnames

Inherits:
Representation
  • Object
show all
Includes:
Paginate
Defined in:
lib/cloudflare/custom_hostnames.rb

Instance Method Summary collapse

Methods included from Paginate

#each, #empty?, #find_by_id

Methods inherited from Representation

#process_response, #represent, #represent_message, #to_hash

Instance Method Details

#create(hostname, metadata: nil, origin: nil, ssl: {}, &block) ⇒ Object

initializes a custom hostname object and yields it for customization before saving



70
71
72
73
74
75
76
# File 'lib/cloudflare/custom_hostnames.rb', line 70

def create(hostname, metadata: nil, origin: nil, ssl: {}, &block)
	attrs = { hostname: hostname, ssl: { method: 'http', type: 'dv' }.merge(ssl) }
	attrs[:custom_metadata] =  if 
	attrs[:custom_origin_server] = origin if origin

	represent_message(self.post(attrs))
end

#find_by_hostname(hostname) ⇒ Object



78
79
80
# File 'lib/cloudflare/custom_hostnames.rb', line 78

def find_by_hostname(hostname)
	each(hostname: hostname).first
end

#representationObject



65
66
67
# File 'lib/cloudflare/custom_hostnames.rb', line 65

def representation
	CustomHostname
end