elibri_onix_generator 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -224,9 +224,11 @@ module Elibri
224
224
  tag(:PublishingDetail) do
225
225
  export_publisher_info!(product) #P.19
226
226
  export_publishing_status!(product) #PR.20
227
+ export_territorial_rights!(product)
227
228
  export_sale_restrictions!(product) if product.sale_restricted? #PR.21
228
229
  end
229
230
  remove_tag_if_empty!(:PublishingDetail)
231
+
230
232
  #P.23 - related products
231
233
  if product.facsimiles.present?
232
234
  export_related_products!(product)
@@ -329,46 +331,50 @@ module Elibri
329
331
  comment_dictionary "Format produktu", :ProductFormCode, :indent => 10, :kind => [:onix_product_form, :onix_epub_details]
330
332
  tag(:ProductForm, product.product_form_onix_code)
331
333
  end
332
-
333
- if product.product_form_detail_onix_codes.present?
334
- comment_dictionary "Dostępne formaty produktu", :ProductFormDetail, :indent => 10, :kind => :onix_epub_details
335
- product.product_form_detail_onix_codes.each do |onix_code|
336
- tag(:ProductFormDetail, onix_code)
337
- end
338
- end
339
334
  end
340
335
 
341
336
 
342
337
  # @hidden_tags RecordReference NotificationType ProductIdentifier TitleDetail PublishingDetail ProductComposition
343
338
  # @title Zabezpieczenia e-booków
344
339
  # <strong>&lt;EpubTechnicalProtection&gt;</strong> Określa typ zabezpieczenia stosowanego przy publikacji e-booka.<br/>
340
+ #
345
341
  # <strong>&lt;ProductFormDetail&gt;</strong> zawiera format w jakim rozprowadzany jest e-book.
346
342
  # Aktualnie może przyjąć wartości takie jak:
347
343
  # #{Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::ALL.map(&:name).to_sentence(:last_word_connector => ' lub ')}
348
- # <br/><br/>
349
- # Jeśli e-book posiada terminowe ograniczenie sprzedaży, <strong>&lt;EpubUsageType&gt;</strong> zawiera wartość <strong>07</strong>.
350
- # Ilość dni po których licencja wygasa znajduje się w tagu <strong>&lt;Quantity&gt;</strong> wewnątrz <strong>&lt;EpubUsageLimit&gt;</strong>
351
344
  def export_epub_details!(product)
352
- return unless product.kind_of_ebook?
353
- if product.epub_technical_protection
354
- comment_dictionary "Zabezpieczenie", :EpubTechnicalProtection, :indent => 10, :kind => :onix_epub_details
355
- tag(:EpubTechnicalProtection, product.epub_technical_protection_onix_code)
356
- end
357
-
358
- tag(:EpubUsageConstraint) do
359
- comment_dictionary "Ograniczenia", :EpubUsageType, :indent => 12, :kind => :onix_epub_details
360
- tag(:EpubUsageType, Elibri::ONIX::Dict::Release_3_0::EpubUsageType::TIME_LIMITED)
361
- if product.epub_sale_restricted_to.present?
362
- comment_dictionary "Obecność limitu", :EpubUsageStatus, :indent => 12, :kind => :onix_epub_details
363
- tag(:EpubUsageStatus, Elibri::ONIX::Dict::Release_3_0::EpubUsageStatus::LIMITED)
364
- tag(:EpubUsageLimit) do
365
- days_left = Date.parse(product.epub_sale_restricted_to.to_s) - Date.today
366
- tag(:Quantity, days_left)
367
- comment_dictionary "Jednostka limitu", :EpubUsageUnit, :indent => 12, :kind => :onix_epub_details
368
- tag(:EpubUsageUnit, Elibri::ONIX::Dict::Release_3_0::EpubUsageUnit::DAYS)
345
+ if product.product_form_detail_onix_codes.present? #lista 175
346
+ comment_dictionary "Dostępne formaty produktu", :ProductFormDetail, :indent => 10, :kind => :onix_epub_details
347
+ product.product_form_detail_onix_codes.each do |onix_code|
348
+ tag(:ProductFormDetail, onix_code)
349
+ end
350
+ end
351
+
352
+ if product.digital?
353
+ if product.epub_technical_protection
354
+ comment_dictionary "Zabezpieczenie", :EpubTechnicalProtection, :indent => 10, :kind => :onix_epub_details
355
+ tag(:EpubTechnicalProtection, product.epub_technical_protection_onix_code)
356
+ end
357
+
358
+ if product.epub_fragment_info?
359
+ tag(:EpubUsageConstraint) do
360
+ comment_dictionary "Rodzaj ograniczeniai - w tym przypadku zawsze dotyczy dostępności fragmentu książki",
361
+ :EpubUsageType, :indent => 12, :kind => :onix_epub_details
362
+ tag(:EpubUsageType, Elibri::ONIX::Dict::Release_3_0::EpubUsageType::PREVIEW)
363
+
364
+ comment_dictionary "Jaka jest decyzja wydawcy?", :EpubUsageStatus, :indent => 12, :kind => :onix_epub_details
365
+ tag(:EpubUsageStatus, product.epub_publication_preview_usage_status_onix_code)
366
+ if product.epub_publication_preview_usage_status_onix_code == Elibri::ONIX::Dict::Release_3_0::EpubUsageStatus::LIMITED
367
+ tag(:EpubUsageLimit) do
368
+ if product.epub_publication_preview_unit_onix_code == Elibri::ONIX::Dict::Release_3_0::EpubUsageUnit::PERCENTAGE
369
+ tag(:Quantity, product.epub_publication_preview_percentage_limit)
370
+ elsif product.epub_publication_preview_unit_onix_code == Elibri::ONIX::Dict::Release_3_0::EpubUsageUnit::CHARACTERS
371
+ tag(:Quantity, product.epub_publication_preview_characters_limit)
372
+ end
373
+ comment_dictionary "Jednostka limitu", :EpubUsageUnit, :indent => 12, :kind => :onix_epub_details
374
+ tag(:EpubUsageUnit, product.epub_publication_preview_unit_onix_code)
375
+ end
376
+ end
369
377
  end
