Module: Relaton::Bib::OrganizationType

Included in:
Organization, Subdivision
Defined in:
lib/relaton/bib/model/organization_type.rb

Defined Under Namespace

Classes: Identifier

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

rubocop:disable Metrics/AbcSize,Metrics/MethodLength



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/relaton/bib/model/organization_type.rb', line 15

def self.included(base) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
  require_relative "subdivision"

  base.instance_eval do
    include Contact

    attribute :name, TypedLocalizedString, collection: true, initialize_empty: true
    attribute :subdivision, Subdivision, collection: true, initialize_empty: true
    attribute :abbreviation, LocalizedString
    attribute :identifier, Identifier, collection: true, initialize_empty: true
    attribute :logo, Logo, collection: true, initialize_empty: true

    xml do
      map_element "name", to: :name
      map_element "subdivision", to: :subdivision
      map_element "abbreviation", to: :abbreviation
      map_element "identifier", to: :identifier
      map_element "address", to: :address
      map_element "phone", to: :phone
      map_element "email", to: :email
      map_element "uri", to: :uri
      map_element "logo", to: :logo
    end
  end
end