Sha256: ef09a6ab8b9c21324731362464729d3bbc901805b3365b7f302e6a86fab4f59b

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module Cloudflare
	class CustomHostname < Representation
		class SSLAttribute
			class Settings
				def initialize(settings)
					@settings = settings
				end

				def ciphers
					@settings[:ciphers]
				end

				def ciphers=(value)
					@settings[:ciphers] = value
				end

				# This will return the raw value, it is needed because
				# if a value is nil we can't assume that it means it is off
				def http2
					@settings[:http2]
				end

				# Always coerce into a boolean, if the key is not
				# provided, this value may not be accurate
				def http2?
					http2 == 'on'
				end

				def http2=(value)
					process_boolean(:http2, value)
				end

				def min_tls_version
					@settings[:min_tls_version]
				end

				def min_tls_version=(value)
					@settings[:min_tls_version] = value
				end

				# This will return the raw value, it is needed because
				# if a value is nil we can't assume that it means it is off
				def tls_1_3
					@settings[:tls_1_3]
				end

				# Always coerce into a boolean, if the key is not
				# provided, this value may not be accurate
				def tls_1_3?
					tls_1_3 == 'on'
				end

				def tls_1_3=(value)
					process_boolean(:tls_1_3, value)
				end

				private

				def process_boolean(key, value)
					if value.nil?
						@settings.delete(key)
					else
						@settings[key] = !value || value == 'off' ? 'off' : 'on'
					end
				end
			end
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cloudflare-4.3.0 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.2.1 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.2.0 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.1.3 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.1.2 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.1.1 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
cloudflare-4.1.0 lib/cloudflare/custom_hostname/ssl_attribute/settings.rb