Class: TheCity::Family
Instance Attribute Summary
Attributes inherited from ApiObject
#error_messages, #marked_for_destruction
Class Method Summary collapse
-
.load_by_id(family_id) ⇒ Object
Loads the family by the specified ID.
Instance Method Summary collapse
- #add_family_member(member) ⇒ Object
-
#initialize(json_data = nil) ⇒ Family
constructor
Constructor.
-
#members ⇒ Object
Alias family_members.
Methods inherited from ApiObject
__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes
Constructor Details
#initialize(json_data = nil) ⇒ Family
Constructor.
26 27 28 29 30 |
# File 'lib/api/family.rb', line 26 def initialize(json_data = nil) @family_members = [] @writer_object = FamilyWriter initialize_from_json_object(json_data) unless json_data.nil? end |
Class Method Details
.load_by_id(family_id) ⇒ Object
Loads the family by the specified ID.
Returns a new TheCity::Family object.
16 17 18 19 20 21 |
# File 'lib/api/family.rb', line 16 def self.load_by_id(family_id) reader = FamilyReader.new({:id => family_id}) self.new(reader.load_feed) rescue nil end |
Instance Method Details
#add_family_member(member) ⇒ Object
39 40 41 |
# File 'lib/api/family.rb', line 39 def add_family_member(member) @family_members << member end |
#members ⇒ Object
Alias family_members
34 35 36 |
# File 'lib/api/family.rb', line 34 def members @family_members end |