datacite-mapping 0.1.3 → 0.1.4

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: 930b87f0c713df87fdfb98ccec007a1b5bd12782
4
- data.tar.gz: f8972ae87744fb2ecef07f3dcd150ecfdea875ac
3
+ metadata.gz: 0e3a18fb33b9c652f32beb77e758b5e317cfc0b1
4
+ data.tar.gz: 967f6e66468d35a1d1938d3a19d4d530dd0bb22e
5
5
  SHA512:
6
- metadata.gz: 48e367daa0194fdf95bec71d25809047c12fde35d112f31b84868a4598ac464585a2611f31a26350f6df280bc44ab1fc13b491a671ea51110aa6d867a7a78239
7
- data.tar.gz: 787da05d0a22de31f66b6f1865bddee0a70656c817e129df5902cf5893c36d953b06b7a40267b1c82f3b74020cc49e6d47b431362b2b1936ff4214e42057f7f5
6
+ metadata.gz: 048fac57a650168fdd92e1f4c7ba293088a97b87decb7b72aadb5b8a928ec000cc37a6a40c396b7df01327ba75607f949f78fb5e7abd63475c8efe8c2fec8dba
7
+ data.tar.gz: 87e5b52c29f34b3972cf6f208ccb1da757f441ea699ba4665232b4da96a53a1af1b9dd553f85a5c764e4f2754725107bdb97e4be794157fdd865e165cdfdf821
data/.yardopts CHANGED
@@ -1,2 +1,3 @@
1
- --markup markdown
1
+ --markup-provider=redcarpet
2
+ --markup=markdown
2
3
  --default-return ''
