Sha256: 51703dc3796e6e0ec8adfaafb6a872f4c24d8cd2f2e4df4aa2b864906cf3dcc4

Contents?: true

Size: 908 Bytes

Versions: 10

Compression:

Stored size: 908 Bytes

Contents

module TheCity

  class GroupListReader < ApiReader

    # Constructor.
    #
    # @param options A hash of options for requesting data from the server. Adds default of page 1 if page not set.
    # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
    def initialize(options = {}, cacher = nil) 
      options[:page] ||= 1

      #@class_key = "group_list_#{options[:page]}_{some_kind_of_md5_thing_here}"  
      @url_data_path = "/groups"
      @url_data_params = white_list_options(options)
      
      # The object to store and load the cache.
      @cacher = cacher unless cacher.nil?    
    end

    def white_list_options(options)
      white_list = [:page, :search, :under_group_id, :group_types, :include_inactive, :include_addresses, :include_composition, :include_user_ids]
      options.clone.delete_if { |key, value| !white_list.include?(key) }
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
the-city-admin-0.7.0 lib/readers/group_list_reader.rb
the-city-admin-0.6.9 lib/readers/group_list_reader.rb
the-city-admin-0.6.8 lib/readers/group_list_reader.rb
the-city-admin-0.6.7 lib/readers/group_list_reader.rb
the-city-admin-0.6.6 lib/readers/group_list_reader.rb
the-city-admin-0.6.5 lib/readers/group_list_reader.rb
the-city-admin-0.6.4 lib/readers/group_list_reader.rb
the-city-admin-0.6.3 lib/readers/group_list_reader.rb
the-city-admin-0.6.2 lib/readers/group_list_reader.rb
the-city-admin-0.6.1 lib/readers/group_list_reader.rb