the-city-admin 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.rvmrc +1 -1
  3. data/examples/city_keys.rb +2 -2
  4. data/examples/donations.rb +33 -0
  5. data/lib/api/address_list.rb +4 -5
  6. data/lib/api/api_list.rb +50 -0
  7. data/lib/api/checkin_list.rb +4 -5
  8. data/lib/api/donation.rb +36 -18
  9. data/lib/api/donation_export_list.rb +4 -5
  10. data/lib/api/donation_list.rb +5 -7
  11. data/lib/api/fund_list.rb +5 -7
  12. data/lib/api/group_address_list.rb +4 -5
  13. data/lib/api/group_checkin_list.rb +4 -5
  14. data/lib/api/group_event_attendance_list.rb +4 -5
  15. data/lib/api/group_export.rb +1 -0
  16. data/lib/api/group_export_list.rb +4 -5
  17. data/lib/api/group_invitation_list.rb +4 -5
  18. data/lib/api/group_list.rb +5 -7
  19. data/lib/api/group_role_list.rb +4 -5
  20. data/lib/api/group_tag_list.rb +4 -5
  21. data/lib/api/invitation_list.rb +4 -5
  22. data/lib/api/metric_list.rb +5 -6
  23. data/lib/api/metric_measurement_list.rb +5 -6
  24. data/lib/api/pledge_list.rb +5 -7
  25. data/lib/api/role_list.rb +5 -6
  26. data/lib/api/skill_list.rb +5 -6
  27. data/lib/api/skilled_user_id_list.rb +5 -6
  28. data/lib/api/skilled_user_list.rb +5 -6
  29. data/lib/api/tag_group_list.rb +5 -6
  30. data/lib/api/tag_list.rb +5 -6
  31. data/lib/api/terminology_list.rb +5 -6
  32. data/lib/api/user.rb +24 -23
  33. data/lib/api/user_address.rb +17 -12
  34. data/lib/api/user_address_list.rb +4 -5
  35. data/lib/api/user_admin_privilege_list.rb +5 -6
  36. data/lib/api/user_family_list.rb +5 -4
  37. data/lib/api/user_invitation_list.rb +5 -6
  38. data/lib/api/user_list.rb +5 -6
  39. data/lib/api/user_note_list.rb +5 -6
  40. data/lib/api/user_process_answer_list.rb +5 -6
  41. data/lib/api/user_process_list.rb +5 -6
  42. data/lib/api/user_role_list.rb +5 -6
  43. data/lib/api/user_skill_list.rb +5 -6
  44. data/lib/api/web_hook_list.rb +5 -6
  45. data/lib/auto_load.rb +1 -0
  46. data/lib/readers/address_list_reader.rb +6 -2
  47. data/lib/readers/checkin_list_reader.rb +7 -2
  48. data/lib/readers/donation_export_list_reader.rb +7 -2
  49. data/lib/readers/donation_list_reader.rb +6 -1
  50. data/lib/readers/fund_list_reader.rb +6 -1
  51. data/lib/readers/group_address_list_reader.rb +8 -3
  52. data/lib/readers/group_checkin_list_reader.rb +8 -3
  53. data/lib/readers/group_event_attendance_list_reader.rb +8 -3
  54. data/lib/readers/group_export_list_reader.rb +8 -3
  55. data/lib/readers/group_invitation_list_reader.rb +8 -3
  56. data/lib/readers/group_list_reader.rb +6 -1
  57. data/lib/readers/group_role_list_reader.rb +8 -3
  58. data/lib/readers/group_tag_list_reader.rb +8 -3
  59. data/lib/readers/invitation_list_reader.rb +7 -2
  60. data/lib/readers/metric_list_reader.rb +7 -2
  61. data/lib/readers/metric_measurement_list_reader.rb +10 -3
  62. data/lib/readers/pledge_list_reader.rb +6 -1
  63. data/lib/readers/role_list_reader.rb +8 -3
  64. data/lib/readers/skill_list_reader.rb +7 -2
  65. data/lib/readers/skilled_user_id_list_reader.rb +10 -4
  66. data/lib/readers/skilled_user_list_reader.rb +10 -4
  67. data/lib/readers/tag_group_list_reader.rb +9 -4
  68. data/lib/readers/tag_list_reader.rb +7 -2
  69. data/lib/readers/terminology_list_reader.rb +7 -2
  70. data/lib/readers/user_address_list_reader.rb +8 -3
  71. data/lib/readers/user_admin_privilege_list_reader.rb +8 -3
  72. data/lib/readers/user_family_list_reader.rb +8 -2
  73. data/lib/readers/user_invitation_list_reader.rb +8 -3
  74. data/lib/readers/user_list_reader.rb +8 -6
  75. data/lib/readers/user_note_list_reader.rb +8 -3
  76. data/lib/readers/user_process_answer_list_reader.rb +9 -4
  77. data/lib/readers/user_process_list_reader.rb +8 -3
  78. data/lib/readers/user_reader.rb +1 -1
  79. data/lib/readers/user_role_list_reader.rb +8 -3
  80. data/lib/readers/user_skill_list_reader.rb +8 -3
  81. data/lib/readers/web_hook_list_reader.rb +7 -2
  82. data/thecity_admin_api.gemspec +1 -1
  83. metadata +7 -9
