the-city-admin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/api/address.rb +51 -0
- data/lib/api/address_list.rb +62 -0
- data/lib/api/api_object.rb +100 -0
- data/lib/api/barcode.rb +43 -0
- data/lib/api/checkin.rb +37 -0
- data/lib/api/checkin_list.rb +62 -0
- data/lib/api/family.rb +47 -0
- data/lib/api/family_member.rb +28 -0
- data/lib/api/group.rb +162 -0
- data/lib/api/group_address.rb +31 -0
- data/lib/api/group_address_list.rb +63 -0
- data/lib/api/group_checkin.rb +36 -0
- data/lib/api/group_checkin_list.rb +63 -0
- data/lib/api/group_event_attendance.rb +28 -0
- data/lib/api/group_event_attendance_list.rb +63 -0
- data/lib/api/group_export.rb +22 -0
- data/lib/api/group_export_list.rb +63 -0
- data/lib/api/group_invitation.rb +26 -0
- data/lib/api/group_invitation_list.rb +63 -0
- data/lib/api/group_list.rb +74 -0
- data/lib/api/group_role.rb +27 -0
- data/lib/api/group_role_list.rb +62 -0
- data/lib/api/group_tag.rb +20 -0
- data/lib/api/group_tag_list.rb +62 -0
- data/lib/api/metric.rb +50 -0
- data/lib/api/metric_list.rb +72 -0
- data/lib/api/metric_measurement.rb +29 -0
- data/lib/api/metric_measurement_list.rb +62 -0
- data/lib/api/role.rb +43 -0
- data/lib/api/role_list.rb +73 -0
- data/lib/api/skill.rb +21 -0
- data/lib/api/skill_list.rb +73 -0
- data/lib/api/skilled_user_id_list.rb +73 -0
- data/lib/api/skilled_user_list.rb +73 -0
- data/lib/api/tag.rb +32 -0
- data/lib/api/tag_group_list.rb +73 -0
- data/lib/api/tag_list.rb +73 -0
- data/lib/api/terminology.rb +32 -0
- data/lib/api/terminology_list.rb +73 -0
- data/lib/api/user.rb +207 -0
- data/lib/api/user_address.rb +31 -0
- data/lib/api/user_address_list.rb +62 -0
- data/lib/api/user_admin_privilege.rb +28 -0
- data/lib/api/user_admin_privilege_list.rb +63 -0
- data/lib/api/user_barcode.rb +20 -0
- data/lib/api/user_count.rb +40 -0
- data/lib/api/user_family_list.rb +71 -0
- data/lib/api/user_family_member.rb +28 -0
- data/lib/api/user_invitation.rb +26 -0
- data/lib/api/user_invitation_list.rb +63 -0
- data/lib/api/user_list.rb +72 -0
- data/lib/api/user_note.rb +31 -0
- data/lib/api/user_note_list.rb +63 -0
- data/lib/api/user_process.rb +21 -0
- data/lib/api/user_process_list.rb +63 -0
- data/lib/api/user_role.rb +34 -0
- data/lib/api/user_role_list.rb +74 -0
- data/lib/api/user_skill.rb +22 -0
- data/lib/api/user_skill_list.rb +74 -0
- data/lib/api/web_hook.rb +34 -0
- data/lib/api/web_hook_list.rb +74 -0
- data/lib/auto_load.rb +23 -0
- data/lib/cachers/cache_adapter.rb +50 -0
- data/lib/cachers/file/json_cache.rb +135 -0
- data/lib/common.rb +124 -0
- data/lib/exceptions.rb +5 -0
- data/lib/readers/address_list_reader.rb +21 -0
- data/lib/readers/address_reader.rb +22 -0
- data/lib/readers/api_reader.rb +28 -0
- data/lib/readers/checkin_list_reader.rb +21 -0
- data/lib/readers/checkin_reader.rb +22 -0
- data/lib/readers/family_reader.rb +21 -0
- data/lib/readers/group_address_list_reader.rb +25 -0
- data/lib/readers/group_checkin_list_reader.rb +25 -0
- data/lib/readers/group_event_attendance_list_reader.rb +25 -0
- data/lib/readers/group_export_list_reader.rb +25 -0
- data/lib/readers/group_invitation_list_reader.rb +23 -0
- data/lib/readers/group_list_reader.rb +25 -0
- data/lib/readers/group_reader.rb +21 -0
- data/lib/readers/group_role_list_reader.rb +23 -0
- data/lib/readers/group_tag_list_reader.rb +23 -0
- data/lib/readers/metric_list_reader.rb +22 -0
- data/lib/readers/metric_measurement_list_reader.rb +21 -0
- data/lib/readers/metric_measurement_reader.rb +22 -0
- data/lib/readers/metric_reader.rb +21 -0
- data/lib/readers/role_list_reader.rb +21 -0
- data/lib/readers/skill_list_reader.rb +21 -0
- data/lib/readers/skilled_user_id_list_reader.rb +22 -0
- data/lib/readers/skilled_user_list_reader.rb +22 -0
- data/lib/readers/tag_group_list_reader.rb +22 -0
- data/lib/readers/tag_list_reader.rb +22 -0
- data/lib/readers/tag_reader.rb +22 -0
- data/lib/readers/terminology_list_reader.rb +22 -0
- data/lib/readers/terminology_reader.rb +22 -0
- data/lib/readers/user_address_list_reader.rb +25 -0
- data/lib/readers/user_admin_privilege_list_reader.rb +23 -0
- data/lib/readers/user_count_reader.rb +32 -0
- data/lib/readers/user_family_list_reader.rb +24 -0
- data/lib/readers/user_invitation_list_reader.rb +23 -0
- data/lib/readers/user_list_reader.rb +25 -0
- data/lib/readers/user_note_list_reader.rb +23 -0
- data/lib/readers/user_process_list_reader.rb +23 -0
- data/lib/readers/user_reader.rb +24 -0
- data/lib/readers/user_role_list_reader.rb +23 -0
- data/lib/readers/user_skill_list_reader.rb +23 -0
- data/lib/readers/web_hook_list_reader.rb +21 -0
- data/lib/the_city_admin.rb +82 -0
- data/lib/writers/api_writer.rb +54 -0
- data/lib/writers/family_writer.rb +25 -0
- data/lib/writers/group_address_writer.rb +32 -0
- data/lib/writers/group_writer.rb +25 -0
- data/lib/writers/metric_measurement_writer.rb +25 -0
- data/lib/writers/metric_writer.rb +29 -0
- data/lib/writers/skill_writer.rb +25 -0
- data/lib/writers/tag_writer.rb +27 -0
- data/lib/writers/terminology_writer.rb +19 -0
- data/lib/writers/user_address_writer.rb +32 -0
- data/lib/writers/user_admin_privilege_writer.rb +24 -0
- data/lib/writers/user_invitation_writer.rb +23 -0
- data/lib/writers/user_note_writer.rb +25 -0
- data/lib/writers/user_role_writer.rb +28 -0
- data/lib/writers/user_skill_writer.rb +23 -0
- data/lib/writers/user_writer.rb +46 -0
- data/lib/writers/web_hook_writer.rb +20 -0
- metadata +184 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupAddress < ApiObject
|
|
4
|
+
|
|
5
|
+
tc_attr_accessor :city,
|
|
6
|
+
:created_at,
|
|
7
|
+
:id,
|
|
8
|
+
:latitude,
|
|
9
|
+
:location_type,
|
|
10
|
+
:longitude,
|
|
11
|
+
:privacy,
|
|
12
|
+
:state,
|
|
13
|
+
:street,
|
|
14
|
+
:updated_at,
|
|
15
|
+
:group_id,
|
|
16
|
+
:zipcode
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Constructor.
|
|
20
|
+
#
|
|
21
|
+
# @param json_data (optional) JSON data of the group address.
|
|
22
|
+
def initialize(json_data = nil)
|
|
23
|
+
@writer_object = GroupAddressWriter
|
|
24
|
+
initialize_from_json_object(json_data) unless json_data.nil?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupAddressList
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
|
8
|
+
|
|
9
|
+
# Constructor.
|
|
10
|
+
#
|
|
11
|
+
# @param options A hash of options for loading the list.
|
|
12
|
+
#
|
|
13
|
+
# Options:
|
|
14
|
+
# :group_id - The ID of the group to load the addresses for. (required)
|
|
15
|
+
# :page - The page number to get.
|
|
16
|
+
# :reader - The Reader to use to load the data.
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# Examples:
|
|
20
|
+
# GroupAddressList.new({:group_id => 12345})
|
|
21
|
+
#
|
|
22
|
+
# GroupAddressList.new({:group_id => 12345, :page => 2})
|
|
23
|
+
#
|
|
24
|
+
def initialize(options = {})
|
|
25
|
+
reader = options[:reader] || TheCity::GroupAddressListReader.new(options)
|
|
26
|
+
@json_data = reader.load_feed
|
|
27
|
+
|
|
28
|
+
@total_entries = @json_data['total_entries']
|
|
29
|
+
@total_pages = @json_data['total_pages']
|
|
30
|
+
@per_page = @json_data['per_page']
|
|
31
|
+
@current_page = @json_data['current_page']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Get the specified note.
|
|
36
|
+
#
|
|
37
|
+
# @param index The index of the note to get.
|
|
38
|
+
#
|
|
39
|
+
# @return [GroupAddress]
|
|
40
|
+
def [](index)
|
|
41
|
+
GroupAddress.new( @json_data['addresses'][index] ) if @json_data['addresses'][index]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# This method is needed for Enumerable.
|
|
46
|
+
def each &block
|
|
47
|
+
@json_data['addresses'].each{ |address| yield( GroupAddress.new(address) )}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Alias the count method
|
|
52
|
+
alias :size :count
|
|
53
|
+
|
|
54
|
+
# Checks if the list is empty.
|
|
55
|
+
#
|
|
56
|
+
# @return True on empty, false otherwise.
|
|
57
|
+
def empty?
|
|
58
|
+
@json_data['addresses'].empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupCheckin < ApiObject
|
|
4
|
+
|
|
5
|
+
tc_attr_accessor :group,
|
|
6
|
+
:checked_out_by_user,
|
|
7
|
+
:special_instructions,
|
|
8
|
+
:parent_group_name,
|
|
9
|
+
:callboard_number,
|
|
10
|
+
:checked_in_at,
|
|
11
|
+
:barcode,
|
|
12
|
+
:checked_in_user,
|
|
13
|
+
:checked_in_user_id,
|
|
14
|
+
:id,
|
|
15
|
+
:checked_in_by_user,
|
|
16
|
+
:checked_in_by_user_id,
|
|
17
|
+
:parent_receipt_barcode,
|
|
18
|
+
:event,
|
|
19
|
+
:checked_in_user_notes,
|
|
20
|
+
:checked_out_at,
|
|
21
|
+
:parent_group_id,
|
|
22
|
+
:pager_number
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Constructor.
|
|
26
|
+
#
|
|
27
|
+
# @param json_data JSON data of the group checkin.
|
|
28
|
+
def initialize(json_data)
|
|
29
|
+
initialize_from_json_object(json_data)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupCheckinList
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
|
8
|
+
|
|
9
|
+
# Constructor.
|
|
10
|
+
#
|
|
11
|
+
# @param options A hash of options for loading the list.
|
|
12
|
+
#
|
|
13
|
+
# Options:
|
|
14
|
+
# :group_id - The ID of the group to load the addresses for. (required)
|
|
15
|
+
# :page - The page number to get.
|
|
16
|
+
# :reader - The Reader to use to load the data.
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# Examples:
|
|
20
|
+
# GroupCheckinList.new({:group_id => 12345})
|
|
21
|
+
#
|
|
22
|
+
# GroupCheckinList.new({:group_id => 12345, :page => 2})
|
|
23
|
+
#
|
|
24
|
+
def initialize(options = {})
|
|
25
|
+
reader = options[:reader] || TheCity::GroupCheckinListReader.new(options)
|
|
26
|
+
@json_data = reader.load_feed
|
|
27
|
+
|
|
28
|
+
@total_entries = @json_data['total_entries']
|
|
29
|
+
@total_pages = @json_data['total_pages']
|
|
30
|
+
@per_page = @json_data['per_page']
|
|
31
|
+
@current_page = @json_data['current_page']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Get the specified note.
|
|
36
|
+
#
|
|
37
|
+
# @param index The index of the note to get.
|
|
38
|
+
#
|
|
39
|
+
# @return [GroupCheckin]
|
|
40
|
+
def [](index)
|
|
41
|
+
GroupCheckin.new( @json_data['checkins'][index] ) if @json_data['checkins'][index]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# This method is needed for Enumerable.
|
|
46
|
+
def each &block
|
|
47
|
+
@json_data['checkins'].each{ |checkin| yield( GroupCheckin.new(checkin) )}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Alias the count method
|
|
52
|
+
alias :size :count
|
|
53
|
+
|
|
54
|
+
# Checks if the list is empty.
|
|
55
|
+
#
|
|
56
|
+
# @return True on empty, false otherwise.
|
|
57
|
+
def empty?
|
|
58
|
+
@json_data['checkins'].empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupEventAttendance < ApiObject
|
|
4
|
+
|
|
5
|
+
tc_attr_accessor :user,
|
|
6
|
+
:created_at,
|
|
7
|
+
:event_title,
|
|
8
|
+
:event_id,
|
|
9
|
+
:updated_at,
|
|
10
|
+
:tracked_by,
|
|
11
|
+
:id,
|
|
12
|
+
:user_id,
|
|
13
|
+
:attended_on,
|
|
14
|
+
:tracked_by_user_id,
|
|
15
|
+
:checkin_id
|
|
16
|
+
|
|
17
|
+
# Constructor.
|
|
18
|
+
#
|
|
19
|
+
# @param json_data JSON data of the group checkin.
|
|
20
|
+
def initialize(json_data)
|
|
21
|
+
initialize_from_json_object(json_data)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupEventAttendanceList
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
|
8
|
+
|
|
9
|
+
# Constructor.
|
|
10
|
+
#
|
|
11
|
+
# @param options A hash of options for loading the list.
|
|
12
|
+
#
|
|
13
|
+
# Options:
|
|
14
|
+
# :group_id - The ID of the group to load the addresses for. (required)
|
|
15
|
+
# :page - The page number to get.
|
|
16
|
+
# :reader - The Reader to use to load the data.
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# Examples:
|
|
20
|
+
# GroupEventAttendanceList.new({:group_id => 12345})
|
|
21
|
+
#
|
|
22
|
+
# GroupEventAttendanceList.new({:group_id => 12345, :page => 2})
|
|
23
|
+
#
|
|
24
|
+
def initialize(options = {})
|
|
25
|
+
reader = options[:reader] || TheCity::GroupEventAttendanceListReader.new(options)
|
|
26
|
+
@json_data = reader.load_feed
|
|
27
|
+
|
|
28
|
+
@total_entries = @json_data['total_entries']
|
|
29
|
+
@total_pages = @json_data['total_pages']
|
|
30
|
+
@per_page = @json_data['per_page']
|
|
31
|
+
@current_page = @json_data['current_page']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Get the specified note.
|
|
36
|
+
#
|
|
37
|
+
# @param index The index of the note to get.
|
|
38
|
+
#
|
|
39
|
+
# @return [GroupEventAttendance]
|
|
40
|
+
def [](index)
|
|
41
|
+
GroupEventAttendance.new( @json_data['event_attendances'][index] ) if @json_data['event_attendances'][index]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# This method is needed for Enumerable.
|
|
46
|
+
def each &block
|
|
47
|
+
@json_data['event_attendances'].each{ |attendance| yield( GroupEventAttendance.new(attendance) )}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Alias the count method
|
|
52
|
+
alias :size :count
|
|
53
|
+
|
|
54
|
+
# Checks if the list is empty.
|
|
55
|
+
#
|
|
56
|
+
# @return True on empty, false otherwise.
|
|
57
|
+
def empty?
|
|
58
|
+
@json_data['event_attendances'].empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupExport < ApiObject
|
|
4
|
+
|
|
5
|
+
tc_attr_accessor :id,
|
|
6
|
+
:state,
|
|
7
|
+
:authenticated_s3_url,
|
|
8
|
+
:created_at
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Constructor.
|
|
12
|
+
#
|
|
13
|
+
# @param json_data JSON data of the group export.
|
|
14
|
+
def initialize(json_data)
|
|
15
|
+
initialize_from_json_object(json_data)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupExportList
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
|
8
|
+
|
|
9
|
+
# Constructor.
|
|
10
|
+
#
|
|
11
|
+
# @param options A hash of options for loading the list.
|
|
12
|
+
#
|
|
13
|
+
# Options:
|
|
14
|
+
# :group_id - The ID of the group to load the addresses for. (required)
|
|
15
|
+
# :page - The page number to get.
|
|
16
|
+
# :reader - The Reader to use to load the data.
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# Examples:
|
|
20
|
+
# GroupExportList.new({:group_id => 12345})
|
|
21
|
+
#
|
|
22
|
+
# GroupExportList.new({:group_id => 12345, :page => 2})
|
|
23
|
+
#
|
|
24
|
+
def initialize(options = {})
|
|
25
|
+
reader = options[:reader] || TheCity::GroupExportListReader.new(options)
|
|
26
|
+
@json_data = reader.load_feed
|
|
27
|
+
|
|
28
|
+
@total_entries = @json_data['total_entries']
|
|
29
|
+
@total_pages = @json_data['total_pages']
|
|
30
|
+
@per_page = @json_data['per_page']
|
|
31
|
+
@current_page = @json_data['current_page']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Get the specified note.
|
|
36
|
+
#
|
|
37
|
+
# @param index The index of the note to get.
|
|
38
|
+
#
|
|
39
|
+
# @return [GroupExport]
|
|
40
|
+
def [](index)
|
|
41
|
+
GroupExport.new( @json_data['exports'][index] ) if @json_data['exports'][index]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# This method is needed for Enumerable.
|
|
46
|
+
def each &block
|
|
47
|
+
@json_data['exports'].each{ |export| yield( GroupExport.new(export) )}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Alias the count method
|
|
52
|
+
alias :size :count
|
|
53
|
+
|
|
54
|
+
# Checks if the list is empty.
|
|
55
|
+
#
|
|
56
|
+
# @return True on empty, false otherwise.
|
|
57
|
+
def empty?
|
|
58
|
+
@json_data['exports'].empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupInvitation < ApiObject
|
|
4
|
+
|
|
5
|
+
tc_attr_accessor :created_at,
|
|
6
|
+
:custom_message,
|
|
7
|
+
:email,
|
|
8
|
+
:group_id,
|
|
9
|
+
:id,
|
|
10
|
+
:pending_approval,
|
|
11
|
+
:source,
|
|
12
|
+
:user_id
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Constructor.
|
|
16
|
+
#
|
|
17
|
+
# @param json_data JSON data of the note.
|
|
18
|
+
def initialize(json_data)
|
|
19
|
+
initialize_from_json_object(json_data)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module TheCity
|
|
2
|
+
|
|
3
|
+
class GroupInvitationList
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_reader :total_entries, :total_pages, :per_page, :current_page
|
|
8
|
+
|
|
9
|
+
# Constructor.
|
|
10
|
+
#
|
|
11
|
+
# @param options A hash of options for loading the list.
|
|
12
|
+
#
|
|
13
|
+
# Options:
|
|
14
|
+
# :group_id - The ID of the group to load the invitations for. (required)
|
|
15
|
+
# :page - The page number to get.
|
|
16
|
+
# :reader - The Reader to use to load the data.
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
# Examples:
|
|
20
|
+
# GroupInvitationList.new({:group_id => 12345})
|
|
21
|
+
#
|
|
22
|
+
# GroupInvitationList.new({:group_id => 12345, :page => 2})
|
|
23
|
+
#
|
|
24
|
+
def initialize(options = {})
|
|
25
|
+
reader = options[:reader] || TheCity::GroupInvitationListReader.new(options)
|
|
26
|
+
@json_data = reader.load_feed
|
|
27
|
+
|
|
28
|
+
@total_entries = @json_data['total_entries']
|
|
29
|
+
@total_pages = @json_data['total_pages']
|
|
30
|
+
@per_page = @json_data['per_page']
|
|
31
|
+
@current_page = @json_data['current_page']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Get the specified invitation.
|
|
36
|
+
#
|
|
37
|
+
# @param index The index of the invitation to get.
|
|
38
|
+
#
|
|
39
|
+
# @return [GroupInvitation]
|
|
40
|
+
def [](index)
|
|
41
|
+
GroupInvitation.new( @json_data['invitations'][index] ) if @json_data['invitations'][index]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# This method is needed for Enumerable.
|
|
46
|
+
def each &block
|
|
47
|
+
@json_data['invitations'].each{ |invitation| yield( GroupInvitation.new(invitation) )}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Alias the count method
|
|
52
|
+
alias :size :count
|
|
53
|
+
|
|
54
|
+
# Checks if the list is empty.
|
|
55
|
+
#
|
|
56
|
+
# @return True on empty, false otherwise.
|
|
57
|
+
def empty?
|
|
58
|
+
@json_data['invitations'].empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|