data/CHANGES.md CHANGED
@@ -1,10 +1,17 @@
1
+ ## 0.1.4 (6 Jan 2016)
2
+
3
+ - Fix issue where missing `xml:lang` attribute in `<resource>` would produce a `no value, and no default value`
4
+ error instead of defaulting to `'en'` as documented
5
+ - Ensure that YARD formats README correctly when converting from GitHub-flavored Markdown to HTML
6
+ - Update to [XML::MappingExtensions](https://github.com/dmolesUC3/xml-mapping_extensions) 0.3.3
7
+
1
8
  ## 0.1.3 (18 Dec 2015)
2
9
 
3
- - Update to [TypesafeEnum](https://github.com/dmolesUC3/typesafe_enum) 0.1.4.
10
+ - Update to [TypesafeEnum](https://github.com/dmolesUC3/typesafe_enum) 0.1.4
4
11
 
5
12
  ## 0.1.2 (17 Dec 2015)
6
13
 
7
- - Update to [TypesafeEnum](https://github.com/dmolesUC3/typesafe_enum) 0.1.3.
14
+ - Update to [TypesafeEnum](https://github.com/dmolesUC3/typesafe_enum) 0.1.3
8
15
 
9
16
  ## 0.1.1 (14 Dec 2015)
10
17
 
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 The Regents of the University of California
3
+ Copyright (c) 2016 The Regents of the University of California
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ['lib']
25
25
 
26
26
  spec.add_dependency 'typesafe_enum', '~> 0.1', '>= 0.1.4'
27
- spec.add_dependency 'xml-mapping_extensions', '~> 0.3', '>= 0.3.2'
27
+ spec.add_dependency 'xml-mapping_extensions', '~> 0.3', '>= 0.3.3'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.7'
30
30
  spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
@@ -33,5 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'simplecov', '~> 0.9.2'
34
34
  spec.add_development_dependency 'simplecov-console', '~> 0.2.0'
35
35
  spec.add_development_dependency 'rubocop', '~> 0.32.1'
36
+ spec.add_development_dependency 'redcarpet', '~> 3.3'
37
+ spec.add_development_dependency 'github-markup', '~> 1.4'
36
38
  spec.add_development_dependency 'yard', '~> 0.8'
37
39
  end
@@ -16,7 +16,7 @@ module Datacite
16
16
  object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil
17
17
 
18
18
  # @!attribute [rw] affiliations
19
- # @return [Array<Affiliation>, nil] The creator's affiliations. Defaults to an empty list.
19
+ # @return [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
20
20
  array_node :affiliations, 'affiliation', class: String, default_value: []
21
21
 
22
22
  alias_method :_name=, :name=
@@ -28,7 +28,7 @@ module Datacite
28
28
  # Initializes a new {Creator}.
29
29
  # @param name [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil.
30
30
  # @param identifier [NameIdentifier, nil] An identifier for the creator. Optional.
31
- # @param affiliations [Array<Affiliation>, nil] The creator's affiliations. Defaults to an empty list.
31
+ # @param affiliations [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
32
32
  def initialize(name:, identifier: nil, affiliations: [])
33
33
  self.name = name
34
34
  self.identifier = identifier
@@ -4,9 +4,9 @@ module Datacite
4
4
  NAME = 'datacite-mapping'
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.1.3'
7
+ VERSION = '0.1.4'
8
8
 
9
9
  # The copyright notice for this gem
10
- COPYRIGHT = 'Copyright (c) 2015 The Regents of the University of California'
10
+ COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'
11
11
  end
12
12
  end
@@ -52,7 +52,7 @@ module Datacite
52
52
  # @!attribute [rw] language
53
53
  # @return [String] Primary language of the resource: an IETF BCP 47, ISO 639-1 language code.
54
54
  # It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.
55
- text_node :language, 'language'
55
+ text_node :language, 'language', default_value: nil
56
56
 
57
57
  # @!attribute [rw] resource_type
58
58
  # @return [ResourceType, nil] the type of the resource. Optional.
@@ -1,3 +1,5 @@
1
+ require 'logger'
2
+
1
3
  # Module for working with the [DataCite metadata schema](https://schema.datacite.org/meta/kernel-3/index.html)
2
4
  module Datacite
3
5
  # Maps DataCite XML to Ruby objects
@@ -464,6 +464,55 @@ module Datacite
464
464
  end
465
465
  end
466
466
 
467
+ describe '#parse_xml' do
468
+ before(:each) do
469
+ identifier = Identifier.new(value: '10.5072/example-full').save_to_xml
470
+
471
+ creators = REXML::Element.new('creators')
472
+ creators.add_element(Creator.new(
473
+ name: 'Miller, Elizabeth',
474
+ identifier: NameIdentifier.new(scheme: 'ORCID', scheme_uri: URI('http://orcid.org'), value: '0000-0001-5000-0007'),
475
+ affiliations: ['DataCite']
476
+ ).save_to_xml)
477
+
478
+ titles = REXML::Element.new('titles')
479
+ titles.add_element(Title.new(
480
+ language: 'en-us',
481
+ value: 'Full DataCite XML Example'
482
+ ).save_to_xml)
483
+ titles.add_element(Title.new(
484
+ language: 'en-us',
485
+ type: TitleType::SUBTITLE,
486
+ value: 'Demonstration of DataCite Properties.'
487
+ ).save_to_xml)
488
+
489
+ publisher = REXML::Element.new('publisher')
490
+ publisher.text = 'DataCite'
491
+
492
+ publication_year = REXML::Element.new('publicationYear')
493
+ publication_year.text = '2014'
494
+
495
+ resource = REXML::Element.new('resource')
496
+ resource.add_namespace('http://datacite.org/schema/kernel-3')
497
+ resource.add_namespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance')
498
+ resource.add_attribute('xsi:schemaLocation', 'http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd')
499
+ resource.add_element(identifier)
500
+ resource.add_element(creators)
501
+ resource.add_element(titles)
502
+ resource.add_element(publisher)
503
+ resource.add_element(publication_year)
504
+
505
+ @required_xml = resource
506
+ end
507
+
508
+ it 'parses a resource with only required attributes' do
509
+ resource = Resource.parse_xml(@required_xml)
510
+ expect(resource.language).to eq('en')
511
+ end
512
+
513
+ it 'correctly differentiates required and optional attributes'
514
+ end
515
+
467
516
  describe '#save_to_xml' do
468
517
  it 'sets the namespace to http://datacite.org/schema/kernel-3'
469
518
  it "doesn't clobber the namespace on the various xml:lang attributes"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacite-mapping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typesafe_enum
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.3'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.3.2
42
+ version: 0.3.3
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0.3'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.3.2
52
+ version: 0.3.3
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +148,34 @@ dependencies:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
150
  version: 0.32.1
151
+ - !ruby/object:Gem::Dependency
152
+ name: redcarpet
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '3.3'
158
+ type: :development
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: '3.3'
165
+ - !ruby/object:Gem::Dependency
166
+ name: github-markup
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '1.4'
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '1.4'
151
179
  - !ruby/object:Gem::Dependency
152
180
  name: yard
153
181
  requirement: !ruby/object:Gem::Requirement