Sha256: 4bd40883d10eadd939925db3ffb7730bdf039755e2aca6d0d98a48770dcde804
Contents?: true
Size: 1.6 KB
Versions: 12
Compression:
Stored size: 1.6 KB
Contents
module TheCity class GroupEventAttendanceList < ApiList include Enumerable # Constructor. # # @param options A hash of options for loading the list. # # Options: # :group_id - The ID of the group to load the addresses for. (required) # :page - The page number to get. # :reader - The Reader to use to load the data. # # # Examples: # GroupEventAttendanceList.new({:group_id => 12345}) # # GroupEventAttendanceList.new({:group_id => 12345, :page => 2}) # def initialize(options = {}) @options = options @options[:reader] = TheCity::GroupEventAttendanceListReader.new(@options) if @options[:reader].nil? @json_data = @options[:reader].load_feed @total_entries = @json_data['total_entries'] @total_pages = @json_data['total_pages'] @per_page = @json_data['per_page'] @current_page = @json_data['current_page'] end # Get the specified note. # # @param index The index of the note to get. # # @return [GroupEventAttendance] def [](index) GroupEventAttendance.new( @json_data['event_attendances'][index] ) if @json_data['event_attendances'][index] end # This method is needed for Enumerable. def each &block @json_data['event_attendances'].each{ |attendance| yield( GroupEventAttendance.new(attendance) )} end # Alias the count method alias :size :count # Checks if the list is empty. # # @return True on empty, false otherwise. def empty? @json_data['event_attendances'].empty? end end end
Version data entries
12 entries across 12 versions & 1 rubygems