Sha256: c61bba73f7d458e514f14a49e0eef9eeaf81bfbaec099f3a80bd16d93716acf4

Contents?: true

Size: 956 Bytes

Versions: 13

Compression:

Stored size: 956 Bytes

Contents

# frozen_string_literal: true

require_relative "base"

module Neetob
  class CLI
    module Cloudflare
      class AlwaysUseHttps < Base
        attr_accessor :domain

        def initialize(domain)
          super()
          @domain = domain
        end

        def run
          zone_id = ZONE_IDS[domain.to_sym]
          unless Thread.current[:audit_mode]
            raise(StandardError, "Domain '#{domain}' not found.") if zone_id.nil?
          end

          url = create_url(zone_id, "settings/always_use_https")
          response = get(url)
          always_use_https = response[:result][:value] == "on" ?
            print_success(response[:result][:value]) :
            print_failure(response[:result][:value])
          ui.info("Always use HTTPS is turned #{always_use_https}", print_to_audit_log: false)
          if Thread.current[:audit_mode]
            response[:result][:value]
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
neetob-0.5.29 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.28 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.27 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.26 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.25 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.24 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.23 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.22 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.21 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.20 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.19 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.18 lib/neetob/cli/cloudflare/always_use_https.rb
neetob-0.5.17 lib/neetob/cli/cloudflare/always_use_https.rb