Sha256: 55c3f365f6d5dd8fb7b8d33eee398d8f7c44e7c13ca689b47b5482b83139c666

Contents?: true

Size: 1.6 KB

Versions: 6789

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true
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 ||= FFI::AutoPointer.new(Curl.easy_init, Curl.method(:easy_cleanup))
      end

      # Sets a pointer to the curl easy handle.
      # @param [ ::FFI::Pointer ] Easy handle that will be assigned.
      def handle=(h)
        @handle = h
      end

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

      # Clean up the easy.
      #
      # @example Perform clean up.
      #   easy.cleanup
      #
      # @return the result of the free which is nil
      def cleanup
        handle.free
      end

      # Prepare the easy. Options, headers and callbacks
      # were set.
      #
      # @example Prepare easy.
      #   easy.prepare
      #
      # @deprecated It is no longer necessary to call prepare.
      def prepare
        Ethon.logger.warn(
          "ETHON: It is no longer necessary to call "+
          "Easy#prepare. It's going to be removed "+
          "in future versions."
        )
      end
    end
  end
end

Version data entries

6,789 entries across 6,787 versions & 22 rubygems

Version Path
ory-client-0.0.1.alpha125 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha124 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha123 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha122 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha121 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha120 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha119 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha118 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha117 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha116 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha115 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-keto-client-0.8.0.alpha2 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
cloudsmith-api-1.33.7 vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha113 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha112 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha111 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha110 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha109 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
avalara_sdk-2.4.26 vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb
ory-client-0.0.1.alpha108 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/operations.rb