Object
This class represents a form and is used to send a payload in the request body via POST/PUT. It handles multipart forms, too.
@api private
Return a pointer to the first form element in libcurl.
@example Return the first form element.
form.first
@return [ FFI::Pointer ] The first element.
# File lib/ethon/easy/form.rb, line 35 def first @first ||= FFI::MemoryPointer.new(:pointer) end
Return a pointer to the last form element in libcurl.
@example Return the last form element.
form.last
@return [ FFI::Pointer ] The last element.
# File lib/ethon/easy/form.rb, line 45 def last @last ||= FFI::MemoryPointer.new(:pointer) end
Add form elements to libcurl.
@example Add form to libcurl.
form.materialize
# File lib/ethon/easy/form.rb, line 64 def materialize query_pairs.each { |pair| form_add(pair.first.to_s, pair.last) } end
Return if form is multipart. The form is multipart when it contains a file.
@example Return if form is multipart.
form.multipart?
@return [ Boolean ] True if form is multipart, else false.
# File lib/ethon/easy/form.rb, line 56 def multipart? query_pairs.any?{|pair| pair.respond_to?(:last) && pair.last.is_a?(Array)} end
Generated with the Darkfish Rdoc Generator 2.