Module: CMSScanner::Browser::Actions

Included in:
CMSScanner::Browser
Defined in:
lib/cms_scanner/browser/actions.rb

Overview

Browser Actions (get, post etc)

Instance Method Summary collapse

Instance Method Details

#forge_request(url, params = {}) ⇒ Typhoeus::Request

Parameters:

  • url (String)
  • params (Hash) (defaults to: {})

Returns:

  • (Typhoeus::Request)


11
12
13
# File 'lib/cms_scanner/browser/actions.rb', line 11

def forge_request(url, params = {})
  NS::Browser.instance.forge_request(url, params)
end

#get(url, params = {}) ⇒ Typhoeus::Response

Parameters:

  • url (String)
  • params (Hash) (defaults to: {})

Returns:



19
20
21
# File 'lib/cms_scanner/browser/actions.rb', line 19

def get(url, params = {})
  forge_request(url, params.merge(method: :get)).run
end

#get_and_follow_location(url, params = {}) ⇒ Typhoeus::Response

Parameters:

  • url (String)
  • params (Hash) (defaults to: {})

Returns:



43
44
45
# File 'lib/cms_scanner/browser/actions.rb', line 43

def get_and_follow_location(url, params = {})
  get(url, { followlocation: true, maxredirs: 3 }.merge(params))
end

#head(url, params = {}) ⇒ Typhoeus::Response

Parameters:

  • url (String)
  • params (Hash) (defaults to: {})

Returns:



35
36
37
# File 'lib/cms_scanner/browser/actions.rb', line 35

def head(url, params = {})
  forge_request(url, params.merge(method: :head)).run
end

#post(url, params = {}) ⇒ Typhoeus::Response

Parameters:

  • url (String)
  • params (Hash) (defaults to: {})

Returns:



27
28
29
# File 'lib/cms_scanner/browser/actions.rb', line 27

def post(url, params = {})
  forge_request(url, params.merge(method: :post)).run
end