Sha256: 44ed1a826e0eb7eb2fd49114082779751955c9e8cea20dccba5ef92be78f1851

Contents?: true

Size: 903 Bytes

Versions: 3

Compression:

Stored size: 903 Bytes

Contents

module TheCity

  class Family < ApiObject

    tc_attr_accessor :id,
                     :external_id,
                     :created_at,
                     :family_members


    # Loads the family by the specified ID.
    #
    # @param family_id The ID of the family to load.
    #
    # Returns a new {Family} object.
    def self.load_by_id(family_id)
      reader = FamilyReader.new({:id => family_id})
      self.new(reader.load_feed)
    rescue
      nil
    end      

    # Constructor.
    #
    # @param json_data (optional) JSON data of the Family.
    def initialize(json_data = nil)
      @family_members = []
      @writer_object = FamilyWriter
      initialize_from_json_object(json_data) unless json_data.nil?
    end


    # Alias family_members
    def members
      @family_members
    end


    def add_family_member(member)
      @family_members << member
    end

  end

end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
the-city-admin-0.7.1 lib/api/family.rb
the-city-admin-0.7.0 lib/api/family.rb
the-city-admin-0.6.9 lib/api/family.rb