elibri_onix 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elibri_onix (0.2.2)
4
+ elibri_onix (0.2.3)
5
5
  activesupport (>= 2.3.5)
6
6
  elibri_onix_dict (>= 0.0.5)
7
7
  i18n
@@ -16,6 +16,8 @@ GEM
16
16
  coderay (1.0.6)
17
17
  elibri_onix_dict (0.0.22)
18
18
  i18n (0.6.1)
19
+ json (1.7.6)
20
+ json (1.7.6-java)
19
21
  metaclass (0.0.1)
20
22
  method_source (0.7.1)
21
23
  minitest (3.0.1)
@@ -23,6 +25,7 @@ GEM
23
25
  metaclass (~> 0.0.1)
24
26
  multi_json (1.5.0)
25
27
  nokogiri (1.5.6)
28
+ nokogiri (1.5.6-java)
26
29
  pry (0.9.9.6)
27
30
  coderay (~> 1.0.5)
28
31
  method_source (~> 0.7.1)
@@ -33,6 +36,8 @@ GEM
33
36
  slop (>= 2.4.4, < 3)
34
37
  spoon (~> 0.0)
35
38
  rake (0.9.2.2)
39
+ rdoc (3.12)
40
+ json (~> 1.4)
36
41
  slop (2.4.4)
37
42
  spoon (0.0.1)
38
43
 
@@ -47,3 +52,4 @@ DEPENDENCIES
47
52
  mocha
48
53
  pry
49
54
  rake
55
+ rdoc
data/README.rdoc CHANGED
@@ -17,53 +17,7 @@ Elibri::ONIX::Release_3_0::ONIXMessage.new(xml_data)
17
17
 
18
18
  xml_data should be string containing ONIX xml you want to parse.
19
19
 
20
- Creating a new ONIXMessage object will also create embedded objects inside - representing structure of xml file.
21
- ONIXMessage -> many Product(s)
22
- Product -> many ProductIdentifier(s)
23
- Product -> many RelatedProduct(s)
24
- RelatedProduct -> many ProductIdentifier(s)
25
- Product -> many SupplyDetail(s)
26
- SupplyDetail -> one Supplier
27
- SupplyDetail -> one Price
28
- SupplyDetail -> one StockQuantityCoded
29
- Product -> many Measure(s)
30
- Product -> many TitleDetail(s)
31
- TitleDetail -> many TitleElement(s)
32
- Product -> many Collection(s)
33
- Collection -> many TitleElement(s)
34
- Collection -> one TitleDetail
35
- Product -> many Contributor(s)
36
- Product -> many Language(s)
37
- Product -> many Extent(s)
38
- Product -> many Subject(s)
39
- Product -> many AudienceRange(s)
40
- Product -> many TextContent(s)
41
- Product -> many SupportingResource(s)
42
- Product -> one Imprint
43
- Product -> one Publisher
44
- Product -> one PublishingDate
45
- Product -> many SalesRestriction(s)
46
- ONIXMessage -> one Header
47
- Header -> one Sender
48
-
49
-
50
- However if you have only fragment of xml that you want to parse - for example Contributor, you may parse only this fragment invoking constructor of appropriate class, providing xml as an argument, for example:
51
-
52
- Elibri::ONIX::Release_3_0::Contributor.new(xml_data)
53
-
54
- Each object provide method to_xml which will return xml used to construct it.
55
-
56
- Object contains attributes, which are represented by instance variables. You can see list of attributes in FIELDS file.
57
-
58
- == Contributing to elibri_onix
59
-
60
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
61
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
62
- * Fork the project
63
- * Start a feature/bugfix branch
64
- * Commit and push until you are happy with your contribution
65
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
66
- * 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.
20
+ See also description of Product
67
21
 
68
22
  == Copyright
69
23
 
data/Rakefile CHANGED
@@ -24,10 +24,11 @@ task :default => :test
24
24
  require 'rdoc/task'
25
25
  Rake::RDocTask.new do |rdoc|
26
26
  version = Elibri::ONIX::VERSION
27
-
28
- rdoc.rdoc_dir = 'rdoc'
27
+ rdoc.main = "README.rdoc"
28
+ rdoc.rdoc_dir = 'doc'
29
29
  rdoc.title = "elibri_onix #{version}"