@@ -12,12 +12,17 @@ module TheCity
12
12
 
13
13
  #@class_key = "pledge_list_#{options[:page]}_{some_kind_of_md5_thing_here}"
14
14
  @url_data_path = "/donations"
15
- @url_data_params = options
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page, :fund_id, :state, :group_id, :user_id, :start_date, :end_date, :paginate, :page, :per_page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -12,12 +12,17 @@ module TheCity
12
12
 
13
13
  #@class_key = "pledge_list_#{options[:page]}_{some_kind_of_md5_thing_here}"
14
14
  @url_data_path = "/funds"
15
- @url_data_params = options
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_addresses"
14
14
  @url_data_path = "/groups/#{group_id}/addresses"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
+
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
20
25
 
21
26
  end
22
27
 
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_checkins"
14
14
  @url_data_path = "/groups/#{group_id}/checkins"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
+
21
+ def white_list_options
22
+ white_list = [:page, :include_checked_out]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
20
25
 
21
26
  end
22
27
 
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_event_attendances"
14
14
  @url_data_path = "/groups/#{group_id}/event_attendances"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
+
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
20
25
 
21
26
  end
22
27
 
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_exports"
14
14
  @url_data_path = "/groups/#{group_id}/exports"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
+
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
20
25
 
21
26
  end
22
27
 
@@ -8,16 +8,21 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_invitations_#{page}"
14
14
  @url_data_path = "/groups/#{group_id}/invitations"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -11,12 +11,17 @@ module TheCity
11
11
 
12
12
  #@class_key = "group_list_#{options[:page]}_{some_kind_of_md5_thing_here}"
13
13
  @url_data_path = "/groups"
14
- @url_data_params = options
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page, :search, :under_group_id, :group_types, :include_inactive, :include_addresses, :include_composition, :include_user_ids]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -8,16 +8,21 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_roles_#{page}"
14
14
  @url_data_path = "/groups/#{group_id}/roles"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page, :title, :include_inactive]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -8,16 +8,21 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- group_id = options[:group_id]
11
+ options[:page] ||= 1
12
+ group_id = options.delete(:group_id)
13
13
  #@class_key = "groups_#{group_id}_tags_#{page}"
14
14
  @url_data_path = "/groups/#{group_id}/tags"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: group_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
11
+ options[:page] ||= 1
12
12
  #@class_key = "invitations_#{page}"
13
13
  @url_data_path = "/invitations"
14
- @url_data_params = {:page => page}
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page, :filter]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -7,16 +7,21 @@ module TheCity
7
7
  # @param options A hash of options for requesting data from the server.
8
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
9
9
  def initialize(options = {}, cacher = nil)
10
- page = options[:page] || 1
10
+ options[:page] ||= 1
11
11
 
12
12
  #@class_key = "metric_list_#{page}"
13
13
  @url_data_path = "/metrics"
14
- @url_data_params = {:page => page}
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -4,18 +4,25 @@ module TheCity
4
4
 
5
5
  # Constructor.
6
6
  #
7
- # @param page The page number to get. Default is 1.
8
7
  # @param options A hash of options for requesting data from the server.
8
+ # :: metric_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
- def initialize(metric_id, page = 1, options = {}, cacher = nil)
10
+ def initialize(options = {}, cacher = nil)
11
+ options[:page] ||= 1
12
+ metric_id = options.delete(:metric_id)
11
13
  #@class_key = "metric_#{metric_id}_measurement_list_#{page}"
12
14
  @url_data_path = "/metrics/#{metric_id}/measurements"
13
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
14
16
 
15
17
  # The object to store and load the cache.
16
18
  @cacher = cacher unless cacher.nil?
