Class: Dgrid::API::Person
- Inherits:
-
NamedEntity
- Object
- Entity
- NamedEntity
- Dgrid::API::Person
- Defined in:
- lib/dgrid/api/person.rb
Instance Attribute Summary collapse
-
#birth_date ⇒ Object
Returns the value of attribute birth_date.
-
#death_date ⇒ Object
Returns the value of attribute death_date.
-
#ext_id ⇒ Object
Returns the value of attribute ext_id.
-
#gender ⇒ Object
Returns the value of attribute gender.
Attributes inherited from NamedEntity
Attributes inherited from Entity
#description, #id, #workspaces
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Person
constructor
A new instance of Person.
- #to_hash ⇒ Object
Methods inherited from Entity
#add_entity, #add_workspace, #attach, #connection, #first_workspace, #in_workspace?, #link_to, #new_record?, singular, #type, type
Methods included from SetMembersFromHash
#change_string_keys_to_symbol_keys, #set_members_from_hash, #split_hash
Methods included from Dgrid::ArgumentValidation
Constructor Details
#initialize(options) ⇒ Person
Returns a new instance of Person.
12 13 14 15 16 |
# File 'lib/dgrid/api/person.rb', line 12 def initialize() parent_opts, my_opts = split_hash(,[:id, :name, :description]) super(parent_opts) set_members_from_hash(my_opts) end |
Instance Attribute Details
#birth_date ⇒ Object
Returns the value of attribute birth_date.
4 5 6 |
# File 'lib/dgrid/api/person.rb', line 4 def birth_date @birth_date end |
#death_date ⇒ Object
Returns the value of attribute death_date.
4 5 6 |
# File 'lib/dgrid/api/person.rb', line 4 def death_date @death_date end |
#ext_id ⇒ Object
Returns the value of attribute ext_id.
4 5 6 |
# File 'lib/dgrid/api/person.rb', line 4 def ext_id @ext_id end |
#gender ⇒ Object
Returns the value of attribute gender.
4 5 6 |
# File 'lib/dgrid/api/person.rb', line 4 def gender @gender end |
Class Method Details
.db_fields ⇒ Object
18 19 20 |
# File 'lib/dgrid/api/person.rb', line 18 def self.db_fields %w(id name description gender birth_date death_date) end |
.pluralized ⇒ Object
23 24 25 |
# File 'lib/dgrid/api/person.rb', line 23 def self.pluralized 'people' end |
Instance Method Details
#to_hash ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/dgrid/api/person.rb', line 28 def to_hash h = super h.merge({ :gender => gender, :birth_date => birth_date, :death_date => death_date, :ext_id => ext_id }) end |