Module: Browser::Actions

Included in:
Browser
Defined in:
lib/common/browser/actions.rb

Instance Method Summary (collapse)

Instance Method Details

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

Parameters:

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

Returns:



10
11
12
# File 'lib/common/browser/actions.rb', line 10

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

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

Parameters:

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

Returns:



26
27
28
29
30
# File 'lib/common/browser/actions.rb', line 26

def get_and_follow_location(url, params = {})
  params[:maxredirs] ||= 2

  get(url, params.merge(followlocation: true))
end

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

Parameters:

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

Returns:



18
19
20
# File 'lib/common/browser/actions.rb', line 18

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

- (Typhoeus::Response) process(url, params) (protected)

Parameters:

  • url (String)
  • params (Hash)

Returns:



38
39
40
# File 'lib/common/browser/actions.rb', line 38

def process(url, params)
  Typhoeus::Request.new(url, Browser.instance.merge_request_params(params)).run
end