Sha256: 3a20b930a22b9a02900dce82b830f887d90a1b961f7f6fedcbcbf6490308abc9

Contents?: true

Size: 766 Bytes

Versions: 8

Compression:

Stored size: 766 Bytes

Contents

module Pupa
  # A position that exists independent of the person holding it.
  class Post < Base
    self.schema = 'popolo/post'

    include Concerns::Timestamps
    include Concerns::Sourceable
    include Concerns::Contactable
    include Concerns::Linkable

    attr_accessor :label, :role, :organization_id, :start_date, :end_date

    foreign_key :organization_id

    # Returns the post's label and organization ID.
    #
    # @return [String] the post's label and organization ID
    def to_s
      "#{label} in #{organization_id}"
    end

    # A post should have a unique label within an organization, through it may
    # share a label with a historical post.
    def fingerprint
      super.slice(:label, :organization_id, :end_date)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pupa-0.0.8 lib/pupa/models/post.rb
pupa-0.0.7 lib/pupa/models/post.rb
pupa-0.0.6 lib/pupa/models/post.rb
pupa-0.0.5 lib/pupa/models/post.rb
pupa-0.0.4 lib/pupa/models/post.rb
pupa-0.0.3 lib/pupa/models/post.rb
pupa-0.0.2 lib/pupa/models/post.rb
pupa-0.0.1 lib/pupa/models/post.rb