370
- else
371
- tag(:EpubUsageStatus, Elibri::ONIX::Dict::Release_3_0::EpubUsageStatus::UNLIMITED)
372
378
  end
373
379
  end
374
380
  end
@@ -458,6 +464,21 @@ module Elibri
458
464
  end
459
465
  end
460
466
 
467
+ # @hidden_tags RecordReference NotificationType ProductIdentifier DescriptiveDetail
468
+ # @title Terytorialne ograniczenia sprzedaży
469
+ def export_territorial_rights!(product)
470
+ tag(:SalesRights) do
471
+ tag(:SalesRightsType, "01") #For sale with exclusive rights in the specified country/ies
472
+ tag(:Territory) do
473
+ if product.sale_restricted_to_poland?
474
+ tag(:CountriesIncluded, "PL")
475
+ else
476
+ tag(:RegionsIncluded, "WORLD")
477
+ end
478
+ end
479
+ end
480
+ end
481
+
461
482
 
462
483
  # @hidden_tags RecordReference NotificationType ProductIdentifier DescriptiveDetail
463
484
  # @title Ograniczenia sprzedaży
@@ -510,10 +531,10 @@ module Elibri
510
531
 
511
532
  # @hidden_tags RecordReference NotificationType ProductIdentifier DescriptiveDetail
512
533
  # @title Informacje o wydawcy
513
- # W rekordzie znajduje się oczywiście nazwa wydawnictwa. Wydawca może określić też imprint.
534
+ # W rekordzie znajduje się oczywiście nazwa wydawnictwa. Wydawca może określić też imprint oraz miasto, w którym została wydana ksiażka.
514
535
  # Z imprintem mamy do czynienia wtedy, gdy książki są wydawane pod różnymi markami, pula ISBN jest jednak wspólna.
515
536
  # Jeśli wydawnictwo uzupełnia nazwę imprintu, to powinna być ona traktowana jako nazwa wydawnictwa przy prezentacji
516
- # książki klientowi końcowemu.
537
+ # książki klientowi końcowemu.
517
538
  def export_publisher_info!(product)
518
539
  if product.imprint
519
540
  tag(:Imprint) do
@@ -534,6 +555,10 @@ module Elibri
534
555
  tag(:PublisherName, product.publisher_name)
535
556
  end
536
557
  end
558
+
559
+ if product.city_of_publication.present?
560
+ tag(:CityOfPublication, product.city_of_publication)
561
+ end
537
562
  end
538
563
 
539
564
 
@@ -983,6 +1008,13 @@ module Elibri
983
1008
  tag("elibri:Vat", product.vat) if product.vat.present?
984
1009
  tag("elibri:PKWiU", product.pkwiu) if product.pkwiu.present?
985
1010
  tag("elibri:preview_exists", product.preview_exists?.to_s)
1011
+ if product.digital?
1012
+ if product.epub_sale_not_restricted? || product.epub_sale_restricted_to.nil?
1013
+ tag("elibri:SaleNotRestricted")
1014
+ else
1015
+ tag("elibri:SaleRestrictedTo", product.epub_sale_restricted_to.strftime("%Y%m%d"))
1016
+ end
1017
+ end
986
1018
  end
987
1019
  end
988
1020
 
@@ -1,3 +1,3 @@
1
1
  module ElibriOnixGenerator
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_onix_generator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Marcin Urba\xC5\x84ski"
@@ -16,7 +16,8 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-06-11 00:00:00 Z
19
+ date: 2012-09-04 00:00:00 +02:00
20
+ default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: builder
@@ -51,6 +52,7 @@ files:
51
52
  - lib/elibri_onix_generator.rb
52
53
  - lib/elibri_onix_generator/version.rb
53
54
  - lib/xml_tags.yml
55
+ has_rdoc: true
54
56
  homepage: ""
55
57
  licenses: []
56
58
 
@@ -80,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
82
  requirements: []
81
83
 
82
84
  rubyforge_project: elibri_onix_generator
83
- rubygems_version: 1.8.19
85
+ rubygems_version: 1.5.2
84
86
  signing_key:
85
87
  specification_version: 3
86
88
  summary: XML Generator used by Elibri gems