Class: Pupa::Post

Inherits:
Object
  • Object
show all
Includes:
Concerns::Contactable, Concerns::Linkable, Concerns::Sourceable, Concerns::Timestamps, Model
Defined in:
lib/pupa/models/post.rb

Overview

A position that exists independent of the person holding it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concerns::Linkable

#add_link, #initialize, #links=

Methods included from Concerns::Contactable

#add_contact_detail, #contact_details=, #initialize

Methods included from Concerns::Sourceable

#add_source, #initialize, #sources=

Methods included from Model

#==, #[], #[]=, #_id=, #add_extra, #extras=, #foreign_properties, #initialize, #to_h, #validate!

Instance Attribute Details

#area_idObject

Returns the value of attribute area_id.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def area_id
  @area_id
end

#end_dateObject

Returns the value of attribute end_date.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def end_date
  @end_date
end

#labelObject

Returns the value of attribute label.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def label
  @label
end

#organization_idObject

Returns the value of attribute organization_id.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def organization_id
  @organization_id
end

#other_labelObject

Returns the value of attribute other_label.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def other_label
  @other_label
end

#roleObject

Returns the value of attribute role.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def role
  @role
end

#start_dateObject

Returns the value of attribute start_date.



13
14
15
# File 'lib/pupa/models/post.rb', line 13

def start_date
  @start_date
end

Instance Method Details

#fingerprintObject

A post should have a unique label within an organization, through it may share a label with a historical post.



27
28
29
# File 'lib/pupa/models/post.rb', line 27

def fingerprint
  super.slice(:label, :organization_id, :end_date)
end

#to_sString

Returns the post's label or role and organization ID.

Returns:

  • (String)

    the post's label or role and organization ID



21
22
23
# File 'lib/pupa/models/post.rb', line 21

def to_s
  "#{label || role} in #{organization_id}"
end