17
19
  end
18
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
19
26
  end
20
27
 
21
28
  end
@@ -12,12 +12,17 @@ module TheCity
12
12
 
13
13
  #@class_key = "pledge_list_#{options[:page]}_{some_kind_of_md5_thing_here}"
14
14
  @url_data_path = "/pledges"
15
- @url_data_params = options
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page, :campus_id, :include_participation]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -7,15 +7,20 @@ module TheCity
7
7
  # @param options A hash of options for requesting data from the server.
8
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
9
9
  def initialize(options = {}, cacher = nil)
10
- page = options[:page] || 1
10
+ options[:page] ||= 1
11
11
  #@class_key = "role_list_#{page}"
12
12
  @url_data_path = "/roles"
13
- @url_data_params = {:page => page}
13
+ @url_data_params = white_list_options(options)
14
14
 
15
15
  # The object to store and load the cache.
16
16
  @cacher = cacher unless cacher.nil?
17
17
  end
18
18
 
19
+ def white_list_options
20
+ white_list = [:page, :under_group_id, :group_types, :titles]
21
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
22
+ end
23
+
19
24
  end
20
25
 
21
- end
26
+ end
@@ -7,15 +7,20 @@ module TheCity
7
7
  # @param options A hash of options for requesting data from the server.
8
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
9
9
  def initialize(options = {}, cacher = nil)
10
- page = options[:page] || 1
10
+ options[:page] ||= 1
11
11
  #@class_key = "skill_list_#{page}"
12
12
  @url_data_path = "/skills"
13
- @url_data_params = {:page => page}
13
+ @url_data_params = white_list_options(options)
14
14
 
15
15
  # The object to store and load the cache.
16
16
  @cacher = cacher unless cacher.nil?
17
17
  end
18
18
 
19
+ def white_list_options
20
+ white_list = [:page]
21
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
22
+ end
23
+
19
24
  end
20
25
 
21
26
  end
@@ -4,19 +4,25 @@ module TheCity
4
4
 
5
5
  # Constructor.
6
6
  #
7
- # @param page The skill id to get the users for.
8
- # @param page The page number to get. Default is 1.
9
7
  # @param options A hash of options for requesting data from the server.
8
+ # :: skill_id is required
10
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
11
- def initialize(skill_id, page = 1, options = {}, cacher = nil)
10
+ def initialize(options = {}, cacher = nil)
11
+ options[:page] ||= 1
12
+ skill_id = options.delete(:skill_id)
12
13
  #@class_key = "skilled_user_id_list_#{page}"
13
14
  @url_data_path = "/skills/#{skill_id}/user_ids"
14
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
15
16
 
16
17
  # The object to store and load the cache.
17
18
  @cacher = cacher unless cacher.nil?
18
19
  end
19
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
20
26
  end
21
27
 
22
28
  end
@@ -4,19 +4,25 @@ module TheCity
4
4
 
5
5
  # Constructor.
6
6
  #
7
- # @param page The skill id to get the users for.
8
- # @param page The page number to get. Default is 1.
9
7
  # @param options A hash of options for requesting data from the server.
8
+ # :: skill_id is required
10
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
11
- def initialize(skill_id, page = 1, options = {}, cacher = nil)
10
+ def initialize(options = {}, cacher = nil)
11
+ options[:page] ||= 1
12
+ skill_id = options.delete(:skill_id)
12
13
  #@class_key = "skilled_user_list_#{page}"
13
14
  @url_data_path = "/skills/#{skill_id}/users"
14
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
15
16
 
16
17
  # The object to store and load the cache.
17
18
  @cacher = cacher unless cacher.nil?
18
19
  end
19
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
20
26
  end
21
27
 
22
28
  end
@@ -4,19 +4,24 @@ module TheCity
4
4
 
5
5
  # Constructor.
6
6
  #
7
- # @param tag_id The tag id to get the groups for.
8
- # @param page The page number to get. Default is 1.
9
7
  # @param options A hash of options for requesting data from the server.
10
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
11
- def initialize(tag_id, page = 1, options = {}, cacher = nil)
9
+ def initialize(options = {}, cacher = nil)
10
+ options[:page] ||= 1
11
+ tag_id = options.delete(:tag_id)
12
12
  #@class_key = "tag_#{tag_id}_group_list_#{page}"
13
13
  @url_data_path = "/tags/#{tag_id}/groups"
14
- @url_data_params = {:page => page}
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -7,16 +7,21 @@ module TheCity
7
7
  # @param options A hash of options for requesting data from the server.
