Sha256: f2bd613702023cb39bb201821d0ee1c6e93dfe9806fe447abb7ce7a12b80e43d

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

module Lumberg
  module Cpanel
    # Public: Allows users to create and manage redirects
    class Redirect < Base
      def self.api_module; "Mime"; end

      # Public: List redirects parsed from your various .htaccess files in
      # human-readable form
      #
      # options - Hash options for API call params (default: {})
      #   :regex - String value to filter results by applying perl regurlar
      #            expressions to the "sourceurl" output key, and accepts a
      #            simple string also (default: '')
      #
      # Returns Hash API response
      def list(options = {})
        perform_request({ :api_function => 'listredirects' }.merge(options))
      end

      # Public: This function returns either the domain name entered or '** All
      # Public Domains **'.
      #
      # options - Hash options for API call params (default: {})
      #   :domain - String value. If a domain name is entered, it will be
      #             returned. If this is set to '.*', '** All Public Domains **'
      #             will be returned. (default: '')
      #   :url - String value. If a url is entered, it will be returned. If this
      #          is set to '.*' or '(.*)', '** All Requests **' will be
      #          returned (default: '')
      #
      # Returns Hash API response
      def show(options = {})
        if options[:domain] && options[:url]
          raise ArgumentError,
            "#{self.class.name}##{__method__} cannot accept both `:url` and `:domain`"
        end
        function = options[:domain].present? ? 'redirectname' : 'redirecturlname'
        perform_request({ :api_function => function }.merge(options))
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lumberg-2.0.0.pre4 lib/lumberg/cpanel/redirect.rb
lumberg-2.0.0.pre3 lib/lumberg/cpanel/redirect.rb