Class: ShelbyArena::Person
Instance Attribute Summary
Attributes inherited from ApiObject
#error_messages, #marked_for_destruction
Class Method Summary collapse
-
.load_by_id(person_id) ⇒ Object
Loads the user by the specified ID.
Instance Method Summary collapse
- #email_address ⇒ Object
- #family_role ⇒ Object
-
#initialize(reader = nil, options = {}) ⇒ Person
constructor
Constructor.
- #is_child? ⇒ Boolean
Methods inherited from ApiObject
Constructor Details
#initialize(reader = nil, options = {}) ⇒ Person
Constructor.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/api/person.rb', line 46 def initialize(reader = nil, = {}) @writer_object = PersonWriter if reader.is_a?(PersonReader) initialize_from_json_object(reader.load_data['Person']) elsif reader.is_a?(Hash) initialize_from_json_object(reader) else # new empty raise 'Not sure about this one yet' # reader = PersonReader.new # initialize_from_json_object(reader.load_new['person']) end end |
Class Method Details
.load_by_id(person_id) ⇒ Object
Loads the user by the specified ID.
Returns a new Person object.
34 35 36 37 38 39 |
# File 'lib/api/person.rb', line 34 def self.load_by_id(person_id) reader = PersonReader.new(person_id) self.new(reader) rescue nil end |
Instance Method Details
#email_address ⇒ Object
74 75 76 |
# File 'lib/api/person.rb', line 74 def email_address self.first_active_email end |
#family_role ⇒ Object
65 66 67 |
# File 'lib/api/person.rb', line 65 def family_role self.family_member_role_value.blank? ? 'Other' : self.family_member_role_value end |
#is_child? ⇒ Boolean
70 71 72 |
# File 'lib/api/person.rb', line 70 def is_child? self.family_member_role_value.downcase == 'child' end |