8
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
9
9
  def initialize(options = {}, cacher = nil)
10
- page = options[:page] || 1
10
+ options[:page] ||= 1
11
11
 
12
12
  #@class_key = "tag_list_#{page}"
13
13
  @url_data_path = "/tags"
14
- @url_data_params = {:page => page}
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -7,16 +7,21 @@ module TheCity
7
7
  # @param options A hash of options for requesting data from the server.
8
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
9
9
  def initialize(options = {}, cacher = nil)
10
- page = options[:page] || 1
10
+ options[:page] ||= 1
11
11
 
12
12
  #@class_key = "terminology_list_#{page}"
13
13
  @url_data_path = "/terminology"
14
- @url_data_params = {:page => page}
14
+ @url_data_params = white_list_options(options)
15
15
 
16
16
  # The object to store and load the cache.
17
17
  @cacher = cacher unless cacher.nil?
18
18
  end
19
19
 
20
+ def white_list_options
21
+ white_list = [:page]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
20
25
  end
21
26
 
22
27
  end
@@ -8,15 +8,20 @@ module TheCity
8
8
  # :: user_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- user_id = options[:user_id]
11
+ options[:page] ||= 1
12
+ user_id = options.delete(:user_id)
13
13
  #@class_key = "users_#{user_id}_addresses"
14
14
  @url_data_path = "/users/#{user_id}/addresses"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
+
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
20
25
 
21
26
  end
22
27
 
@@ -8,16 +8,21 @@ module TheCity
8
8
  # :: user_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- user_id = options[:user_id]
11
+ options[:page] ||= 1
12
+ user_id = options.delete(:user_id)
13
13
  #@class_key = "users_#{user_id}_admin_privileges_#{page}"
14
14
  @url_data_path = "/users/#{user_id}/admin_privileges"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -8,15 +8,21 @@ module TheCity
8
8
  # :: user_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- user_id = options[:user_id]
11
+ options[:page] ||= 1
12
+ user_id = options.delete(:user_id)
13
13
  #@class_key = "users_#{user_id}_family"
14
14
  @url_data_path = "/users/#{user_id}/family"
15
+ @url_data_params = white_list_options(options)
15
16
 
16
17
  # The object to store and load the cache.
17
18
  @cacher = cacher unless cacher.nil?
18
19
  end
19
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
20
26
  end
21
27
 
22
28
  end
@@ -8,16 +8,21 @@ module TheCity
8
8
  # :: user_id is required
9
9
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
10
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- user_id = options[:user_id]
11
+ options[:page] ||= 1
12
+ user_id = options.delete(:user_id)
13
13
  #@class_key = "users_#{user_id}_invitations_#{page}"
14
14
  @url_data_path = "/users/#{user_id}/invitations"
15
- @url_data_params = {:page => page}
15
+ @url_data_params = white_list_options(options)
16
16
 
17
17
  # The object to store and load the cache.
18
18
  @cacher = cacher unless cacher.nil?
19
19
  end
20
20
 
21
+ def white_list_options
22
+ white_list = [:page]
23
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
24
+ end
25
+
21
26
  end
22
27
 
23
28
  end
@@ -4,22 +4,24 @@ module TheCity
4
4
 
5
5
  # Constructor.
6
6
  #
7
- # @param page The page number to get. Default is 1.
8
7
  # @param options A hash of options for requesting data from the server.
9
8
  # @param [CacheAdapter] cacher (optional) The cacher to be used to cache data.
10
9
  def initialize(options = {}, cacher = nil)
11
- page = options[:page] || 1
12
- filter = options[:filter]
10
+ options[:page] ||= 1
13
11
 
14
12
  #@class_key = "user_list_#{page}_#{filter.to_s.downcase.gsub(' ','')}"
15
13
  @url_data_path = "/users"
16
- @url_data_params = {:page => page}
17
- @url_data_params.merge!({:filter => filter}) if filter
14
+ @url_data_params = white_list_options(options)
18
15
 
19
16
  # The object to store and load the cache.
20
17
  @cacher = cacher unless cacher.nil?
21
18
  end
22
19
 
20
+ def white_list_options
21
+ white_list = [:page, :filter, :include_participation, :include_custom_fields, :include_barcodes, :include_addresses, :include_family]
22
+ options.clone.delete_if { |key, value| !white_list.include?(key) }
23
+ end
24
+
23
25
  end
24
26
 
25
- end
27
+ end