Module: LinkScout
- Defined in:
- lib/link_scout.rb,
lib/link_scout/errors.rb,
lib/link_scout/runner.rb,
lib/link_scout/version.rb
Defined Under Namespace
Classes: InvalidUsageError, RedirectLoopError, Runner
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
-
.run(*args) ⇒ Object
takes URLs and options as input and returns a boolean when URL leads to a successful response (true) or not (false).
Class Method Details
.run(*args) ⇒ Object
takes URLs and options as input and returns a boolean when URL leads to a successful response (true) or not (false). If an array of URLs is provided LinkScout returns the result as an Array like [[url, boolean],[url, boolena]]
Expects options with the following keys:
-
url | URL - The URL to be checked ( only needed when multiple URLS with different options should be checked)
-
success | String, Array - (Default: 200) - Array of HTTP Status Codes that are considered as successfull, eg. 200,202
-
follow | Boolean (Default: true) - Follow all redirects and return checks only if the last response is successfull or not
-
limit | Integer (Default: 10) - Max. number of redirects to follow
-
target | URL - If provided check if the final response ended at the target url
-
deeplink_param | String - a param in the url that is considered to be the deeplink, if deeplink_param is found deeplink option is set automatically
-
pattern | Regex - Return “success” if a given pattern can be found on the response.body, e.g. /^my-pattern/ig
-
antipattern | Regex - Return “fail” if a given pattern can be found on the response.body, e.g. /^my-anti-pattern/ig
21 22 23 |
# File 'lib/link_scout.rb', line 21 def self.run(*args) LinkScout::Runner.new(args).run end |