elibri_onix 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/elibri_onix.gemspec +104 -0
- data/lib/elibri_onix.rb +16 -0
- data/lib/elibri_onix/onix_3_0/audience_range.rb +20 -0
- data/lib/elibri_onix/onix_3_0/collection.rb +23 -0
- data/lib/elibri_onix/onix_3_0/contributor.rb +27 -0
- data/lib/elibri_onix/onix_3_0/extent.rb +18 -0
- data/lib/elibri_onix/onix_3_0/header.rb +18 -0
- data/lib/elibri_onix/onix_3_0/imprint.rb +18 -0
- data/lib/elibri_onix/onix_3_0/language.rb +19 -0
- data/lib/elibri_onix/onix_3_0/measure.rb +18 -0
- data/lib/elibri_onix/onix_3_0/onix_message.rb +18 -0
- data/lib/elibri_onix/onix_3_0/price.rb +40 -0
- data/lib/elibri_onix/onix_3_0/product.rb +144 -0
- data/lib/elibri_onix/onix_3_0/product_identifier.rb +17 -0
- data/lib/elibri_onix/onix_3_0/publisher.rb +20 -0
- data/lib/elibri_onix/onix_3_0/publishing_date.rb +21 -0
- data/lib/elibri_onix/onix_3_0/related_product.rb +35 -0
- data/lib/elibri_onix/onix_3_0/sales_restriction.rb +21 -0
- data/lib/elibri_onix/onix_3_0/sender.rb +17 -0
- data/lib/elibri_onix/onix_3_0/stock_quantity_coded.rb +21 -0
- data/lib/elibri_onix/onix_3_0/subject.rb +28 -0
- data/lib/elibri_onix/onix_3_0/supplier.rb +29 -0
- data/lib/elibri_onix/onix_3_0/supplier_identifier.rb +22 -0
- data/lib/elibri_onix/onix_3_0/supply_detail.rb +34 -0
- data/lib/elibri_onix/onix_3_0/supporting_resource.rb +25 -0
- data/lib/elibri_onix/onix_3_0/text_content.rb +21 -0
- data/lib/elibri_onix/onix_3_0/title_detail.rb +42 -0
- data/lib/elibri_onix/onix_3_0/title_element.rb +28 -0
- data/lib/elibri_onix/releases.rb +10 -0
- data/lib/elibri_onix/version.rb +13 -0
- data/test/elibri_onix_release_3_0_onix_message_test.rb +178 -0
- data/test/elibri_onix_test.rb +10 -0
- data/test/fixtures/all_possible_tags.xml +442 -0
- data/test/helper.rb +20 -0
- metadata +241 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'roxml', '>= 3.1.5'
|
4
|
+
gem 'i18n'
|
5
|
+
gem 'activesupport', '>= 3.1.0'
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "pry"
|
9
|
+
gem "mocha"
|
10
|
+
gem "minitest", ">= 0"
|
11
|
+
gem "bundler", "~> 1.0.0"
|
12
|
+
gem "jeweler", "~> 1.6.2"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.1.0)
|
5
|
+
multi_json (~> 1.0)
|
6
|
+
coderay (0.9.8)
|
7
|
+
git (1.2.5)
|
8
|
+
i18n (0.6.0)
|
9
|
+
jeweler (1.6.2)
|
10
|
+
bundler (~> 1.0)
|
11
|
+
git (>= 1.2.5)
|
12
|
+
rake
|
13
|
+
metaclass (0.0.1)
|
14
|
+
method_source (0.6.5)
|
15
|
+
ruby_parser (>= 2.0.5)
|
16
|
+
minitest (2.2.2)
|
17
|
+
mocha (0.10.0)
|
18
|
+
metaclass (~> 0.0.1)
|
19
|
+
multi_json (1.0.3)
|
20
|
+
nokogiri (1.5.0)
|
21
|
+
pry (0.9.6)
|
22
|
+
coderay (>= 0.9.8)
|
23
|
+
method_source (>= 0.6.5)
|
24
|
+
ruby_parser (>= 2.0.5)
|
25
|
+
slop (~> 2.1.0)
|
26
|
+
rake (0.8.7)
|
27
|
+
rcov (0.9.9)
|
28
|
+
roxml (3.1.6)
|
29
|
+
activesupport (>= 2.3.0)
|
30
|
+
nokogiri (>= 1.3.3)
|
31
|
+
ruby_parser (2.3.0)
|
32
|
+
sexp_processor (~> 3.0)
|
33
|
+
sexp_processor (3.0.6)
|
34
|
+
slop (2.1.0)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
activesupport (>= 3.1.0)
|
41
|
+
bundler (~> 1.0.0)
|
42
|
+
i18n
|
43
|
+
jeweler (~> 1.6.2)
|
44
|
+
minitest
|
45
|
+
mocha
|
46
|
+
pry
|
47
|
+
rcov
|
48
|
+
roxml (>= 3.1.5)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Marcin Urbanski
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= elibri_onix
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to elibri_onix
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Marcin Urbanski. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
require './lib/elibri_onix/version.rb'
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
18
|
+
gem.name = "elibri_onix"
|
19
|
+
gem.version = Elibri::ONIX::Version::STRING
|
20
|
+
gem.homepage = "http://github.com/elibri/elibri_onix"
|
21
|
+
gem.license = "MIT"
|
22
|
+
gem.summary = %Q{EDItEUR ONIX format subset implementation used in Elibri publication system}
|
23
|
+
gem.description = %Q{EDItEUR ONIX format subset implementation used in Elibri publication system}
|
24
|
+
gem.email = "marcin@urbanski.vdl.pl"
|
25
|
+
gem.authors = ["Marcin Urbanski"]
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
Rake::TestTask.new(:test) do |test|
|
32
|
+
test.libs << 'lib' << 'test'
|
33
|
+
test.pattern = 'test/**/*_test.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'rcov/rcovtask'
|
38
|
+
Rcov::RcovTask.new do |test|
|
39
|
+
test.libs << 'test'
|
40
|
+
test.pattern = 'test/**/*_test.rb'
|
41
|
+
test.verbose = true
|
42
|
+
test.rcov_opts << '--exclude "gems/*"'
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => :test
|
46
|
+
|
47
|
+
require 'rake/rdoctask'
|
48
|
+
Rake::RDocTask.new do |rdoc|
|
49
|
+
version = Elibri::ONIX::Version::STRING
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "elibri_onix #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/elibri_onix.gemspec
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{elibri_onix}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marcin Urbanski"]
|
12
|
+
s.date = %q{2011-10-06}
|
13
|
+
s.description = %q{EDItEUR ONIX format subset implementation used in Elibri publication system}
|
14
|
+
s.email = %q{marcin@urbanski.vdl.pl}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"elibri_onix.gemspec",
|
28
|
+
"lib/elibri_onix.rb",
|
29
|
+
"lib/elibri_onix/onix_3_0/audience_range.rb",
|
30
|
+
"lib/elibri_onix/onix_3_0/collection.rb",
|
31
|
+
"lib/elibri_onix/onix_3_0/contributor.rb",
|
32
|
+
"lib/elibri_onix/onix_3_0/extent.rb",
|
33
|
+
"lib/elibri_onix/onix_3_0/header.rb",
|
34
|
+
"lib/elibri_onix/onix_3_0/imprint.rb",
|
35
|
+
"lib/elibri_onix/onix_3_0/language.rb",
|
36
|
+
"lib/elibri_onix/onix_3_0/measure.rb",
|
37
|
+
"lib/elibri_onix/onix_3_0/onix_message.rb",
|
38
|
+
"lib/elibri_onix/onix_3_0/price.rb",
|
39
|
+
"lib/elibri_onix/onix_3_0/product.rb",
|
40
|
+
"lib/elibri_onix/onix_3_0/product_identifier.rb",
|
41
|
+
"lib/elibri_onix/onix_3_0/publisher.rb",
|
42
|
+
"lib/elibri_onix/onix_3_0/publishing_date.rb",
|
43
|
+
"lib/elibri_onix/onix_3_0/related_product.rb",
|
44
|
+
"lib/elibri_onix/onix_3_0/sales_restriction.rb",
|
45
|
+
"lib/elibri_onix/onix_3_0/sender.rb",
|
46
|
+
"lib/elibri_onix/onix_3_0/stock_quantity_coded.rb",
|
47
|
+
"lib/elibri_onix/onix_3_0/subject.rb",
|
48
|
+
"lib/elibri_onix/onix_3_0/supplier.rb",
|
49
|
+
"lib/elibri_onix/onix_3_0/supplier_identifier.rb",
|
50
|
+
"lib/elibri_onix/onix_3_0/supply_detail.rb",
|
51
|
+
"lib/elibri_onix/onix_3_0/supporting_resource.rb",
|
52
|
+
"lib/elibri_onix/onix_3_0/text_content.rb",
|
53
|
+
"lib/elibri_onix/onix_3_0/title_detail.rb",
|
54
|
+
"lib/elibri_onix/onix_3_0/title_element.rb",
|
55
|
+
"lib/elibri_onix/releases.rb",
|
56
|
+
"lib/elibri_onix/version.rb",
|
57
|
+
"test/elibri_onix_release_3_0_onix_message_test.rb",
|
58
|
+
"test/elibri_onix_test.rb",
|
59
|
+
"test/fixtures/all_possible_tags.xml",
|
60
|
+
"test/helper.rb"
|
61
|
+
]
|
62
|
+
s.homepage = %q{http://github.com/elibri/elibri_onix}
|
63
|
+
s.licenses = ["MIT"]
|
64
|
+
s.require_paths = ["lib"]
|
65
|
+
s.rubygems_version = %q{1.6.2}
|
66
|
+
s.summary = %q{EDItEUR ONIX format subset implementation used in Elibri publication system}
|
67
|
+
|
68
|
+
if s.respond_to? :specification_version then
|
69
|
+
s.specification_version = 3
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
72
|
+
s.add_runtime_dependency(%q<roxml>, [">= 3.1.5"])
|
73
|
+
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
74
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.1.0"])
|
75
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
76
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
77
|
+
s.add_development_dependency(%q<minitest>, [">= 0"])
|
78
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
79
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
80
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
81
|
+
else
|
82
|
+
s.add_dependency(%q<roxml>, [">= 3.1.5"])
|
83
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
84
|
+
s.add_dependency(%q<activesupport>, [">= 3.1.0"])
|
85
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
86
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
87
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
88
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
89
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
90
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
91
|
+
end
|
92
|
+
else
|
93
|
+
s.add_dependency(%q<roxml>, [">= 3.1.5"])
|
94
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
95
|
+
s.add_dependency(%q<activesupport>, [">= 3.1.0"])
|
96
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
97
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
98
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
99
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
100
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
101
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
data/lib/elibri_onix.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
require 'active_support/core_ext/object/with_options'
|
3
|
+
require 'bigdecimal'
|
4
|
+
require 'roxml'
|
5
|
+
require 'elibri_onix/version'
|
6
|
+
require 'elibri_onix/releases'
|
7
|
+
|
8
|
+
$KCODE = "UTF-8"
|
9
|
+
|
10
|
+
|
11
|
+
module Elibri
|
12
|
+
module ONIX
|
13
|
+
module Release_3_0; end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module Elibri
|
3
|
+
module ONIX
|
4
|
+
module Release_3_0
|
5
|
+
|
6
|
+
class AudienceRange
|
7
|
+
include ROXML
|
8
|
+
|
9
|
+
xml_name 'AudienceRange'
|
10
|
+
|
11
|
+
xml_accessor :qualifier, :from => 'AudienceRangeQualifier', :as => Fixnum
|
12
|
+
xml_accessor :precision, :from => 'AudienceRangePrecision', :as => Fixnum
|
13
|
+
xml_accessor :value, :from => 'AudienceRangeValue'
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
module Elibri
|
3
|
+
module ONIX
|
4
|
+
module Release_3_0
|
5
|
+
|
6
|
+
class Collection
|
7
|
+
include ROXML
|
8
|
+
|
9
|
+
xml_name 'Collection'
|
10
|
+
|
11
|
+
xml_accessor :type, :from => 'CollectionType', :as => Fixnum
|
12
|
+
xml_accessor :elements, :as => [TitleElement]
|
13
|
+
xml_accessor :title_detail, :as => TitleDetail
|
14
|
+
|
15
|
+
def full_title
|
16
|
+
title_detail.try(:full_title)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
module Elibri
|
3
|
+
module ONIX
|
4
|
+
module Release_3_0
|
5
|
+
|
6
|
+
class Contributor
|
7
|
+
include ROXML
|
8
|
+
|
9
|
+
xml_name 'Contributor'
|
10
|
+
|
11
|
+
xml_accessor :number, :from => 'SequenceNumber', :as => Fixnum
|
12
|
+
xml_accessor :role, :from => 'ContributorRole'
|
13
|
+
xml_accessor :person_name, :from => 'PersonName'
|
14
|
+
xml_accessor :from_language, :from => 'FromLanguage'
|
15
|
+
xml_accessor :titles_before_names, :from => 'TitlesBeforeNames'
|
16
|
+
xml_accessor :names_before_key, :from => 'NamesBeforeKey'
|
17
|
+
xml_accessor :prefix_to_key, :from => 'PrefixToKey'
|
18
|
+
xml_accessor :key_names, :from => 'KeyNames'
|
19
|
+
xml_accessor :names_after_key, :from => 'NamesAfterKey'
|
20
|
+
xml_accessor :biographical_note, :from => 'BiographicalNote'
|
21
|
+
|
22
|
+
xml_accessor :unnamed_persons, :from => 'UnnamedPersons'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Elibri
|
4
|
+
module ONIX
|
5
|
+
module Release_3_0
|
6
|
+
|
7
|
+
class Extent
|
8
|
+
include ROXML
|
9
|
+
|
10
|
+
xml_name 'Extent'
|
11
|
+
xml_accessor :type, :from => 'ExtentType', :as => Fixnum
|
12
|
+
xml_accessor :value, :from => 'ExtentValue', :as => BigDecimal
|
13
|
+
xml_accessor :unit, :from => 'ExtentUnit', :as => Fixnum
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Elibri
|
4
|
+
module ONIX
|
5
|
+
module Release_3_0
|
6
|
+
|
7
|
+
class Header
|
8
|
+
include ROXML
|
9
|
+
|
10
|
+
xml_name 'Header'
|
11
|
+
xml_accessor :sent_date_time, :as => Date, :from => 'SentDateTime'
|
12
|
+
|
13
|
+
xml_accessor :sender, :as => Sender
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Elibri
|
4
|
+
module ONIX
|
5
|
+
module Release_3_0
|
6
|
+
|
7
|
+
class Language
|
8
|
+
include ROXML
|
9
|
+
|
10
|
+
xml_name 'Language'
|
11
|
+
|
12
|
+
xml_accessor :role, :from => 'LanguageRole', :as => Fixnum
|
13
|
+
xml_accessor :code, :from => 'LanguageCode'
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|