Class: TheCity::Group

Inherits:
ApiObject show all
Defined in:
lib/api/group.rb

Instance Attribute Summary

Attributes inherited from ApiObject

#error_messages, #marked_for_destruction

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiObject

__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes

Constructor Details

#initialize(reader = nil) ⇒ Group

Constructor.

Parameters:

  • reader (optional) (defaults to: nil)

    The object that has the data. This can be a TheCity::GroupReader or Hash object.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/api/group.rb', line 52

def initialize(reader = nil)
  if reader.is_a?(GroupReader)
    initialize_from_json_object(reader.load_feed) 
  elsif reader.is_a?(Hash)
    initialize_from_json_object(reader)
  end
  @writer_object = GroupWriter

  @address_list = nil
  @checkin_list = nil
  @event_attendance_list = nil
  @export_list = nil
  @invitations = nil
  @role_list = nil
  @tag_list = nil
end

Class Method Details

.load_group_by_id(group_id, options = {}) ⇒ Object

Loads the group by the specified ID.

Returns a new TheCity::Group object.

Parameters:

  • group_id

    The ID of the group to load.

  • options (defaults to: {})

    A hash of options for requesting data from the server.



42
43
44
45
# File 'lib/api/group.rb', line 42

def self.load_group_by_id(group_id, options = {})
  group_reader = GroupReader.new(group_id, options)
  self.new(group_reader)
end

Instance Method Details

#addresses(force_reload = false) ⇒ GroupAddressList

The address information.

Returns:



73
74
75
76
77
78
79
80
81
# File 'lib/api/group.rb', line 73

def addresses(force_reload = false)
  unless force_reload
    return @address_list unless @address_list.nil?  
  end
  return nil unless self.id

  @address_list = GroupAddressList.new({:group_id => self.id})
  return @address_list
end

#checkins(force_reload = false) ⇒ GroupCheckinList

The checkin information.

Returns:



87
88
89
90
91
92
93
94
95
# File 'lib/api/group.rb', line 87

def checkins(force_reload = false)
  unless force_reload
    return @checkin_list unless @checkin_list.nil?  
  end
  return nil unless self.id

  @checkin_list = GroupCheckinList.new({:group_id => self.id})
  return @checkin_list
end

#event_attendances(force_reload = false) ⇒ GroupEventAttendanceList

The checkin information.



115
116
117
118
119
120
121
122
123
# File 'lib/api/group.rb', line 115

def event_attendances(force_reload = false)
  unless force_reload
    return @event_attendance_list unless @event_attendance_list.nil?  
  end
  return nil unless self.id

  @event_attendance_list = GroupEventAttendanceList.new({:group_id => self.id})
  return @event_attendance_list
end

#exports(force_reload = false) ⇒ GroupExportList

The checkin information.

Returns:



101
102
103
104
105
106
107
108
109
# File 'lib/api/group.rb', line 101

def exports(force_reload = false)
  unless force_reload
    return @export_list unless @export_list.nil?  
  end
  return nil unless self.id

  @export_list = GroupExportList.new({:group_id => self.id})
  return @export_list
end

#invitations(force_reload = false) ⇒ GroupInvitationList

The invitations for this group.

Returns:



129
130
131
132
133
134
135
136
137
# File 'lib/api/group.rb', line 129

def invitations(force_reload = false)
  unless force_reload
    return @invitation_list unless @invitation_list.nil?  
  end
  return nil unless self.id
 
  @invitation_list = GroupInvitationList.new({:group_id => self.id})
  return @invitation_list
end

#roles(force_reload = false) ⇒ GroupRoleList

The roles for this group.

Returns:



143
144
145
146
147
148
149
150
151
# File 'lib/api/group.rb', line 143

def roles(force_reload = false)
  unless force_reload
    return @role_list unless @role_list.nil?  
  end
  return nil unless self.id
 
  @role_list = GroupRoleList.new({:group_id => self.id})
  return @role_list
end

#tags(force_reload = false) ⇒ GroupTagList

The tags for this group.

Returns:



157
158
159
160
161
162
163
164
165
# File 'lib/api/group.rb', line 157

def tags(force_reload = false)
  unless force_reload
    return @tag_list unless @tag_list.nil?  
  end
  return nil unless self.id
  
  @tag_list = GroupTagList.new({:group_id => self.id})
  return @tag_list
end