lib/zendesk_api/collection.rb
# Sends methods to underlying array of resources.
Sends methods to underlying array of resources.
Sends methods to underlying array of resources .
def method_missing(name, *args, &block)
      methods = @resource_class.singleton_methods(false).map(&:to_sym)
      if methods.include?(name)
        @resource_class.send(name, @client, *args, &block)
      elsif Array.new.respond_to?(name)
        to_a.send(name, *args, &block)
      else
        opts = args.last.is_a?(Hash) ? args.last : {}
        opts.merge!(:collection_path => @collection_path.dup.push(name))
        self.class.new(@client, @resource_class, @options.merge(opts))
      end
    end
def method_missing ( name , * args , & block ) methods = @resource_class . singleton_methods ( false ) . map ( & :to_sym ) if methods . include? ( name ) @resource_class . send ( name , @client , * args , & block ) elsif Array . new . respond_to? ( name ) to_a . send ( name , * args , & block ) else opts = args . last . is_a? ( Hash ) ? args . last : { } opts . merge! ( :collection_path => @collection_path . dup . push ( name ) ) self . class . new ( @client , @resource_class , @options . merge ( opts ) ) end end
Sends methods to underlying array of resources.
Sends methods to underlying array of resources .
name
<not_specific>
args
<not_specific>
block
<not_specific>