relaton-bib 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2abaf5913dd0232af19e1c20dc414e03600ad0aa
4
- data.tar.gz: 894d6a6c92caade62b6eb08f36330285ba29db49
3
+ metadata.gz: ae823658c869e7c4d00aef9221fdf350c392983d
4
+ data.tar.gz: 825dc45f0be774a8ab5223cee4228756f0980d43
5
5
  SHA512:
6
- metadata.gz: e7352c621df13c1b88f884b57aff48fa0747616f0f5742983da8f054b81199732b058d09d53e0f52692010cbeda9094fdcf31980e5467bd339cd93205fc65388
7
- data.tar.gz: 9fdd392bd65b2c89063eae8c4367aaf62f48abe3ca3295cec9b1efbd72f337c5b0b89d8b73ec05d598e702cbd10d7e3a9323ed8c76a14459daa9e9a528a8ebe5
6
+ metadata.gz: 24d8041638369f3e86da7e3dbb28f6aae1f399377f301a69d26bfadf0d3099c428517f6910e8563efa470aa5756a29ca4952fe613a4956d5097531930890c9c9
7
+ data.tar.gz: 2ca098df8c11661cc0c7a34830528b667e47da674c9afa0a14e0f1e55737adace2533a5a99be67630be7e3269c28bc5c35a789a71c0d3bd9ba9722a7047ec32d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-bib (0.2.5)
4
+ relaton-bib (0.3.0)
5
5
  addressable
6
6
  nokogiri (~> 1.10)
7
7
 
