module PulpPolymorphicResponsePatch

Public Class Methods

patch_update_method(klass, method_name) click to toggle source
# File lib/monkeys/pulp_polymorphic_remote_response.rb, line 24
def self.patch_update_method(klass, method_name)
  with_http_info_method = :"#{method_name}_with_http_info"

  klass.class_eval do
    # Save reference to original _with_http_info method
    original_method = :"#{with_http_info_method}_original"
    alias_method original_method, with_http_info_method

    # Override the _with_http_info method to force AsyncOperationResponse return type
    define_method(with_http_info_method) do |href, data, opts = {}|
      # The generated bindings code uses: return_type = opts[:debug_return_type] || 'RpmRpmRemoteResponse'
      # By setting debug_return_type to AsyncOperationResponse, we override the default
      modified_opts = (opts || {}).merge(debug_return_type: 'AsyncOperationResponse')

      # Call original method with modified opts
      send(original_method, href, data, modified_opts)
    end
  end
end