module Wpxf::Net::TyphoeusHelper
Provides helper functions for interfacing with Typhoeus in a module.
Public Instance Methods
advanced_typhoeus_options()
click to toggle source
# File lib/wpxf/net/typhoeus_helper.rb, line 7 def advanced_typhoeus_options { userpwd: datastore['basic_auth_creds'], proxy: datastore['proxy'], proxyuserpwd: datastore['proxy_auth_creds'], ssl_verifyhost: normalized_option_value('verify_host') ? 2 : 0, ssl_verifypeer: normalized_option_value('verify_peer'), timeout: normalized_option_value('http_client_timeout') } end
create_typhoeus_request(opts)
click to toggle source
# File lib/wpxf/net/typhoeus_helper.rb, line 33 def create_typhoeus_request(opts) headers = opts[:headers] || {} headers['Cookie'] = opts[:cookie] if opts[:cookie] options = create_typhoeus_request_options( opts[:method], opts[:params], opts[:body], headers ) Typhoeus::Request.new(normalize_relative_uri(opts[:url]), options) end
create_typhoeus_request_options(method, params, body, headers)
click to toggle source
# File lib/wpxf/net/typhoeus_helper.rb, line 28 def create_typhoeus_request_options(method, params, body, headers) standard_typhoeus_options(method, params, body, headers) .merge(advanced_typhoeus_options) end
standard_typhoeus_options(method, params, body, headers)
click to toggle source
# File lib/wpxf/net/typhoeus_helper.rb, line 18 def standard_typhoeus_options(method, params, body, headers) { method: method, body: body, params: params, headers: base_http_headers.merge(headers), followlocation: normalized_option_value('follow_http_redirection') } end