30
- rdoc.rdoc_files.include('README*')
31
- rdoc.rdoc_files.include('FIELDS*')
30
+ rdoc.options << "--hyperlink-all"
31
+ rdoc.rdoc_files.include('README.rdoc')
32
+ rdoc.rdoc_files.include('FIELDS.rdoc')
32
33
  rdoc.rdoc_files.include('lib/**/*.rb')
33
34
  end
data/elibri_onix.gemspec CHANGED
@@ -33,7 +33,8 @@ Gem::Specification.new do |gem|
33
33
  gem.add_development_dependency "minitest", ">= 0"
34
34
  gem.add_development_dependency "bundler", ">= 1.0.0"
35
35
  gem.add_development_dependency "rake"
36
- # gem.add_development_dependency "ruby-debug"
36
+ gem.add_development_dependency "rdoc"
37
+ #gem.add_development_dependency "ruby-debug"
37
38
  #gem.add_development_dependency "rcov", ">= 0"
38
39
 
39
40
  end
@@ -16,20 +16,59 @@ module Elibri
16
16
  #or by the name given on the title page and by an authority-controlled name.
17
17
  #In addition, more than one representation of the same name may be sent.
18
18
 
19
+ #:nodoc:
19
20
  ATTRIBUTES =
20
21
  [
21
22
  :number, :role, :person_name, :from_language, :titles_before_names, :names_before_key, :prefix_to_key,
22
23
  :key_names, :names_after_key, :biographical_note, :unnamed_persons, :role_name
23
24
  ]
24
25
 
26
+ #:nodoc:
25
27
  RELATIONS =
26
28
  [
27
29
  :inspect_include_fields
28
30
  ]
29
31
 
30
- attr_accessor :number, :role, :person_name, :from_language, :titles_before_names, :names_before_key, :prefix_to_key,
31
- :key_names, :names_after_key, :biographical_note, :unnamed_persons, :to_xml
32
+ #:nodoc:
33
+ attr_reader :number
34
+
35
+ #:doc:
36
+ #kod ONIX dla roli - np. 'A01' - autor, pełna lista pod adresem
37
+ #https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
38
+ attr_reader :role
39
+
40
+ #pełne imię i nazwisko - to pole jest zawsze uzupełnione
41
+ attr_reader :person_name
42
+
43
+ #w przypadku tłumacza kod języka oryginału, lista języków dostępna pod adresem
44
+ #https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageCode.yml
45
+ attr_reader :from_language
46
+
47
+ #tytuł naukowy, np. prof.
48
+ attr_reader :titles_before_names
49
+
50
+ #imię lub imiona
51
+ attr_reader :names_before_key
52
+
53
+ #prefix przed nazwiskiem, np. von, van
54
+ attr_reader :prefix_to_key
55
+
56
+ #nazwisko lub nazwiska
57
+ attr_reader :key_names
58
+
59
+ #dodatkowe oznaczenia, np. OHP (zakon)
60
+ attr_reader :names_after_key
61
+
62
+ #biografia
63
+ attr_reader :biographical_note
64
+
65
+ #:nodoc:
66
+ attr_reader :unnamed_persons
67
+
68
+ #reprezentacja danych w xml-u
69
+ attr_reader :to_xml
32
70
 
71
+
33
72
  def initialize(data)
34
73
  @to_xml = data.to_s
35
74
  @number = data.at_xpath('xmlns:SequenceNumber').try(:text).try(:to_i)
@@ -4,20 +4,24 @@ module Elibri
4
4
  module ONIX
5
5
  module Release_3_0
6
6
 
7
+ #Class representing ONIX header
7
8
  class Header
8
9
 
