Class: Lumberg::Cpanel::Redirect
- Defined in:
- lib/lumberg/cpanel/redirect.rb
Overview
Public: Allows users to create and manage redirects
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Whm::Base
Class Method Summary collapse
Instance Method Summary collapse
-
#list(options = {}) ⇒ Object
Public: List redirects parsed from your various .htaccess files in human-readable form.
-
#show(options = {}) ⇒ Object
Public: This function returns either the domain name entered or ‘** All Public Domains **’.
Methods inherited from Base
Methods inherited from Whm::Base
Constructor Details
This class inherits a constructor from Lumberg::Cpanel::Base
Class Method Details
.api_module ⇒ Object
5 |
# File 'lib/lumberg/cpanel/redirect.rb', line 5 def self.api_module; "Mime"; end |
Instance Method Details
#list(options = {}) ⇒ Object
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
16 17 18 |
# File 'lib/lumberg/cpanel/redirect.rb', line 16 def list( = {}) perform_request({ api_function: 'listredirects' }.merge()) end |
#show(options = {}) ⇒ Object
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
32 33 34 35 36 37 38 39 |
# File 'lib/lumberg/cpanel/redirect.rb', line 32 def show( = {}) if [:domain] && [:url] raise ArgumentError, "#{self.class.name}##{__method__} cannot accept both `:url` and `:domain`" end function = [:domain].present? ? 'redirectname' : 'redirecturlname' perform_request({ api_function: function }.merge()) end |