Class: Cloudflare::CustomHostname

Inherits:
Representation
  • Object
show all
Includes:
Async::REST::Representation::Mutable
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

Constant Summary

Constants inherited from Representation

Representation::WRAPPER

Instance Method Summary collapse

Methods inherited from Representation

#errors, #messages, #represent, #represent_message, #representation, #result, #results, #success?, #to_hash, #to_id

Instance Method Details

#custom_metadataObject

Only available if enabled for your zone



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

def 
	result[:custom_metadata]
end

#custom_originObject

Only available if enabled for your zone



16
17
18
# File 'lib/cloudflare/custom_hostnames.rb', line 16

def custom_origin
	result[:custom_origin_server]
end

#hostnameObject Also known as: to_s



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

def hostname
	result[:hostname]
end

#idObject



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

def id
	result[:id]
end

#sslObject



33
34
35
# File 'lib/cloudflare/custom_hostnames.rb', line 33

def ssl
	@ssl ||= SSLAttribute.new(result[: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)


39
40
41
42
43
44
45
# File 'lib/cloudflare/custom_hostnames.rb', line 39

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

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



47
48
49
50
51
52
53
54
55
# File 'lib/cloudflare/custom_hostnames.rb', line 47

def update_settings(metadata: nil, origin: nil, ssl: nil)
	payload = {}
	
	payload[:custom_metadata] =  if 
	payload[:custom_origin_server] = origin if origin
	payload[:ssl] = ssl if ssl
	
	self.patch(payload)
end