lib/zendesk_api/client.rb
def method_missing(method, *args, &block)
      method = method.to_s
      options = args.last.is_a?(Hash) ? args.pop : {}

      @resource_cache[method] ||= { :class => nil, :cache => ZendeskAPI::LRUCache.new }
      if !options.delete(:reload) && (cached = @resource_cache[method][:cache].read(options.hash))
        cached
      else
        @resource_cache[method][:class] ||= method_as_class(method)
        raise "Resource for #{method} does not exist" unless @resource_cache[method][:class]
        @resource_cache[method][:cache].write(options.hash, ZendeskAPI::Collection.new(self, @resource_cache[method][:class], options))
      end
    end
def method_missing(method, *args, &block)
      method = method.to_s
      options = args.last.is_a?(Hash) ? args.pop : {}

      @resource_cache[method] ||= { :class => nil, :cache => ZendeskAPI::LRUCache.new }
      if !options.delete(:reload) && (cached = @resource_cache[method][:cache].read(options.hash))
        cached
      else
        @resource_cache[method][:class] ||= method_as_class(method)
        raise "Resource for #{method} does not exist" unless @resource_cache[method][:class]
        @resource_cache[method][:cache].write(options.hash, ZendeskAPI::Collection.new(self, @resource_cache[method][:class], options))
      end
    end
def method_missing ( method , * args , & block ) method = method . to_s options = args . last . is_a? ( Hash ) ? args . pop : { } @resource_cache [ method ] ||= { :class => nil , :cache => ZendeskAPI :: LRUCache . new } if ! options . delete ( :reload ) && ( cached = @resource_cache [ method ] [ :cache ] . read ( options . hash ) ) cached else @resource_cache [ method ] [ :class ] ||= method_as_class ( method ) raise "Resource for #{method} does not exist" unless @resource_cache [ method ] [ :class ] @resource_cache [ method ] [ :cache ] . write ( options . hash , ZendeskAPI :: Collection . new ( self , @resource_cache [ method ] [ :class ] , options ) ) end end
Handles resources such as 'tickets'. Any options are passed to the underlying collection, except reload which disregards
 memoization and creates a new Collection instance.
 @return [Collection] Collection instance for resource
Handles resources such as tickets . Any options are passed to the underlying collection except reload which disregards memoization and creates a new Collection instance .