data/README.adoc CHANGED
@@ -33,7 +33,7 @@ item = RelatonBib::BibliographicItem.new(
33
33
  id: "ISO/TC211",
34
34
  fetched: Date.today.to_s,
35
35
  type: "standard",
36
- titles: [
36
+ title: [
37
37
  { type: "main", content: "Geographic information", language: "en", script: "Latn" },
38
38
  {
39
39
  content: "Information géographique", language: "fr", script: "Latn"
@@ -50,16 +50,16 @@ item = RelatonBib::BibliographicItem.new(
50
50
  RelatonBib::DocumentIdentifier.new(id: "TC211", type: "ISO")
51
51
  ],
52
52
  docnumber: "123456",
53
- dates: [
53
+ date: [
54
54
  { type: "issued", on: "2014" },
55
55
  { type: "published", on: "2014-04" },
56
56
  { type: "accessed", on: "2015-05-20" }
57
57
  ],
58
- contributors: [
58
+ contributor: [
59
59
  { entity: {
60
60
  name: "International Organization for Standardization",
61
61
  url: "www.iso.org", abbreviation: "ISO", subdivision: "division" },
62
- roles: [["publisher", ["Publisher role"]]], }
62
+ role: [["publisher", ["Publisher role"]]], }
63
63
  ],
64
64
  edition: "1",
65
65
  version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]),
@@ -79,7 +79,7 @@ item = RelatonBib::BibliographicItem.new(
79
79
  abbreviation: "ISO", url: "www.iso.org"
80
80
  },
81
81
  from: "2014", to: "2020" },
82
- relations: [
82
+ relation: [
83
83
  { type: "updates",
84
84
  bibitem: RelatonBib::BibliographicItem.new(
85
85
  formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"),
@@ -5,13 +5,13 @@ require "time"
5
5
  module RelatonBib
6
6
  class << self
7
7
  def dates_hash_to_bib(ret)
8
- return unless ret[:dates]
9
- ret[:dates] = array(ret[:dates])
10
- ret[:dates].each_with_index do |d, i|
8
+ return unless ret[:date]
9
+ ret[:date] = array(ret[:date])
10
+ ret[:date].each_with_index do |d, i|
11
11
  # value is synonym of on: it is reserved word in YAML
12
12
  if d[:value]
13
- ret[:dates][i][:on] ||= d[:value]
14
- ret[:dates][i].delete(:value)
13
+ ret[:date][i][:on] ||= d[:value]
14
+ ret[:date][i].delete(:value)
15
15
  end
16
16
  end
17
17
  end
@@ -35,9 +35,9 @@ module RelatonBib
35
35
  end
36
36
 
37
37
  def title_hash_to_bib(ret)
38
- return unless ret[:titles]
39
- ret[:titles] = array(ret[:titles])
40
- ret[:titles] = ret[:titles].map do |t|
38
+ return unless ret[:title]
39
+ ret[:title] = array(ret[:title])
40
+ ret[:title] = ret[:title].map do |t|
41
41
  t.is_a?(Hash) ? t : { content: t, language: "en", script: "Latn",
42
42
  format: "text/plain", type: "main" }
43
43
  end
@@ -101,10 +101,10 @@ module RelatonBib
101
101
  attr_reader :docnumber
102
102
 
103
103
  # @return [Array<RelatonBib::BibliographicDate>]
104
- attr_reader :dates
104
+ attr_reader :date
105
105
 
106
106
  # @return [Array<RelatonBib::ContributionInfo>]
107
- attr_reader :contributors
107
+ attr_reader :contributor
108
108
 
109
109
  # @return [String, NillClass]
110
110
  attr_reader :edition
@@ -134,7 +134,7 @@ module RelatonBib
134
134
  attr_reader :copyright
135
135
 
136
136
  # @return [RelatonBib::DocRelationCollection]
137
- attr_reader :relations
137
+ attr_reader :relation
138
138
 
139
139
  # @return [Array<RelatonBib::Series>]
140
140
  attr_reader :series
@@ -184,18 +184,18 @@ module RelatonBib
184
184
  # @param validity [RelatonBib:Validity, NilClass]
185
185
  # @param fetched [Date, NilClass] default nil
186
186
  #
187
- # @param dates [Array<Hash>]
188
- # @option dates [String] :type
189
- # @option dates [String] :from
190
- # @option dates [String] :to
187
+ # @param date [Array<Hash>]
188
+ # @option date [String] :type
189
+ # @option date [String] :from
190
+ # @option date [String] :to
191
191
  #
192
- # @param contributors [Array<Hash>]
193
- # @option contributors [RealtonBib::Organization, RelatonBib::Person]
194
- # @option contributors [String] :type
195
- # @option contributors [String] :from
196
- # @option contributirs [String] :to
197
- # @option contributors [String] :abbreviation
198
- # @option contributors [Array<Array<String,Array<String>>>] :roles
192
+ # @param contributor [Array<Hash>]
193
+ # @option contributor [RealtonBib::Organization, RelatonBib::Person]
194
+ # @option contributor [String] :type
195
+ # @option contributor [String] :from
196
+ # @option contributor [String] :to
197
+ # @option contributor [String] :abbreviation
198
+ # @option contributor [Array<Array<String,Array<String>>>] :role
199
199
  #
200
200
  # @param abstract [Array<Hash, RelatonBib::FormattedString>]
201
201
  # @option abstract [String] :content
@@ -203,27 +203,31 @@ module RelatonBib
203
203
  # @option abstract [String] :script
204
204
  # @option abstract [String] :type
205
205
  #
206
- # @param relations [Array<Hash>]
207
- # @option relations [String] :type
208
- # @option relations [RelatonBib::BibliographicItem, RelatonIso::IsoBibliographicItem] :bibitem
209
- # @option relations [Array<RelatonBib::BibItemLocality>] :bib_locality
206
+ # @param relation [Array<Hash>]
207
+ # @option relation [String] :type
208
+ # @option relation [RelatonBib::BibliographicItem, RelatonIso::IsoBibliographicItem] :bibitem
209
+ # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
210
+ #
211
+ # @param link [Array<Hash, RelatonBib::TypedUri>]
212
+ # @option link [String] :type
213
+ # @option link [String] :content
210
214
  def initialize(**args)
211
215
  if args[:type] && !TYPES.include?(args[:type])
212
216
  raise ArgumentError, %{Type "#{args[:type]}" is invalid.}
213
217
  end
214
218
 
215
- @title = (args[:titles] || []).map do |t|
219
+ @title = (args[:title] || []).map do |t|
216
220
  t.is_a?(Hash) ? TypedTitleString.new(t) : t
217
221
  end
218
222
 
219
- @dates = (args[:dates] || []).map do |d|
223
+ @date = (args[:date] || []).map do |d|
220
224
  d.is_a?(Hash) ? BibliographicDate.new(d) : d
221
225
  end
222
226
 
223
- @contributors = (args[:contributors] || []).map do |c|
227
+ @contributor = (args[:contributor] || []).map do |c|
224
228
  if c.is_a? Hash
225
229
  e = c[:entity].is_a?(Hash) ? Organization.new(c[:entity]) : c[:entity]
226
- ContributionInfo.new(entity: e, role: c[:roles])
230
+ ContributionInfo.new(entity: e, role: c[:role])
227
231
  else c
228
232
  end
229
233
  end
@@ -250,7 +254,7 @@ module RelatonBib
250
254
  @language = args.fetch :language, []
251
255
  @script = args.fetch :script, []
252
256
  @status = args[:docstatus]
253
- @relations = DocRelationCollection.new(args[:relations] || [])
257
+ @relation = DocRelationCollection.new(args[:relation] || [])
254
258
  @link = args.fetch(:link, []).map { |s| s.is_a?(Hash) ? TypedUri.new(s) : s }
255
259
  @series = args.fetch :series, []
256
260
  @medium = args[:medium]
@@ -290,7 +294,7 @@ module RelatonBib
290
294
 
291
295
  # @return [String]
292
296
  def shortref(identifier, **opts)
293
- pubdate = dates.select { |d| d.type == "published" }
297
+ pubdate = date.select { |d| d.type == "published" }
294
298
  year = if opts[:no_year] || pubdate.empty? then ""
295
299
  else ":" + pubdate&.first&.on&.year.to_s
296
300
  end
@@ -328,8 +332,8 @@ module RelatonBib
328
332
  link.each { |s| s.to_xml builder }
329
333
  docidentifier.each { |di| di.to_xml builder }
330
334
  builder.docnumber docnumber if docnumber
331
- dates.each { |d| d.to_xml builder, **opts }
332
- contributors.each do |c|
335
+ date.each { |d| d.to_xml builder, **opts }
336
+ contributor.each do |c|
333
337
  builder.contributor do
334
338
  c.role.each { |r| r.to_xml builder }
335
339
  c.to_xml builder
@@ -343,7 +347,7 @@ module RelatonBib
343
347
  abstract.each { |a| builder.abstract { a.to_xml(builder) } }
344
348
  status&.to_xml builder
345
349
  copyright&.to_xml builder
346
- relations.each { |r| r.to_xml builder, **opts }
350
+ relation.each { |r| r.to_xml builder, **opts }
347
351
  series.each { |s| s.to_xml builder }
348
352
  medium&.to_xml builder
349
353
  place.each { |pl| builder.place pl }
@@ -6,14 +6,14 @@ require "relaton_bib/person"
6
6
  module RelatonBib
7
7
  class << self
8
8
  def contributors_hash_to_bib(ret)
9
- return unless ret[:contributors]
10
- ret[:contributors] = array(ret[:contributors])
11
- ret[:contributors]&.each_with_index do |c, i|
12
- ret[:contributors][i][:roles] = array(ret[:contributors][i][:roles])
13
- ret[:contributors][i][:entity] = c[:person] ?
9
+ return unless ret[:contributor]
10
+ ret[:contributor] = array(ret[:contributor])
11
+ ret[:contributor]&.each_with_index do |c, i|
12
+ ret[:contributor][i][:role] = array(ret[:contributor][i][:role])
13
+ ret[:contributor][i][:entity] = c[:person] ?
14
14
  person_hash_to_bib(c[:person]) : org_hash_to_bib(c[:organization])
15
- ret[:contributors][i].delete(:person)
16
- ret[:contributors][i].delete(:organization)
15
+ ret[:contributor][i].delete(:person)
16
+ ret[:contributor][i].delete(:organization)
17
17
  end
18
18
  end
19
19
  end
@@ -18,8 +18,8 @@ module RelatonBib
18
18
  end
19
19
 
20
20
  def contacts_hash_to_bib(c)
21
- return [] unless c[:contacts]
22
- array(c[:contacts]).map do |a|
21
+ return [] unless c[:contact]
22
+ array(c[:contact]).map do |a|
23
23
  (a[:city] || a[:country]) ?
24
24
  RelatonBib::Address.new(
25
25
  street: Array(a[:street]), city: a[:city], postcode: a[:postcode],
@@ -125,13 +125,13 @@ module RelatonBib
125
125
  attr_reader :uri
126
126
 
127
127
  # @return [Array<RelatonBib::Address, RelatonBib::Phone>]
128
- attr_reader :contacts
128
+ attr_reader :contact
129
129
 
130
130
  # @param url [String]
131
- # @param contacts [Array<RelatonBib::Address, RelatonBib::Phone>]
132
- def initialize(url: nil, contacts: [])
131
+ # @param contact [Array<RelatonBib::Address, RelatonBib::Phone>]
132
+ def initialize(url: nil, contact: [])
133
133
  @uri = URI url if url
134
- @contacts = contacts
134
+ @contact = contact
135
135
  end
136
136
 
137
137
  # Returns url.
@@ -142,7 +142,7 @@ module RelatonBib
142
142
 
143
143
  # @params builder [Nokogiri::XML::Builder]
144
144
  def to_xml(builder)
145
- contacts.each { |contact| contact.to_xml builder }
145
+ contact.each { |contact| contact.to_xml builder }
146
146
  end
147
147
  end
148
148
  end
@@ -13,25 +13,25 @@ module RelatonBib
13
13
  # end
14
14
  class << self
15
15
  def relations_hash_to_bib(ret)
16
- return unless ret[:relations]
17
- ret[:relations] = array(ret[:relations])
18
- ret[:relations]&.each_with_index do |r, i|
16
+ return unless ret[:relation]
17
+ ret[:relation] = array(ret[:relation])
18
+ ret[:relation]&.each_with_index do |r, i|
19
19
  relation_bibitem_hash_to_bib(ret, r, i)
20
20
  relation_biblocality_hash_to_bib(ret, r, i)
21
21
  end
22
22
  end
23
23
 
24
24
  def relation_bibitem_hash_to_bib(ret, r, i)
25
- if r[:bibitem] then ret[:relations][i][:bibitem] =
25
+ if r[:bibitem] then ret[:relation][i][:bibitem] =
26
26
  BibliographicItem.new(hash_to_bib(r[:bibitem], true))
27
27
  else
28
28
  warn "bibitem missing: #{r}"
29
- ret[:relations][i][:bibitem] = nil
29
+ ret[:relation][i][:bibitem] = nil
30
30
  end
31
31
  end
32
32
 
33
33
  def relation_biblocality_hash_to_bib(ret, r, i)
34
- ret[:relations][i][:bib_locality] =
34
+ ret[:relation][i][:bib_locality] =
35
35
  array(r[:bib_locality])&.map do |bl|
36
36
  BibItemLocality.new(bl[:type], bl[:reference_from],
37
37
  bl[:reference_to])
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonBib
4
- # Document relations collection
4
+ # Document relation collection
5
5
  class DocRelationCollection < Array
6
- # @param relations [Array<RelatonBib::DocumentRelation, Hash>]
7
- # @option relations [String] :type
8
- # @option relations [String] :identifier
9
- # @option relations [String, NIllClass] :url (nil)
10
- # @option relations [Array<RelatonBib::BibItemLocality>] :bib_locality
11
- # @option relations [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
12
- def initialize(relations)
13
- super relations.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
6
+ # @param relation [Array<RelatonBib::DocumentRelation, Hash>]
7
+ # @option relation [String] :type
8
+ # @option relation [String] :identifier
9
+ # @option relation [String, NIllClass] :url (nil)
10
+ # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
11
+ # @option relation [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
12
+ def initialize(relation)
13
+ super relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
14
14
  end
15
15
 
16
16
  # @return [Array<RelatonBib::DocumentRelation>]
@@ -6,7 +6,7 @@ module RelatonBib
6
6
  class << self
7
7
  def org_hash_to_bib(c)
8
8
  return nil if c.nil?
9
- c[:identifiers] = array(c[:identifiers])&.map do |a|
9
+ c[:identifier] = array(c[:identifier])&.map do |a|
10
10
  OrgIdentifier.new(a[:type], a[:id])
11
11
  end
12
12
  c
@@ -58,7 +58,7 @@ module RelatonBib
58
58
  attr_reader :subdivision
59
59
 
60
60
  # @return [Array<RelatonBib::OrgIdentifier>]
61
- attr_reader :identifiers
61
+ attr_reader :identifier
62
62
 
63
63
  def hash2locstr(name)
64
64
  name.is_a?(Hash) ?
@@ -70,12 +70,12 @@ module RelatonBib
70
70
  # @param abbreviation [RelatoBib::LocalizedStrig, String]
71
71
  # @param subdivision [RelatoBib::LocalizedStrig, String]
72
72
  # @param url [String]
73
- # @param identifiers [Array<RelatonBib::OrgIdentifier>]
74
- # @param contacts [Array<RelatonBib::Address, RelatonBib::Phone>]
73
+ # @param identifier [Array<RelatonBib::OrgIdentifier>]
74
+ # @param contact [Array<RelatonBib::Address, RelatonBib::Phone>]
75
75
  def initialize(**args)
76
76
  raise ArgumentError, "missing keyword: name" unless args[:name]
77
77
 
78
- super(url: args[:url], contacts: args.fetch(:contacts, []))
78
+ super(url: args[:url], contact: args.fetch(:contact, []))
79
79
 
80
80
  @name = if args[:name].is_a?(Array)
81
81
  args[:name].map { |n| hash2locstr(n) }
@@ -95,7 +95,7 @@ module RelatonBib
95
95
  args[:subdivision]
96
96
  end
97
97
 
98
- @identifiers = args.fetch(:identifiers, [])
98
+ @identifier = args.fetch(:identifier, [])
99
99
  end
100
100
 
101
101
  # @param builder [Nokogiri::XML::Builder]
@@ -107,7 +107,7 @@ module RelatonBib
107
107
  builder.subdivision { |s| subdivision.to_xml s } if subdivision
108
108
  builder.abbreviation { |a| abbreviation.to_xml a } if abbreviation
109
109
  builder.uri url if uri
110
- identifiers.each { |identifier| identifier.to_xml builder }
110
+ identifier.each { |identifier| identifier.to_xml builder }
111
111
  super
112
112
  end
113
113
  end
@@ -8,17 +8,17 @@ module RelatonBib
8
8
  Person.new(
9
9
  name: fullname_hash_to_bib(c),
10
10
  affiliation: affiliation_hash_to_bib(c),
11
- contacts: contacts_hash_to_bib(c),
12
- identifiers: person_identifiers_hash_to_bib(c),
11
+ contact: contacts_hash_to_bib(c),
12
+ identifier: person_identifiers_hash_to_bib(c),
13
13
  )
14
14
  end
15
15
 
16
16
  def fullname_hash_to_bib(c)
17
17
  n = c[:name]
18
18
  FullName.new(
19
- forenames: array(n[:forenames])&.map { |f| localname(f, c) },
20
- initials: array(n[:initials])&.map { |f| localname(f, c) },
21
- additions: array(n[:additions])&.map { |f| localname(f, c) },
19
+ forename: array(n[:forename])&.map { |f| localname(f, c) },
20
+ initial: array(n[:initial])&.map { |f| localname(f, c) },
21
+ addition: array(n[:addition])&.map { |f| localname(f, c) },
22
22
  prefix: array(n[:prefix])&.map { |f| localname(f, c) },
23
23
  surname: localname(n[:surname], c),
24
24
  completename: localname(n[:completename], c),
@@ -26,7 +26,7 @@ module RelatonBib
26
26
  end
27
27
 
28
28
  def person_identifiers_hash_to_bib(c)
29
- array(c[:identifiers])&.map do |a|
29
+ array(c[:identifier])&.map do |a|
30
30
  PersonIdentifier.new(a[:type], a[:id])
31
31
  end
32
32
  end
@@ -35,16 +35,16 @@ module RelatonBib
35
35
  # Person's full name
36
36
  class FullName
37
37
  # @return [Array<RelatonBib::LocalizedString>]
38
- attr_accessor :forenames
38
+ attr_accessor :forename
39
39
 
40
40
  # @return [Array<RelatonBib::LocalizedString>]
41
- attr_accessor :initials
41
+ attr_accessor :initial
42
42
 
43
43
  # @return [RelatonBib::LocalizedString]
44
44
  attr_accessor :surname
45
45
 
46
46
  # @return [Array<RelatonBib::LocalizedString>]
47
- attr_accessor :additions
47
+ attr_accessor :addition
48
48
 
49
49
  # @return [Array<RelatonBib::LocalizedString>]
50
50
  attr_accessor :prefix
@@ -53,9 +53,9 @@ module RelatonBib
53
53
  attr_reader :completename
54
54
 
55
55
  # @param surname [RelatonBib::LocalizedString]
56
- # @param forenames [Array<RelatonBib::LocalizedString>]
57
- # @param initials [Array<RelatonBib::LocalizedString>]
58
- # @param additions [Array<RelatonBib::LocalizedString>]
56
+ # @param forename [Array<RelatonBib::LocalizedString>]
57
+ # @param initial [Array<RelatonBib::LocalizedString>]
58
+ # @param addition [Array<RelatonBib::LocalizedString>]
59
59
  # @param prefix [Array<RelatonBib::LocalizedString>]
60
60
  # @param completename [RelatonBib::LocalizedString]
61
61
  def initialize(**args)
@@ -64,9 +64,9 @@ module RelatonBib
64
64
  end
65
65
 
66
66
  @surname = args[:surname]
67
- @forenames = args.fetch :forenames, []
68
- @initials = args.fetch :initials, []
69
- @additions = args.fetch :additions, []
67
+ @forename = args.fetch :forename, []
68
+ @initial = args.fetch :initial, []
69
+ @addition = args.fetch :addition, []
70
70
  @prefix = args.fetch :prefix, []
71
71
  @completename = args[:completename]
72
72
  end
@@ -78,10 +78,10 @@ module RelatonBib
78
78
  builder.completename { completename.to_xml builder }
79
79
  else
80
80
  prefix.each { |p| builder.prefix { p.to_xml builder } }
81
- initials.each { |i| builder.initial { i.to_xml builder } }
82
- additions.each { |a| builder.addition { a.to_xml builder } }
81
+ initial.each { |i| builder.initial { i.to_xml builder } }
82
+ addition.each { |a| builder.addition { a.to_xml builder } }
83
83
  builder.surname { surname.to_xml builder }
84
- forenames.each { |f| builder.forename { f.to_xml builder } }
84
+ forename.each { |f| builder.forename { f.to_xml builder } }
85
85
  end
86
86
  end
87
87
  end
@@ -134,17 +134,17 @@ module RelatonBib
134
134
  attr_accessor :affiliation
135
135
 
136
136
  # @return [Array<RelatonBib::PersonIdentifier>]
137
- attr_accessor :identifiers
137
+ attr_accessor :identifier
138
138
 
139
139
  # @param name [RelatonBib::FullName]
140
140
  # @param affiliation [Array<RelatonBib::Affiliation>]
141
- # @param contacts [Array<RelatonBib::Address, RelatonBib::Phone>]
142
- # @param identifiers [Array<RelatonBib::PersonIdentifier>]
143
- def initialize(name:, affiliation: [], contacts: [], identifiers: [])
144
- super(contacts: contacts)
141
+ # @param contact [Array<RelatonBib::Address, RelatonBib::Phone>]
142
+ # @param identifier [Array<RelatonBib::PersonIdentifier>]
143
+ def initialize(name:, affiliation: [], contact: [], identifier: [])
144
+ super(contact: contact)
145
145
  @name = name
146
146
  @affiliation = affiliation
147
- @identifiers = identifiers
147
+ @identifier = identifier
148
148
  end
149
149
 
150
150
  # @param builder [Nokogiri::XML::Builder]
@@ -152,8 +152,8 @@ module RelatonBib
152
152
  builder.person do
153
153
  name.to_xml builder
154
154
  affiliation.each { |a| a.to_xml builder }
155
- identifiers.each { |id| id.to_xml builder }
156
- contacts.each { |contact| contact.to_xml builder }
155
+ identifier.each { |id| id.to_xml builder }
156
+ contact.each { |contact| contact.to_xml builder }
157
157
  end
158
158
  end
159
159
  end
@@ -19,4 +19,4 @@ module RelatonBib
19
19
  builder.uri(content.to_s, type: type)
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "0.2.5".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
@@ -19,13 +19,13 @@ module RelatonBib
19
19
  id: bibitem[:id]&.empty? ? nil : bibitem[:id],
20
20
  type: bibitem[:type]&.empty? ? nil : bibitem[:type],
21
21
  fetched: bibitem.at("./fetched")&.text,
22
- titles: fetch_titles(bibitem),
22
+ title: fetch_titles(bibitem),
23
23
  formattedref: fref(bibitem),
24
24
  link: fetch_link(bibitem),
25
25
  docid: fetch_docid(bibitem),
26
26
  docnumber: bibitem.at("./docnumber")&.text,
27
- dates: fetch_dates(bibitem),
28
- contributors: fetch_contributors(bibitem),
27
+ date: fetch_dates(bibitem),
28
+ contributor: fetch_contributors(bibitem),
29
29
  edition: bibitem.at("./edition")&.text,
30
30
  version: fetch_version(bibitem),
31
31
  biblionote: fetch_note(bibitem),
@@ -34,7 +34,7 @@ module RelatonBib
34
34
  abstract: fetch_abstract(bibitem),
35
35
  docstatus: fetch_status(bibitem),
36
36
  copyright: fetch_copyright(bibitem),
37
- relations: fetch_relations(bibitem),
37
+ relation: fetch_relations(bibitem),
38
38
  series: fetch_series(bibitem),
39
39
  medium: fetch_medium(bibitem),
40
40
  place: bibitem.xpath("./place").map(&:text),
@@ -165,14 +165,14 @@ module RelatonBib
165
165
  names = org.xpath("name").map do |n|
166
166
  { content: n.text, language: n[:language], script: n[:script] }
167
167
  end
168
- identifiers = org.xpath("./identifier").map do |i|
168
+ identifier = org.xpath("./identifier").map do |i|
169
169
  OrgIdentifier.new(i[:type], i.text)
170
170
  end
171
171
  Organization.new(name: names,
172
172
  abbreviation: org.at("abbreviation")&.text,
173
173
  subdivision: org.at("subdivision")&.text,
174
174
  url: org.at("uri")&.text,
175
- identifiers: identifiers)
175
+ identifier: identifier)
176
176
  end
177
177
 
178
178
  def get_person(person)
@@ -181,22 +181,22 @@ module RelatonBib
181
181
  Affilation.new get_org(org)
182
182
  end
183
183
 
184
- contacts = person.xpath("./address | ./phone | ./email | ./uri").map do |contact|
185
- if contact.name == "address"
186
- streets = contact.xpath("./street").map(&:text)
184
+ contact = person.xpath("./address | ./phone | ./email | ./uri").map do |c|
185
+ if c.name == "address"
186
+ streets = c.xpath("./street").map(&:text)
187
187
  Address.new(
188
188
  street: streets,
189
- city: contact.at("./city").text,
190
- state: contact.at("./state").text,
191
- country: contact.at("./country").text,
192
- postcode: contact.at("./postcode").text,
189
+ city: c.at("./city").text,
190
+ state: c.at("./state").text,
191
+ country: c.at("./country").text,
192
+ postcode: c.at("./postcode").text,
193
193
  )
194
194
  else
195
- Contact.new(type: contact.name, value: contact.text)
195
+ Contact.new(type: c.name, value: c.text)
196
196
  end
197
197
  end
198
198
 
199
- identifiers = person.xpath("./identifier").map do |pi|
199
+ identifier = person.xpath("./identifier").map do |pi|
200
200
  PersonIdentifier.new pi[:type], pi.text
201
201
  end
202
202
 
@@ -212,15 +212,15 @@ module RelatonBib
212
212
 
213
213
  name = FullName.new(
214
214
  completename: cname, surname: sname,
215
- initials: name_part(person, "initial"), forenames: name_part(person, "forename"),
216
- additions: name_part(person, "addition"), prefix: name_part(person, "prefix")
215
+ initial: name_part(person, "initial"), forename: name_part(person, "forename"),
216
+ addition: name_part(person, "addition"), prefix: name_part(person, "prefix")
217
217
  )
218
218
 
219
219
  Person.new(
220
220
  name: name,
221
221
  affiliation: affilations,
222
- contacts: contacts,
223
- identifiers: identifiers,
222
+ contact: contact,
223
+ identifier: identifier,
224
224
  )
225
225
  end
226
226
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-22 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler