Sha256: 34f4dda435f1f7f68b042f8bfed731bfdafd2baf7b918493f09fc6436847b26e

Contents?: true

Size: 980 Bytes

Versions: 2

Compression:

Stored size: 980 Bytes

Contents

module Ethon
  class Easy
    # This module contains the logic to prepare and perform
    # an easy.
    module Operations

      # Returns a pointer to the curl easy handle.
      #
      # @example Return the handle.
      #   easy.handle
      #
      # @return [ FFI::Pointer ] A pointer to the curl easy handle.
      def handle
        @handle ||= Curl.easy_init
      end

      # Perform the easy request.
      #
      # @example Perform the request.
      #   easy.perform
      #
      # @return [ Integer ] The return code.
      def perform
        @return_code = Curl.easy_perform(handle)
        complete
        Ethon.logger.debug("ETHON: performed #{self.log_inspect}") if Ethon.logger
        @return_code
      end

      # Prepare the easy. Options, headers and callbacks
      # were set.
      #
      # @example Prepare easy.
      #   easy.prepare
      def prepare
        set_options
        set_headers
        set_callbacks
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ethon-0.4.4 lib/ethon/easy/operations.rb
ethon-0.4.3 lib/ethon/easy/operations.rb