Class: Cloudflare::CustomHostname

Inherits:
Representation
  • Object
show all
Defined in:
lib/cloudflare/custom_hostnames.rb,
lib/cloudflare/custom_hostname/ssl_attribute.rb,
lib/cloudflare/custom_hostname/ssl_attribute/settings.rb

Defined Under Namespace

Classes: SSLAttribute

Instance Method Summary collapse

Methods inherited from Representation

#process_response, #represent, #represent_message, #representation, #to_hash

Instance Method Details

#custom_metadataObject

Only available if enabled for your zone



18
19
20
# File 'lib/cloudflare/custom_hostnames.rb', line 18

def 
	value[:custom_metadata]
end

#custom_originObject

Only available if enabled for your zone



13
14
15
# File 'lib/cloudflare/custom_hostnames.rb', line 13

def custom_origin
	value[:custom_origin_server]
end

#hostnameObject Also known as: to_s



22
23
24
# File 'lib/cloudflare/custom_hostnames.rb', line 22

def hostname
	value[:hostname]
end

#idObject



26
27
28
# File 'lib/cloudflare/custom_hostnames.rb', line 26

def id
	value[:id]
end

#sslObject



30
31
32
# File 'lib/cloudflare/custom_hostnames.rb', line 30

def ssl
	@ssl ||= SSLAttribute.new(value[:ssl])
end

#ssl_active?(force_update = false) ⇒ Boolean

Check if the cert has been validated passing true will send a request to Cloudflare to try to validate the cert

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/cloudflare/custom_hostnames.rb', line 36

def ssl_active?(force_update = false)
	send_patch(ssl: { method: ssl.method, type: ssl.type }) if force_update && ssl.pending_validation?
	ssl.active?
end

#update_settings(metadata: nil, origin: nil, ssl: nil) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/cloudflare/custom_hostnames.rb', line 41

def update_settings(metadata: nil, origin: nil, ssl: nil)
	attrs = {}
	attrs[:custom_metadata] =  if 
	attrs[:custom_origin_server] = origin if origin
	attrs[:ssl] = ssl if ssl

	send_patch(attrs)
end