lib/zendesk_api/collection.rb
def wrap_resource(res, with_association = with_association?)
      case res
      when Array
        wrap_resource(Hash[*res], with_association)
      when Hash
        res = res.merge(:association => @association) if with_association
        @resource_class.new(@client, res)
      else
        res = { :id => res }
        res.merge!(:association => @association) if with_association
        @resource_class.new(@client, res)
      end
    end
def wrap_resource(res, with_association = with_association?)
      case res
      when Array
        wrap_resource(Hash[*res], with_association)
      when Hash
        res = res.merge(:association => @association) if with_association
        @resource_class.new(@client, res)
      else
        res = { :id => res }
        res.merge!(:association => @association) if with_association
        @resource_class.new(@client, res)
      end
    end
def wrap_resource ( res , with_association = with_association? ) case res when Array wrap_resource ( Hash [ res ] , with_association ) when Hash res = res . merge ( :association => @association ) if with_association @resource_class . new ( @client , res ) else res = { :id => res } res . merge! ( :association => @association ) if with_association @resource_class . new ( @client , res ) end end
Simplified Associations#wrap_resource
Simplified Associations#wrap_resource