9
- #from ONIX documentation:
10
- #A group of data elements which together constitute a message header.
11
- #Mandatory in any ONIX for Books message, and non-repeating.
12
- #In ONIX 3.0, a number of redundant elements have been deleted, and the Sender and Addressee structures and
13
- #the name and format of the <SentDateTime> element have been made consistent with other current ONIX formats.
14
-
15
- attr_accessor :sent_date_time, :sender, :to_xml
16
-
10
+ #date, at which message was sent
11
+ attr_accessor :sent_date_time
12
+
13
+ #sender of the message - Elibri::ONIX::Release_3_0::Sender
14
+ attr_accessor :sender
15
+
16
+ #xml representation of message header
17
+ attr_accessor :to_xml
18
+
19
+ #:nodoc:
17
20
  ATTRIBUTES = [
18
21
  :sent_date_time, :sender
19
22
  ]
20
23
 
24
+ #:nodoc:
21
25
  RELATIONS = []
22
26
 
23
27
  def initialize(data)
@@ -9,16 +9,28 @@ module Elibri
9
9
  #from ONIX documentation:
10
10
  #An optional and repeatable group of data elements which together represent a language, and specify its role and,
11
11
  #where required, whether it is a country variant.
12
-
12
+
13
+ #:nodoc:
13
14
  ATTRIBUTES = [
14
15
  :role, :code, :role_name, :language
15
16
  ]
16
17
 
18
+ #:nodoc:
17
19
  RELATIONS = [
18
20
  :inspect_include_fields
19
21
  ]
20
-
21
- attr_accessor :role, :code, :to_xml
22
+
23
+ #:doc:
24
+ #kod onix roli, np. '01'
25
+ #pełna lista ról: https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageRole.yml
26
+ attr_reader :role
27
+
28
+ #kod języka, np. 'pol'
29
+ #pełna lista kodów: https://github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageCode.yml
30
+ attr_reader :code
31
+
32
+ #reprezentacja w xml
33
+ attr_reader :to_xml
22
34
 
23
35
  def initialize(data)
24
36
  @to_xml = data.to_s
@@ -26,10 +38,12 @@ module Elibri
26
38
  @code = data.at_xpath('xmlns:LanguageCode').try(:text)
27
39
  end
28
40
 
41
+ #określenie roli jako string, np. language_of_text
29
42
  def role_name
30
43
  Elibri::ONIX::Dict::Release_3_0::LanguageRole.find_by_onix_code(@role).const_name.downcase
31
44
  end
32
45
 
46
+ #język, np. 'polski'
33
47
  def language
34
48
  Elibri::ONIX::Dict::Release_3_0::LanguageCode.find_by_onix_code(@code).name(:pl).downcase
35
49
  end
@@ -1,16 +1,12 @@
1
1
 
2
-
3
2
  module Elibri
4
3
  module ONIX
5
4
  module Release_3_0
6
-
5
+
6
+ #klasa abstahuje parsowanie wymiarów książki.
7
7
  class Measure
8
8
 
9
- include HashId
10
-
11
- #from ONIX documentation:
12
- #An optional and repeatable group of data elements which together identify a measurement and the units in which
13
- #it is expressed; used to specify the overall dimensions of a physical product including its packaging (if any).
9
+ include HashId
14
10
 
15
11
  ATTRIBUTES = [
16
12
  :type, :measurement, :unit, :type_name
@@ -3,17 +3,31 @@ module Elibri
3
3
  module ONIX
4
4
  module Release_3_0
5
5
 
6
- class ONIXMessage
7
- attr_accessor :release, :elibri_dialect, :products, :header, :to_xml
8
-
9
- #class representing whole ONIX response from eLibri server
6
+ #class representing whole ONIX response from eLibri server
7
+ class ONIXMessage
8
+ #list of all products returned in this mnessage
9
+ attr_accessor :products
10
+
11
+ #xml representation of this message
12
+ attr_accessor :to_xml
13
+
14
+ #ONIX version number
15
+ attr_accessor :release
16
+
17
+ #:nodoc:
18
+ attr_accessor :elibri_dialect
19
+
20
+ #returned message header - Elibri::ONIX::Release_3_0::Header
21
+ attr_accessor :header
10
22
 
11
23
  include HashId
12
-
24
+
25
+ #:nodoc:
13
26
  ATTRIBUTES = [
14
27
  :release, :elibri_dialect, :header
15
28
  ]
16
29
 
30
+ #:nodoc:
17
31
  RELATIONS = [
18
32
  :products
19
33
  ]