module Telnyx::APIOperations::ParamWrapper

Intercepts request params passed to api operation methods and wraps them in a single param. Usage: class << self

prepend Telnyx::ParamWrapper
wrap :list, 'filter'

end

Protected Instance Methods

wrap(method_name, wrapper) click to toggle source
Calls superclass method
# File lib/telnyx/api_operations/param_wrapper.rb, line 14
def wrap(method_name, wrapper)
  define_singleton_method(method_name) do |filters = {}, opts = {}|
    return super(filters, opts) if filters.keys == [wrapper]

    filters = { wrapper => filters }
    super filters, opts
  end
end