Class: Cloudflare::CustomHostname
- Inherits:
-
Representation
- Object
- Async::REST::Representation
- Representation
- Cloudflare::CustomHostname
- 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
Instance Method Summary collapse
-
#custom_metadata ⇒ Object
Only available if enabled for your zone.
-
#custom_origin ⇒ Object
Only available if enabled for your zone.
- #hostname ⇒ Object (also: #to_s)
- #id ⇒ Object
- #ssl ⇒ Object
-
#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.
- #update_settings(metadata: nil, origin: nil, ssl: nil) ⇒ Object
Methods inherited from Representation
#errors, #messages, #represent, #represent_message, #representation, #result, #results, #success?, #to_hash, #to_id
Instance Method Details
#custom_metadata ⇒ Object
Only available if enabled for your zone
21 22 23 |
# File 'lib/cloudflare/custom_hostnames.rb', line 21 def result[:custom_metadata] end |
#custom_origin ⇒ Object
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 |
#hostname ⇒ Object Also known as: to_s
25 26 27 |
# File 'lib/cloudflare/custom_hostnames.rb', line 25 def hostname result[:hostname] end |
#id ⇒ Object
29 30 31 |
# File 'lib/cloudflare/custom_hostnames.rb', line 29 def id result[:id] end |
#ssl ⇒ Object
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
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 |