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.
- checksums.yaml +7 -0
- data/.rvmrc +1 -1
- data/examples/city_keys.rb +2 -2
- data/examples/donations.rb +33 -0
- data/lib/api/address_list.rb +4 -5
- data/lib/api/api_list.rb +50 -0
- data/lib/api/checkin_list.rb +4 -5
- data/lib/api/donation.rb +36 -18
- data/lib/api/donation_export_list.rb +4 -5
- data/lib/api/donation_list.rb +5 -7
- data/lib/api/fund_list.rb +5 -7
- data/lib/api/group_address_list.rb +4 -5
- data/lib/api/group_checkin_list.rb +4 -5
- data/lib/api/group_event_attendance_list.rb +4 -5
- data/lib/api/group_export.rb +1 -0
- data/lib/api/group_export_list.rb +4 -5
- data/lib/api/group_invitation_list.rb +4 -5
- data/lib/api/group_list.rb +5 -7
- data/lib/api/group_role_list.rb +4 -5
- data/lib/api/group_tag_list.rb +4 -5
- data/lib/api/invitation_list.rb +4 -5
- data/lib/api/metric_list.rb +5 -6
- data/lib/api/metric_measurement_list.rb +5 -6
- data/lib/api/pledge_list.rb +5 -7
- data/lib/api/role_list.rb +5 -6
- data/lib/api/skill_list.rb +5 -6
- data/lib/api/skilled_user_id_list.rb +5 -6
- data/lib/api/skilled_user_list.rb +5 -6
- data/lib/api/tag_group_list.rb +5 -6
- data/lib/api/tag_list.rb +5 -6
- data/lib/api/terminology_list.rb +5 -6
- data/lib/api/user.rb +24 -23
- data/lib/api/user_address.rb +17 -12
- data/lib/api/user_address_list.rb +4 -5
- data/lib/api/user_admin_privilege_list.rb +5 -6
- data/lib/api/user_family_list.rb +5 -4
- data/lib/api/user_invitation_list.rb +5 -6
- data/lib/api/user_list.rb +5 -6
- data/lib/api/user_note_list.rb +5 -6
- data/lib/api/user_process_answer_list.rb +5 -6
- data/lib/api/user_process_list.rb +5 -6
- data/lib/api/user_role_list.rb +5 -6
- data/lib/api/user_skill_list.rb +5 -6
- data/lib/api/web_hook_list.rb +5 -6
- data/lib/auto_load.rb +1 -0
- data/lib/readers/address_list_reader.rb +6 -2
- data/lib/readers/checkin_list_reader.rb +7 -2
- data/lib/readers/donation_export_list_reader.rb +7 -2
- data/lib/readers/donation_list_reader.rb +6 -1
- data/lib/readers/fund_list_reader.rb +6 -1
- data/lib/readers/group_address_list_reader.rb +8 -3
- data/lib/readers/group_checkin_list_reader.rb +8 -3
- data/lib/readers/group_event_attendance_list_reader.rb +8 -3
- data/lib/readers/group_export_list_reader.rb +8 -3
- data/lib/readers/group_invitation_list_reader.rb +8 -3
- data/lib/readers/group_list_reader.rb +6 -1
- data/lib/readers/group_role_list_reader.rb +8 -3
- data/lib/readers/group_tag_list_reader.rb +8 -3
- data/lib/readers/invitation_list_reader.rb +7 -2
- data/lib/readers/metric_list_reader.rb +7 -2
- data/lib/readers/metric_measurement_list_reader.rb +10 -3
- data/lib/readers/pledge_list_reader.rb +6 -1
- data/lib/readers/role_list_reader.rb +8 -3
- data/lib/readers/skill_list_reader.rb +7 -2
- data/lib/readers/skilled_user_id_list_reader.rb +10 -4
- data/lib/readers/skilled_user_list_reader.rb +10 -4
- data/lib/readers/tag_group_list_reader.rb +9 -4
- data/lib/readers/tag_list_reader.rb +7 -2
- data/lib/readers/terminology_list_reader.rb +7 -2
- data/lib/readers/user_address_list_reader.rb +8 -3
- data/lib/readers/user_admin_privilege_list_reader.rb +8 -3
- data/lib/readers/user_family_list_reader.rb +8 -2
- data/lib/readers/user_invitation_list_reader.rb +8 -3
- data/lib/readers/user_list_reader.rb +8 -6
- data/lib/readers/user_note_list_reader.rb +8 -3
- data/lib/readers/user_process_answer_list_reader.rb +9 -4
- data/lib/readers/user_process_list_reader.rb +8 -3
- data/lib/readers/user_reader.rb +1 -1
- data/lib/readers/user_role_list_reader.rb +8 -3
- data/lib/readers/user_skill_list_reader.rb +8 -3
- data/lib/readers/web_hook_list_reader.rb +7 -2
- data/thecity_admin_api.gemspec +1 -1
- metadata +7 -9
data/lib/api/skill_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class SkillList
|
3
|
+
class SkillList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the skill list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# SkillList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::SkillListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class SkilledUserIdList
|
3
|
+
class SkilledUserIdList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# SkilledUserList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::SkilledUserIdListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class SkilledUserList
|
3
|
+
class SkilledUserList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# SkilledUserList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::SkilledUserListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/api/tag_group_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class TagGroupList
|
3
|
+
class TagGroupList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# SkilledUserList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::TagGroupListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/api/tag_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class TagList
|
3
|
+
class TagList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# TagList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::TagListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/api/terminology_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class TerminologyList
|
3
|
+
class TerminologyList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# TerminologyList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::TerminologyListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/api/user.rb
CHANGED
@@ -42,17 +42,24 @@ module TheCity
|
|
42
42
|
:external_id_3,
|
43
43
|
:middle,
|
44
44
|
:email,
|
45
|
-
:marital_status
|
45
|
+
:marital_status,
|
46
|
+
|
47
|
+
:addresses, # include_addresses
|
48
|
+
|
49
|
+
:family_id, # include_family
|
50
|
+
:family_role, # include_family
|
51
|
+
:external_family_id # include_family
|
46
52
|
|
47
53
|
|
48
54
|
# Loads the user by the specified ID.
|
49
55
|
#
|
50
56
|
# @param user_id The ID of the user to load.
|
57
|
+
# @param options (optional) Options for including more information.
|
51
58
|
#
|
52
59
|
# Returns a new {User} object.
|
53
|
-
def self.load_by_id(user_id)
|
54
|
-
reader = UserReader.new(user_id)
|
55
|
-
self.new(reader.load_feed)
|
60
|
+
def self.load_by_id(user_id, options = {})
|
61
|
+
reader = UserReader.new(user_id, options)
|
62
|
+
self.new(reader.load_feed, options)
|
56
63
|
rescue
|
57
64
|
nil
|
58
65
|
end
|
@@ -66,7 +73,10 @@ module TheCity
|
|
66
73
|
@writer_object = UserWriter
|
67
74
|
initialize_from_json_object(json_data) unless json_data.nil?
|
68
75
|
|
69
|
-
|
76
|
+
unless options[:include_addresses].nil?
|
77
|
+
@addresses = @addresses.collect { |addr| UserAddress.new(addr.merge({:user_id => self.id})) }
|
78
|
+
end
|
79
|
+
|
70
80
|
@family_list = nil
|
71
81
|
@note_list = nil
|
72
82
|
@role_list = nil
|
@@ -77,6 +87,15 @@ module TheCity
|
|
77
87
|
end
|
78
88
|
|
79
89
|
|
90
|
+
# The first with the nickname in parens if available.
|
91
|
+
#
|
92
|
+
# @return A string of the first name with the nickname if available.
|
93
|
+
def first_name_with_nickname
|
94
|
+
with_nickname = self.nickname.to_s.empty? ? nil : "(#{self.nickname})"
|
95
|
+
[self.first, with_nickname].compact.join(' ')
|
96
|
+
end
|
97
|
+
|
98
|
+
|
80
99
|
# The first and last name of the user.
|
81
100
|
#
|
82
101
|
# @return A string of the full name
|
@@ -86,24 +105,6 @@ module TheCity
|
|
86
105
|
end
|
87
106
|
|
88
107
|
|
89
|
-
# Address information.
|
90
|
-
#
|
91
|
-
# @param force_reload (optional) Data is cached on first call. If data needs to be
|
92
|
-
# reloaded from the server on a subsequent call then
|
93
|
-
# a force reload is need.
|
94
|
-
#
|
95
|
-
# @return [UserAddressList]
|
96
|
-
def addresses(force_reload = false)
|
97
|
-
unless force_reload
|
98
|
-
return @address_list unless @address_list.nil?
|
99
|
-
end
|
100
|
-
return nil unless self.id
|
101
|
-
|
102
|
-
@address_list = UserAddressList.new({:user_id => self.id})
|
103
|
-
return @address_list
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
108
|
# The family information.
|
108
109
|
#
|
109
110
|
# @return [UserFamilyList]
|
data/lib/api/user_address.rb
CHANGED
@@ -2,18 +2,19 @@ module TheCity
|
|
2
2
|
|
3
3
|
class UserAddress < ApiObject
|
4
4
|
|
5
|
-
tc_attr_accessor :
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
5
|
+
tc_attr_accessor :user_id,
|
6
|
+
:id,
|
7
|
+
:city,
|
8
|
+
:state,
|
9
|
+
:street,
|
10
|
+
:street2,
|
11
|
+
:zipcode,
|
12
|
+
:longitude,
|
13
|
+
:latitude,
|
14
|
+
:location_type,
|
15
|
+
:privacy,
|
16
|
+
:created_at,
|
17
|
+
:updated_at
|
17
18
|
|
18
19
|
|
19
20
|
# Constructor.
|
@@ -23,6 +24,10 @@ module TheCity
|
|
23
24
|
@writer_object = UserAddressWriter
|
24
25
|
initialize_from_json_object(json_data) unless json_data.nil?
|
25
26
|
end
|
27
|
+
|
28
|
+
def home_address?
|
29
|
+
self.location_type.downcase == 'home'
|
30
|
+
end
|
26
31
|
|
27
32
|
end
|
28
33
|
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserAddressList
|
3
|
+
class UserAddressList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,8 +20,9 @@ module TheCity
|
|
22
20
|
# UserAddressList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
|
26
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:reader] = TheCity::UserAddressListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserAdminPrivilegeList
|
3
|
+
class UserAdminPrivilegeList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserAdminPrivilegeList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserAdminPrivilegeListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@total_entries = @json_data['total_entries']
|
30
29
|
@total_pages = @json_data['total_pages']
|
data/lib/api/user_family_list.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserFamilyList
|
3
|
+
class UserFamilyList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
@@ -22,9 +22,10 @@ module TheCity
|
|
22
22
|
# UserFamilyList.new({:user_id => 12345, :page => 2})
|
23
23
|
#
|
24
24
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
25
|
+
@options = options
|
26
|
+
@options[:page] ||= 1
|
27
|
+
@options[:reader] = TheCity::UserFamilyListReader.new(@options) if @options[:reader].nil?
|
28
|
+
@json_data = @options[:reader].load_feed
|
28
29
|
|
29
30
|
@id = @json_data['id']
|
30
31
|
@created_at = @json_data['created_at']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserInvitationList
|
3
|
+
class UserInvitationList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserInvitationList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserInvitationListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@total_entries = @json_data['total_entries']
|
30
29
|
@total_pages = @json_data['total_pages']
|
data/lib/api/user_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserList
|
3
|
+
class UserList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# UserList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options.clone
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::UserListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/api/user_note_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserNoteList
|
3
|
+
class UserNoteList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserNoteList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserNoteListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@total_entries = @json_data['total_entries']
|
30
29
|
@total_pages = @json_data['total_pages']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserProcessAnswerList
|
3
|
+
class UserProcessAnswerList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -23,9 +21,10 @@ module TheCity
|
|
23
21
|
# UserProcessAnswerList.new({:user_id => 12345, :process_id => 23456, :page => 2})
|
24
22
|
#
|
25
23
|
def initialize(options = {})
|
26
|
-
options
|
27
|
-
|
28
|
-
@
|
24
|
+
@options = options
|
25
|
+
@options[:page] ||= 1
|
26
|
+
@options[:reader] = TheCity::UserProcessAnswerListReader.new(@options) if @options[:reader].nil?
|
27
|
+
@json_data = @options[:reader].load_feed
|
29
28
|
|
30
29
|
@total_entries = @json_data['total_entries']
|
31
30
|
@total_pages = @json_data['total_pages']
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserProcessList
|
3
|
+
class UserProcessList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserProcessList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserProcessListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@total_entries = @json_data['total_entries']
|
30
29
|
@total_pages = @json_data['total_pages']
|
data/lib/api/user_role_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserRoleList
|
3
|
+
class UserRoleList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserRoleList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserRoleListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@user_id = options[:user_id] || nil
|
30
29
|
@total_entries = @json_data['total_entries']
|
data/lib/api/user_skill_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class UserSkillList
|
3
|
+
class UserSkillList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -22,9 +20,10 @@ module TheCity
|
|
22
20
|
# UserSkillList.new({:user_id => 12345, :page => 2})
|
23
21
|
#
|
24
22
|
def initialize(options = {})
|
25
|
-
options
|
26
|
-
|
27
|
-
@
|
23
|
+
@options = options
|
24
|
+
@options[:page] ||= 1
|
25
|
+
@options[:reader] = TheCity::UserSkillListReader.new(@options) if @options[:reader].nil?
|
26
|
+
@json_data = @options[:reader].load_feed
|
28
27
|
|
29
28
|
@user_id = options[:user_id] || nil
|
30
29
|
@total_entries = @json_data['total_entries']
|
data/lib/api/web_hook_list.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module TheCity
|
2
2
|
|
3
|
-
class WebHookList
|
3
|
+
class WebHookList < ApiList
|
4
4
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
8
|
-
|
9
7
|
# Constructor.
|
10
8
|
#
|
11
9
|
# @param options A hash of options for loading the list.
|
@@ -21,9 +19,10 @@ module TheCity
|
|
21
19
|
# UserSkillList.new({:page => 2})
|
22
20
|
#
|
23
21
|
def initialize(options = {})
|
24
|
-
options
|
25
|
-
|
26
|
-
@
|
22
|
+
@options = options
|
23
|
+
@options[:page] ||= 1
|
24
|
+
@options[:reader] = TheCity::WebHookListReader.new(@options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
27
26
|
|
28
27
|
@total_entries = @json_data['total_entries']
|
29
28
|
@total_pages = @json_data['total_pages']
|
data/lib/auto_load.rb
CHANGED
@@ -7,15 +7,19 @@ 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
|
-
|
10
|
+
options[:page] ||= 1
|
11
11
|
#@class_key = "address_list_#{page}"
|
12
12
|
@url_data_path = "/addresses"
|
13
|
-
@url_data_params =
|
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
|
19
23
|
end
|
20
24
|
|
21
25
|
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
|
-
|
10
|
+
options[:page] ||= 1
|
11
11
|
#@class_key = "checkin_list_#{page}"
|
12
12
|
@url_data_path = "/checkins"
|
13
|
-
@url_data_params =
|
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, :include_checked_out]
|
21
|
+
options.clone.delete_if { |key, value| !white_list.include?(key) }
|
22
|
+
end
|
23
|
+
|
19
24
|
end
|
20
25
|
|
21
26
|
end
|
@@ -7,14 +7,19 @@ 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
|
-
|
10
|
+
options[:page] ||= 1
|
11
11
|
#@class_key = "groups_#{group_id}_exports"
|
12
12
|
@url_data_path = "/donations/exports"
|
13
|
-
@url_data_params =
|
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
|
+
|
19
|
+
def white_list_options
|
20
|
+
white_list = [:page]
|
21
|
+
options.clone.delete_if { |key, value| !white_list.include?(key) }
|
22
|
+
end
|
18
23
|
|
19
24
|
end
|
20
25
|
|