module Ethon::Easy::Http::Actionable

def form

Returns:
  • (Form) - The form.

Other tags:
    Example: Return form. -
def form
  @form ||= Form.new(@easy, query_options.fetch(:body, nil), options.fetch(:multipart, nil))
end

def initialize(url, options)

Returns:
  • (Action) - A new action.

Parameters:
  • options (Hash) -- The options.
  • url (String) -- The url.

Other tags:
    Example: Create a new action. -
def initialize(url, options)
  @url = url
  @options, @query_options = parse_options(options)
end

def options

Returns:
  • (Hash) - The options.

Other tags:
    Example: Return options. -
def options
  @options
end

def params

Returns:
  • (Params) - The params.

Other tags:
    Example: Return params. -
def params
  @params ||= Params.new(@easy, query_options.fetch(:params, nil))
end

def params_encoding

Other tags:
    Example: Get encoding from options -
def params_encoding
  @params_encoding ||= query_options.fetch(:params_encoding, :typhoeus)
end

def parse_options(options)

def parse_options(options)
  query_options = {}
  options = options.dup
  QUERY_OPTIONS.each do |query_option|
    if options.key?(query_option)
      query_options[query_option] = options.delete(query_option)
    end
  end
  return options, query_options
end

def query_options

Returns:
  • (Hash) - The query options.

Other tags:
    Example: Return query options. -
def query_options
  @query_options
end

def set_form(easy)

Parameters:
  • easy (Easy) -- The easy to setup.

Other tags:
    Example: Setup nothing. -
def set_form(easy)
end

def set_params(easy)

Parameters:
  • easy (Easy) -- The easy to setup.

Other tags:
    Example: Setup nothing. -
def set_params(easy)
  params.escape = easy.escape?
  params.params_encoding = params_encoding
  base_url, base_params = url.split('?')
  base_url << '?'
  base_url << base_params.to_s
  base_url << '&' if base_params
  base_url << params.to_s
  easy.url = base_url
end

def setup(easy)

Parameters:
  • easy (easy) -- the easy to setup.

Other tags:
    Example: setup. -
def setup(easy)
  @easy = easy
  # Order is important, @easy will be used to provide access to options
  # relevant to the following operations (like whether or not to escape
  # values).
  easy.set_attributes(options)
  set_form(easy) unless form.empty?
  if params.empty?
    easy.url = url
  else
    set_params(easy)
  end
end

def url

Returns:
  • (String) - The url.

Other tags:
    Example: Return url. -
def url
  @url
end