Sha256: 01e212473354d22f9c93a550d7db1803de4402abd580bc43f3836449cfbe19d9

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 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.
      #
      # @api public
      def perform
        @return_code = Curl.easy_perform(handle)
        complete
        Ethon.logger.debug("ETHON: performed #{self.log_inspect}")
        @return_code
      end

      # Prepare the easy. Options, headers and callbacks
      # were set.
      #
      # @example Prepare easy.
      #   easy.prepare
      #
      # @api public
      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.5.2 lib/ethon/easy/operations.rb
ethon-0.5.1 lib/ethon/easy/operations.rb