iso-bib-item 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'iso_bib_item/document_status'
4
+ require 'iso_bib_item/localized_string'
5
+
6
+ module IsoBibItem
7
+ module IsoDocumentStageCodes
8
+ PREELIMINARY = '00'
9
+ PROPOSAL = '10'
10
+ PREPARATORY = '20'
11
+ COMMITTE = '30'
12
+ ENQUIRY = '40'
13
+ APPROVAL = '50'
14
+ PUBLICATION = '60'
15
+ REVIEW = '90'
16
+ WITHDRAWAL = '95'
17
+ end
18
+
19
+ module IsoDocumentSubstageCodes
20
+ REGISTRATION = '00'
21
+ START_OF_MAIN_ACTION = '20'
22
+ COMPLETION_OF_MAIN_ACTION = '60'
23
+ REPEAT_AN_EARLIER_PHASE = '92'
24
+ REPEAT_CURRENT_PHASE = '92'
25
+ ABADON = '98'
26
+ PROCEED = '99'
27
+ end
28
+
29
+ # ISO Document status.
30
+ class IsoDocumentStatus < DocumentStatus
31
+ # @return [IsoDocumentStageCodes]
32
+ attr_accessor :stage
33
+
34
+ # @return [IsoDocumentSubstageCodes]
35
+ attr_accessor :substage
36
+
37
+ # @param status [String]
38
+ # @param stage [IsoDocumentStageCodes]
39
+ # @param substage [IsoDocumentSubstageCodes]
40
+ def initialize(status:, stage:, substage:)
41
+ super LocalizedString.new(status)
42
+ @stage = stage
43
+ @substage = substage
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IsoBibItem
4
+ # ISO localized string.
5
+ class IsoLocalizedTitle
6
+ # @return [String]
7
+ attr_reader :title_intro
8
+
9
+ # @return [String]
10
+ attr_reader :title_main
11
+
12
+ # @return [String]
13
+ attr_reader :title_part
14
+
15
+ # @return [String] language code Iso639
16
+ attr_reader :language
17
+
18
+ # @return [String] script code Iso15924
19
+ attr_reader :script
20
+
21
+ # @param title_intro [String]
22
+ # @param title_main [String]
23
+ # @param title_part [String]
24
+ # @param language [String] language Iso639 code
25
+ # @param script [String] script Iso15924 code
26
+ def initialize(title_intro:, title_main:, title_part:, language:, script:)
27
+ @title_intro = title_intro
28
+ @title_main = title_main
29
+ @title_part = title_part
30
+ @language = language
31
+ @script = script
32
+ end
33
+
34
+ # @return [String]
35
+ def to_s
36
+ "#{@title_intro} -- #{@title_main} -- #{@title_part}"
37
+ end
38
+
39
+ def to_xml(builder)
40
+ builder.title(format: 'text/plain', language: language, script: script) do
41
+ builder.text to_s
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'iso_bib_item/organization'
4
+
5
+ module IsoBibItem
6
+ # ISO project group.
7
+ class IsoProjectGroup < Organization
8
+ # @return [IsoBibItem::IsoSubgroup]
9
+ attr_reader :technical_committee
10
+
11
+ # @return [IsoBibItem::soSubgroup]
12
+ attr_reader :subcommittee
13
+
14
+ # @return [IsoBibItem::soSubgroup]
15
+ attr_reader :workgroup
16
+
17
+ # @return [String]
18
+ attr_reader :secretariat
19
+
20
+ # @param name [String]
21
+ # @param url [String]
22
+ # @param technical_commite [Hash{name=>String, type=>String,
23
+ # number=>Integer}]
24
+ def initialize(name:, abbreviation: nil, url:, technical_committee:)
25
+ super name: name, abbreviation: abbreviation, url: url
26
+ @technical_committe = IsoSubgroup.new(technical_committee)
27
+ end
28
+ end
29
+
30
+ # ISO subgroup.
31
+ class IsoSubgroup
32
+ # @return [String]
33
+ attr_reader :type
34
+
35
+ # @return [Integer]
36
+ attr_reader :number
37
+
38
+ # @return [String]
39
+ attr_reader :name
40
+
41
+ # @param name [String]
42
+ # @param type [String]
43
+ # @param number [Integer]
44
+ def initialize(name:, type:, number:)
45
+ @name = name
46
+ @type = type
47
+ @number = number
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IsoBibItem
4
+ # Localized string.
5
+ class LocalizedString
6
+ # @return [Array<String>] language Iso639 code
7
+ attr_accessor :language
8
+
9
+ # @return [Array<String>] script Iso15924 code
10
+ attr_accessor :script
11
+
12
+ # @return [String]
13
+ attr_reader :content
14
+
15
+ # @param content [String]
16
+ # @param language [String] language code Iso639
17
+ # @param script [String] script code Iso15924
18
+ def initialize(content, language = nil, script = nil)
19
+ @language = []
20
+ @language << language if language
21
+ @script = []
22
+ @script << script if script
23
+ @content = content
24
+ end
25
+
26
+ # @return [String]
27
+ def to_s
28
+ content
29
+ end
30
+
31
+ def to_xml(builder)
32
+ builder.parent['language'] = language.join(',') if language.any?
33
+ builder.parent['script'] = script.join(',') if script.any?
34
+ builder.text content
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'iso_bib_item/contributor'
4
+
5
+ module IsoBibItem
6
+ # module OrgIdentifierType
7
+ # ORCID = 'orcid'
8
+ # URI = 'uri'
9
+ # end
10
+
11
+ # Organization identifier.
12
+ class OrgIdentifier
13
+ # @return [String]
14
+ attr_reader :type
15
+
16
+ # @return [String]
17
+ attr_reader :value
18
+
19
+ # @param type [String]
20
+ # @param value [String]
21
+ def initialize(type, value)
22
+ @type = type
23
+ @value = value
24
+ end
25
+
26
+ def to_xml(builder)
27
+ builder.identifier(value, type: type)
28
+ end
29
+ end
30
+
31
+ # Organization.
32
+ class Organization < Contributor
33
+ # @return [IsoBibItem::LocalizedString]
34
+ attr_reader :name
35
+
36
+ # @return [IsoBibItem::LocalizedString]
37
+ attr_reader :abbreviation
38
+
39
+ # @return [Array<IsoBibItem::OrgIdentifier>]
40
+ attr_reader :identifiers
41
+
42
+ # @param name [String]
43
+ # @param abbreviation [String]
44
+ # @param url [String]
45
+ def initialize(name:, abbreviation: nil, url: nil)
46
+ super(url)
47
+ @name = LocalizedString.new name
48
+ @abbreviation = LocalizedString.new abbreviation
49
+ @identifiers = []
50
+ end
51
+
52
+ # rubocop:disable Metrics/AbcSize
53
+ # @return [String]
54
+ def to_xml(builder)
55
+ builder.organization do
56
+ builder.name { |b| name.to_xml b }
57
+ builder.abbreviation { |a| abbreviation.to_xml a } if abbreviation
58
+ builder.uri uri.to_s if uri
59
+ identifiers.each { |identifier| identifier.to_xml builder }
60
+ super
61
+ end
62
+ end
63
+ # rubocop:enable Metrics/AbcSize
64
+ end
65
+ end
@@ -0,0 +1,66 @@
1
+ require 'iso_bib_item/contributor'
2
+
3
+ module IsoBibItem
4
+ # Person's full name
5
+ class FullName
6
+ # @return [Array<IsoBibItem::LocalizedString>]
7
+ attr_accessor :forenames
8
+
9
+ # @return [Array<IsoBibItem::LocalizedString]
10
+ attr_accessor :inials
11
+
12
+ # @return [IsoBibItem::LocalizedString]
13
+ attr_accessor :surname
14
+
15
+ # @return [Array<IsoBibItem::LocalizedString]
16
+ attr_accessor :additions
17
+
18
+ # @return [Array<IsoBibItem::LocalizedString]
19
+ attr_accessor :prefix
20
+
21
+ def initialize(surname)
22
+ @surname = surname
23
+ @forenames = []
24
+ @initials = []
25
+ @additions = []
26
+ @prefix = []
27
+ end
28
+ end
29
+
30
+ module PersonIdentifierType
31
+ ISNI = 'isni'.freeze
32
+ URI = 'uri'.freeze
33
+ end
34
+
35
+ # Person identifier.
36
+ class PersonIdentifier
37
+ # @return [PersonIdentifierType]
38
+ attr_accessor :type
39
+
40
+ # @return [String]
41
+ attr_accessor :value
42
+
43
+ def initialize(type, value)
44
+ @type = type
45
+ @value = value
46
+ end
47
+ end
48
+
49
+ # Person class.
50
+ class Person < Contributor
51
+ # @return [IsoBibItem::FullName]
52
+ attr_accessor :name
53
+
54
+ # @return [Array<IsoBibItem::Affilation>]
55
+ attr_accessor :affilation
56
+
57
+ # @return [Array<IsoBibItem::PersonIdentifier>]
58
+ attr_accessor :identifiers
59
+
60
+ def initialize
61
+ super
62
+ @affilation = []
63
+ @identifiers = []
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: false
2
+
3
+ module IsoBibItem
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iso-bib-item
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry-byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: isoics
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: nokogiri
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: 'IsoBibItem: Ruby ISOXMLDOC impementation.'
112
+ email:
113
+ - android.2net@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".rubocop.yml"
121
+ - ".travis.yml"
122
+ - Gemfile
123
+ - Gemfile.lock
124
+ - LICENSE.txt
125
+ - README.adoc
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - iso-bib-item.gemspec
130
+ - lib/iso_bib_item.rb
131
+ - lib/iso_bib_item/bibliographic_date.rb
132
+ - lib/iso_bib_item/bibliographic_item.rb
133
+ - lib/iso_bib_item/contribution_info.rb
134
+ - lib/iso_bib_item/contributor.rb
135
+ - lib/iso_bib_item/document_relation_collection.rb
136
+ - lib/iso_bib_item/document_status.rb
137
+ - lib/iso_bib_item/formatted_string.rb
138
+ - lib/iso_bib_item/iso_bibliographic_item.rb
139
+ - lib/iso_bib_item/iso_document_status.rb
140
+ - lib/iso_bib_item/iso_localized_title.rb
141
+ - lib/iso_bib_item/iso_project_group.rb
142
+ - lib/iso_bib_item/localized_string.rb
143
+ - lib/iso_bib_item/organization.rb
144
+ - lib/iso_bib_item/person.rb
145
+ - lib/iso_bib_item/version.rb
146
+ homepage: https://github.com/riboseinc/gdbib
147
+ licenses:
148
+ - MIT
149
+ metadata: {}
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubyforge_project:
166
+ rubygems_version: 2.6.12
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: 'IsoBibItem: Ruby ISOXMLDOC impementation.'
170
+ test_files: []