Class: TheCity::GroupAddressListReader

Inherits:
ApiReader
  • Object
show all
Defined in:
lib/readers/group_address_list_reader.rb

Instance Attribute Summary

Attributes inherited from ApiReader

#headers

Instance Method Summary collapse

Methods inherited from ApiReader

#load_feed, #rate_limit, #rate_limit_remaining

Constructor Details

#initialize(options = {}, cacher = nil) ⇒ GroupAddressListReader

Constructor.

Parameters:

  • options (defaults to: {})

    A hash of options for requesting data from the server.

    group_id is required

  • cacher (CacheAdapter) (defaults to: nil)

    (optional) The cacher to be used to cache data.



10
11
12
13
14
15
16
17
18
19
# File 'lib/readers/group_address_list_reader.rb', line 10

def initialize(options = {}, cacher = nil) 
  options[:page] ||= 1
  group_id = options.delete(:group_id)
  #@class_key = "groups_#{group_id}_addresses"   
  @url_data_path = "/groups/#{group_id}/addresses"
  @url_data_params = white_list_options(options)
  
  # The object to store and load the cache.
  @cacher = cacher unless cacher.nil?    
end

Instance Method Details

#white_list_options(options) ⇒ Object



21
22
23
24
# File 'lib/readers/group_address_list_reader.rb', line 21

def white_list_options(options)
  white_list = [:page]
  options.clone.delete_if { |key, value| !white_list.include?(key) }
end