Class: Elibri::ONIX::Release_3_0::Product
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Product
- Includes:
- Inspector
- Defined in:
- lib/elibri_onix/onix_3_0/product.rb
Overview
Klasa reprezentująca produkt Niektóre pola mogą pozostać bez wartości - zależy to od formy produktu
Constant Summary collapse
- ATTRIBUTES =
:nodoc:
[ :height, :width, :thickness, :weight, :ean, :isbn13, :number_of_pages, :duration, :file_size, :publisher_name, :publisher_id, :imprint_name, :current_state, :reading_age_from, :reading_age_to, :table_of_contents, :description, :reviews, :excerpts, :series, :title, :subtitle, :collection_title, :collection_part, :full_title, :original_title, :trade_title, :parsed_publishing_date, :record_reference, :deletion_text, :cover_type, :cover_price, :vat, :pkwiu, :additional_info, :product_composition, :publisher, :product_form, :no_contributor, :edition_statement, :edition_type_onix_code, :number_of_illustrations, :publishing_status, :publishing_date, :premiere, :front_cover, :series_names, :city_of_publication, :preview_exists, :short_description, :sale_restricted_to_poland, :technical_protection_onix_code, :unlimited_licence, :hyphenated_isbn, :preorder_embargo_date, :additional_trade_information, :number_of_pieces, :players_number_from, :players_number_to, :playing_time_from, :playing_time_to ]
- RELATIONS =
:nodoc:
[ :contributors, #IMPORTANT :related_products, :languages, :measures, :supply_details, :measures, :title_details, :collections, :extents, :thema_subjects, :publisher_subjects, :audience_ranges, :text_contents, #IMPORTANT :supporting_resources, #for example: cover :sales_restrictions, :authors, :ghostwriters, :scenarists, :originators, :illustrators, :photographers, :author_of_prefaces, :drawers, :cover_designers, :inked_or_colored_bys, :editors, :revisors, :translators, :editor_in_chiefs, :read_bys ]
Instance Attribute Summary collapse
-
#additional_info ⇒ Object
readonly
AdditionalInfo.
-
#additional_trade_information ⇒ Object
readonly
dodatkowa informacja handlowa.
-
#audience_ranges ⇒ Object
readonly
Returns the value of attribute audience_ranges.
-
#city_of_publication ⇒ Object
readonly
miasto, w którym została wydana ksiażka.
-
#cn_code ⇒ Object
readonly
cn code.
-
#collection_part ⇒ Object
readonly
numer w cyklu.
-
#collection_title ⇒ Object
readonly
nazwa cyklu (częste przy komiksach, gdy seria jest częścią tytułu, np. Thorgal).
-
#collections ⇒ Object
readonly
Returns the value of attribute collections.
-
#contributors ⇒ Object
readonly
lista autorów, tłumaczy i innych, którzy mieli wkład w książkę, lista instancji Contributor.
-
#country_of_manufacture ⇒ Object
readonly
kraj produkcji.
-
#cover_price ⇒ Object
readonly
sugerowana cena detaliczna brutto produktu.
-
#cover_type ⇒ Object
readonly
typ okładki, np.
-
#current_state ⇒ Object
readonly
Status produktu - jedna z wartości: announced, :preorder, :published, :out_of_print, :deleted.
-
#deletion_text ⇒ Object
readonly
Returns the value of attribute deletion_text.
-
#description ⇒ Object
readonly
Opis produktu, instancja TextContent.
-
#digital_formats ⇒ Object
readonly
lista formatów, w jakich jest dostępny ebook (PDF, MOBI, EPUB).
-
#duration ⇒ Object
readonly
czas trwania nagrania w audiobooku, w minutach.
-
#ean ⇒ Object
readonly
ean, jeśli jest inny, niż isbn13.
-
#edition_statement ⇒ Object
readonly
informacja o numerze wydania.
-
#edition_type_onix_code ⇒ Object
readonly
informacja o type wydanie, kod onix.
-
#excerpt_infos ⇒ Object
readonly
informacje o fragmentach utworów (produkty cyfrowe).
-
#excerpts ⇒ Object
readonly
Returns the value of attribute excerpts.
-
#extents ⇒ Object
readonly
Returns the value of attribute extents.
-
#file_infos ⇒ Object
readonly
informacje o plikach master (produkty cyfrowe).
-
#file_size ⇒ Object
readonly
Returns the value of attribute file_size.
-
#full_title ⇒ Object
readonly
pełen tytuł.
-
#height ⇒ Object
readonly
:doc: wysokość w milimetrach.
-
#hyphenated_isbn ⇒ Object
readonly
isbn z kreskami.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#imprint ⇒ Object
readonly
Returns the value of attribute imprint.
-
#imprint_name ⇒ Object
readonly
Imprint, jeśli wydawnictwo używa imprintów.
-
#isbn13 ⇒ Object
readonly
isbn13 - bez kresek.
-
#languages ⇒ Object
readonly
lista języków, lista intancji Language.
-
#licence_limited_to ⇒ Object
readonly
data końca licencji, jeśli licencja nie jest bezterminowa, instancja Date.
-
#licence_limited_to_before_type_cast ⇒ Object
readonly
data końca licencji, jeśli licencja nie jest bezterminowa, w formacie YYYYMMDD.
-
#measures ⇒ Object
readonly
Returns the value of attribute measures.
-
#no_contributor ⇒ Object
:nodoc:.
-
#notification_type ⇒ Object
readonly
Returns the value of attribute notification_type.
-
#number_of_illustrations ⇒ Object
readonly
liczba ilustracji.
-
#number_of_pages ⇒ Object
readonly
ilość stron w książce drukowanej.
-
#number_of_pieces ⇒ Object
readonly
ilość elementów (puzzle, gry planszowe).
-
#original_title ⇒ Object
readonly
tytuł oryginału.
-
#pdw_exclusiveness ⇒ Object
readonly
PDWExclusiveness.
-
#pkwiu ⇒ Object
readonly
PKWiU.
-
#players_number_from ⇒ Object
readonly
min.
-
#players_number_to ⇒ Object
readonly
max.
-
#playing_time_from ⇒ Object
readonly
min.
-
#playing_time_to ⇒ Object
readonly
max.
-
#preorder_embargo_date ⇒ Object
readonly
Returns the value of attribute preorder_embargo_date.
-
#preview_exists ⇒ Object
:nodoc:.
-
#product_composition ⇒ Object
readonly
Returns the value of attribute product_composition.
-
#product_form ⇒ Object
readonly
kod ONIX typu produktu, np.
-
#product_form_name ⇒ Object
readonly
nazwa typu produktu, małe litery, np.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
-
#publisher_id ⇒ Object
readonly
ID wydawnictwa w systemie elibri.
-
#publisher_name ⇒ Object
readonly
nazwa wydawnictwa.
-
#publisher_subjects ⇒ Object
readonly
Returns the value of attribute publisher_subjects.
-
#publishing_date ⇒ Object
readonly
Returns the value of attribute publishing_date.
-
#publishing_status ⇒ Object
readonly
Returns the value of attribute publishing_status.
-
#reading_age_from ⇒ Object
readonly
Wiek czytelnika - od.
-
#reading_age_to ⇒ Object
readonly
Wiek czytelnika - do.
-
#record_reference ⇒ Object
readonly
record reference - wewnętrzny identyfikator rekordu, niezmienny i unikatowy.
-
#related_products ⇒ Object
readonly
Returns the value of attribute related_products.
-
#reviews ⇒ Object
readonly
Returns the value of attribute reviews.
-
#sale_restricted_to_poland ⇒ Object
:nodoc:.
-
#sales_restrictions ⇒ Object
readonly
Returns the value of attribute sales_restrictions.
-
#series ⇒ Object
readonly
lista serii, w postaci [nazwa serii, numer w serii].
-
#short_description ⇒ Object
readonly
krótki opis, jeśli wydawca takowy zamieści, instancja TextContent.
-
#subtitle ⇒ Object
readonly
podtytuł.
-
#supply_details ⇒ Object
readonly
Returns the value of attribute supply_details.
-
#supporting_resources ⇒ Object
readonly
Returns the value of attribute supporting_resources.
-
#table_of_contents ⇒ Object
readonly
Spis treści - jeśli wydawca takowy umieścił, instancja TextContent.
-
#technical_protection ⇒ Object
readonly
sposób zabezpieczania pliki (DRM, WATERMARK) - pliki dostępne w API transakcyjnym zawsze będą chronione watermarkiem.
-
#technical_protection_onix_code ⇒ Object
readonly
Returns the value of attribute technical_protection_onix_code.
-
#text_contents ⇒ Object
readonly
:nodoc:.
-
#thema_subjects ⇒ Object
readonly
Returns the value of attribute thema_subjects.
-
#thickness ⇒ Object
readonly
gruboś w milimetrach.
-
#title ⇒ Object
readonly
tytuł ksiażki.
-
#title_details ⇒ Object
readonly
Returns the value of attribute title_details.
-
#to_xml ⇒ Object
readonly
reprezentacja xml dla produktu.
-
#trade_title ⇒ Object
readonly
Returns the value of attribute trade_title.
-
#unlimited_licence ⇒ Object
:nodoc:.
-
#vat ⇒ Object
readonly
stawka VAT.
-
#weight ⇒ Object
readonly
waga w gramach.
-
#width ⇒ Object
readonly
szerokość w milimetrach.
Instance Method Summary collapse
- #authors ⇒ Object
- #collateral_details_setup(data) ⇒ Object
- #descriptive_details_setup(data) ⇒ Object
- #exclusive_distributor_onix_code ⇒ Object
-
#front_cover ⇒ Object
okładka ksiązki, instance SupportingResource.
-
#initialize(data) ⇒ Product
constructor
:doc:.
- #inspect_include_fields ⇒ Object
- #licence_information_setup(data) ⇒ Object
-
#no_contributor? ⇒ Boolean
flaga - true, jeśli produkt nie ma żadnego autora.
-
#parsed_publishing_date ⇒ Object
data premiery w postaci listy [rok, miesiąc, dzień], [rok, miesiąc], [rok], lub pustej listy - jeśli data premiery nie jest znana (data premiery może nie być znana w przypadku backlisty).
-
#premiere ⇒ Object
data premiery, jako instancja Date (tylko wtedy, gdy dokładna data jest znana).
-
#preview_exists? ⇒ Boolean
flaga, czy istnieje podgląd produktu.
- #product_form_features_setup(data) ⇒ Object
-
#proprietary_identifiers ⇒ Object
:nodoc:.
- #publishing_details_setup(data) ⇒ Object
- #related_products_record_references ⇒ Object
-
#sale_restricted_to_poland? ⇒ Boolean
flaga, czy sprzedaż książki jest ograniczona do Polski.
- #sales_restrictions? ⇒ Boolean
-
#series_names ⇒ Object
lista nazwa serii, do których należy produkt.
-
#unlimited_licence? ⇒ Boolean
flaga informująca, czy licencja jest bezterminowa.
-
#unnamed_persons? ⇒ Boolean
flaga, czy książka to praca zbiorowa?.
Methods included from Inspector
#attribute_for_inspect, #inspect
Constructor Details
#initialize(data) ⇒ Product
:doc:
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 248 def initialize(data) @to_xml = data.to_s #initialize variables that need to be array ##descriptive_details @text_contents = [] @supporting_resources = [] ##collateral_details @measures = [] @title_details = [] @collections = [] @contributors = [] @languages = [] @extents = [] @thema_subjects = [] @publisher_subjects = [] @audience_ranges = [] ##publishing_details @sales_restrictions = [] @excerpt_infos = [] @cover_type = nil #moving to parsing attributes @record_reference = data.at_css('RecordReference').try(:text) @notification_type = data.at_css('NotificationType').try(:text) @deletion_text = data.at_css('DeletionText').try(:text) if data.namespaces.values.any? { |uri| uri =~ /elibri/ } @cover_type = data.at_xpath('elibri:CoverType').try(:text) @pkwiu = data.at_xpath('elibri:PKWiU').try(:text) @hyphenated_isbn = data.at_xpath('elibri:HyphenatedISBN').try(:text) @pdw_exclusiveness = data.at_xpath('elibri:PDWExclusiveness').try(:text) @additional_info = data.at_xpath('elibri:AdditionalInfo').try(:text) end @identifiers = data.children.find_all { |node| node.name == 'ProductIdentifier' }.map { |ident_data| ProductIdentifier.new(ident_data) } begin @related_products = data.at_css('RelatedMaterial').css('RelatedProduct').map { || RelatedProduct.new() } rescue @related_products = [] end begin @supply_details = data.at_css('ProductSupply').css('SupplyDetail').map { |supply_data| SupplyDetail.new(supply_data) } rescue @supply_details = [] end if data.namespaces.values.any? { |uri| uri =~ /elibri/ } && (data.at_xpath('elibri:Vat') || data.at_xpath('elibri:CoverPrice')) @cover_price = BigDecimal(data.at_xpath('elibri:CoverPrice').try(:text)) if data.at_xpath('elibri:CoverPrice') @vat = data.at_xpath('elibri:Vat').try(:text).try(:to_i) else #00 - Supplier role - Unspecified price_sd = @supply_details.find { |sd| sd.supplier && ["00", Elibri::ONIX::Dict::Release_3_0::SupplierRole::PUB_TO_RET].include?(sd.supplier.role) } if price_sd && price_sd.price && price_sd.price && price_sd.price.type == Elibri::ONIX::Dict::Release_3_0::PriceTypeCode::RRP_WITH_TAX @vat = price_sd.price.tax_rate_percent.to_i @cover_price = price_sd.price.amount @additional_trade_information = price_sd.additional_trade_information end end descriptive_details_setup(data.at_css('DescriptiveDetail')) if data.at_css('DescriptiveDetail') collateral_details_setup(data.at_css('CollateralDetail')) if data.at_css('CollateralDetail') if data.namespaces.values.any? { |uri| uri =~ /elibri/ } && data.at_xpath('elibri:preview_exists') @preview_exists = (data.at_xpath('elibri:preview_exists').text == "true") else @preview_exists = @supporting_resources.find { |sr| sr.content_type_name == "widget" && sr.link =~ /p.elibri.com.pl/ }.present? end product_form_features_setup(data.css("ProductFormFeature")) publishing_details_setup(data.at_css('PublishingDetail')) if data.at_css('PublishingDetail') licence_information_setup(data) begin @excerpt_infos = data.at_xpath("elibri:excerpts").xpath("elibri:excerpt").map { |node| ExcerptInfo.new(node) } rescue demo = @supporting_resources.find { |sr| sr.content_type_name == "sample_content" } if demo @excerpt_infos = demo.data.css("ResourceVersion").map { |node| ExcerptInfo.new(node) } end end @file_infos = data.css("BodyResource").map { |node| FileInfo.new(node) } after_parse end |
Instance Attribute Details
#additional_info ⇒ Object (readonly)
AdditionalInfo
152 153 154 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 152 def additional_info @additional_info end |
#additional_trade_information ⇒ Object (readonly)
dodatkowa informacja handlowa
193 194 195 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 193 def additional_trade_information @additional_trade_information end |
#audience_ranges ⇒ Object (readonly)
Returns the value of attribute audience_ranges.
235 236 237 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 235 def audience_ranges @audience_ranges end |
#city_of_publication ⇒ Object (readonly)
miasto, w którym została wydana ksiażka
181 182 183 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 181 def city_of_publication @city_of_publication end |
#cn_code ⇒ Object (readonly)
cn code
211 212 213 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 211 def cn_code @cn_code end |
#collection_part ⇒ Object (readonly)
numer w cyklu
109 110 111 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 109 def collection_part @collection_part end |
#collection_title ⇒ Object (readonly)
nazwa cyklu (częste przy komiksach, gdy seria jest częścią tytułu, np. Thorgal)
106 107 108 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 106 def collection_title @collection_title end |
#collections ⇒ Object (readonly)
Returns the value of attribute collections.
231 232 233 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 231 def collections @collections end |
#contributors ⇒ Object (readonly)
lista autorów, tłumaczy i innych, którzy mieli wkład w książkę, lista instancji Contributor
163 164 165 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 163 def contributors @contributors end |
#country_of_manufacture ⇒ Object (readonly)
kraj produkcji
214 215 216 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 214 def country_of_manufacture @country_of_manufacture end |
#cover_price ⇒ Object (readonly)
sugerowana cena detaliczna brutto produktu
140 141 142 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 140 def cover_price @cover_price end |
#cover_type ⇒ Object (readonly)
typ okładki, np. ‘miękka ze skrzydełkami’
137 138 139 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 137 def cover_type @cover_type end |
#current_state ⇒ Object (readonly)
Status produktu - jedna z wartości: announced, :preorder, :published, :out_of_print, :deleted
82 83 84 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 82 def current_state @current_state end |
#deletion_text ⇒ Object (readonly)
Returns the value of attribute deletion_text.
224 225 226 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 224 def deletion_text @deletion_text end |
#description ⇒ Object (readonly)
Opis produktu, instancja TextContent
94 95 96 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 94 def description @description end |
#digital_formats ⇒ Object (readonly)
lista formatów, w jakich jest dostępny ebook (PDF, MOBI, EPUB)
127 128 129 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 127 def digital_formats @digital_formats end |
#duration ⇒ Object (readonly)
czas trwania nagrania w audiobooku, w minutach
69 70 71 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 69 def duration @duration end |
#ean ⇒ Object (readonly)
ean, jeśli jest inny, niż isbn13
60 61 62 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 60 def ean @ean end |
#edition_statement ⇒ Object (readonly)
informacja o numerze wydania
169 170 171 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 169 def edition_statement @edition_statement end |
#edition_type_onix_code ⇒ Object (readonly)
informacja o type wydanie, kod onix
172 173 174 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 172 def edition_type_onix_code @edition_type_onix_code end |
#excerpt_infos ⇒ Object (readonly)
informacje o fragmentach utworów (produkty cyfrowe)
184 185 186 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 184 def excerpt_infos @excerpt_infos end |
#excerpts ⇒ Object (readonly)
Returns the value of attribute excerpts.
221 222 223 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 221 def excerpts @excerpts end |
#extents ⇒ Object (readonly)
Returns the value of attribute extents.
232 233 234 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 232 def extents @extents end |
#file_infos ⇒ Object (readonly)
informacje o plikach master (produkty cyfrowe)
187 188 189 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 187 def file_infos @file_infos end |
#file_size ⇒ Object (readonly)
Returns the value of attribute file_size.
219 220 221 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 219 def file_size @file_size end |
#full_title ⇒ Object (readonly)
pełen tytuł
112 113 114 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 112 def full_title @full_title end |
#height ⇒ Object (readonly)
:doc: wysokość w milimetrach
48 49 50 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 48 def height @height end |
#hyphenated_isbn ⇒ Object (readonly)
isbn z kreskami
190 191 192 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 190 def hyphenated_isbn @hyphenated_isbn end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
237 238 239 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 237 def identifiers @identifiers end |
#imprint ⇒ Object (readonly)
Returns the value of attribute imprint.
227 228 229 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 227 def imprint @imprint end |
#imprint_name ⇒ Object (readonly)
Imprint, jeśli wydawnictwo używa imprintów. Jeżeli wydawnictwo podało imprint, to ta wartość powinna zostać wyświetlona użytkownikowi w sklepie jako nazwa wydawnictwa.
79 80 81 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 79 def imprint_name @imprint_name end |
#isbn13 ⇒ Object (readonly)
isbn13 - bez kresek
63 64 65 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 63 def isbn13 @isbn13 end |
#languages ⇒ Object (readonly)
lista języków, lista intancji Language
166 167 168 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 166 def languages @languages end |
#licence_limited_to ⇒ Object (readonly)
data końca licencji, jeśli licencja nie jest bezterminowa, instancja Date
124 125 126 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 124 def licence_limited_to @licence_limited_to end |
#licence_limited_to_before_type_cast ⇒ Object (readonly)
data końca licencji, jeśli licencja nie jest bezterminowa, w formacie YYYYMMDD
121 122 123 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 121 def licence_limited_to_before_type_cast @licence_limited_to_before_type_cast end |
#measures ⇒ Object (readonly)
Returns the value of attribute measures.
226 227 228 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 226 def measures @measures end |
#no_contributor ⇒ Object
:nodoc:
245 246 247 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 245 def no_contributor @no_contributor end |
#notification_type ⇒ Object (readonly)
Returns the value of attribute notification_type.
223 224 225 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 223 def notification_type @notification_type end |
#number_of_illustrations ⇒ Object (readonly)
liczba ilustracji
175 176 177 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 175 def number_of_illustrations @number_of_illustrations end |
#number_of_pages ⇒ Object (readonly)
ilość stron w książce drukowanej
66 67 68 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 66 def number_of_pages @number_of_pages end |
#number_of_pieces ⇒ Object (readonly)
ilość elementów (puzzle, gry planszowe)
196 197 198 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 196 def number_of_pieces @number_of_pieces end |
#original_title ⇒ Object (readonly)
tytuł oryginału
115 116 117 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 115 def original_title @original_title end |
#pdw_exclusiveness ⇒ Object (readonly)
PDWExclusiveness
149 150 151 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 149 def pdw_exclusiveness @pdw_exclusiveness end |
#pkwiu ⇒ Object (readonly)
PKWiU
146 147 148 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 146 def pkwiu @pkwiu end |
#players_number_from ⇒ Object (readonly)
min. ilość graczy - gry planszowe
199 200 201 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 199 def players_number_from @players_number_from end |
#players_number_to ⇒ Object (readonly)
max. ilość graczy - gry planszowe
202 203 204 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 202 def players_number_to @players_number_to end |
#playing_time_from ⇒ Object (readonly)
min. czas gry - gry planszowe
205 206 207 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 205 def @playing_time_from end |
#playing_time_to ⇒ Object (readonly)
max. czas gry - gry planszowe
208 209 210 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 208 def @playing_time_to end |
#preorder_embargo_date ⇒ Object (readonly)
Returns the value of attribute preorder_embargo_date.
242 243 244 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 242 def @preorder_embargo_date end |
#preview_exists ⇒ Object
:nodoc:
245 246 247 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 245 def preview_exists @preview_exists end |
#product_composition ⇒ Object (readonly)
Returns the value of attribute product_composition.
225 226 227 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 225 def product_composition @product_composition end |
#product_form ⇒ Object (readonly)
kod ONIX typu produktu, np. ‘BA’ - lista dostępna pod adresem github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
156 157 158 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 156 def product_form @product_form end |
#product_form_name ⇒ Object (readonly)
nazwa typu produktu, małe litery, np. ‘book’ - patrz pełna lista pod adresem github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml
160 161 162 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 160 def product_form_name @product_form_name end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
228 229 230 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 228 def publisher @publisher end |
#publisher_id ⇒ Object (readonly)
ID wydawnictwa w systemie elibri
75 76 77 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 75 def publisher_id @publisher_id end |
#publisher_name ⇒ Object (readonly)
nazwa wydawnictwa
72 73 74 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 72 def publisher_name @publisher_name end |
#publisher_subjects ⇒ Object (readonly)
Returns the value of attribute publisher_subjects.
234 235 236 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 234 def publisher_subjects @publisher_subjects end |
#publishing_date ⇒ Object (readonly)
Returns the value of attribute publishing_date.
240 241 242 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 240 def publishing_date @publishing_date end |
#publishing_status ⇒ Object (readonly)
Returns the value of attribute publishing_status.
229 230 231 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 229 def publishing_status @publishing_status end |
#reading_age_from ⇒ Object (readonly)
Wiek czytelnika - od
85 86 87 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 85 def reading_age_from @reading_age_from end |
#reading_age_to ⇒ Object (readonly)
Wiek czytelnika - do
88 89 90 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 88 def reading_age_to @reading_age_to end |
#record_reference ⇒ Object (readonly)
record reference - wewnętrzny identyfikator rekordu, niezmienny i unikatowy
134 135 136 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 134 def record_reference @record_reference end |
#related_products ⇒ Object (readonly)
Returns the value of attribute related_products.
241 242 243 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 241 def @related_products end |
#reviews ⇒ Object (readonly)
Returns the value of attribute reviews.
220 221 222 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 220 def reviews @reviews end |
#sale_restricted_to_poland ⇒ Object
:nodoc:
245 246 247 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 245 def sale_restricted_to_poland @sale_restricted_to_poland end |
#sales_restrictions ⇒ Object (readonly)
Returns the value of attribute sales_restrictions.
239 240 241 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 239 def sales_restrictions @sales_restrictions end |
#series ⇒ Object (readonly)
lista serii, w postaci [nazwa serii, numer w serii]
97 98 99 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 97 def series @series end |
#short_description ⇒ Object (readonly)
krótki opis, jeśli wydawca takowy zamieści, instancja TextContent
118 119 120 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 118 def short_description @short_description end |
#subtitle ⇒ Object (readonly)
podtytuł
103 104 105 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 103 def subtitle @subtitle end |
#supply_details ⇒ Object (readonly)
Returns the value of attribute supply_details.
236 237 238 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 236 def supply_details @supply_details end |
#supporting_resources ⇒ Object (readonly)
Returns the value of attribute supporting_resources.
238 239 240 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 238 def supporting_resources @supporting_resources end |
#table_of_contents ⇒ Object (readonly)
Spis treści - jeśli wydawca takowy umieścił, instancja TextContent
91 92 93 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 91 def table_of_contents @table_of_contents end |
#technical_protection ⇒ Object (readonly)
sposób zabezpieczania pliki (DRM, WATERMARK) - pliki dostępne w API transakcyjnym zawsze będą chronione watermarkiem
130 131 132 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 130 def technical_protection @technical_protection end |
#technical_protection_onix_code ⇒ Object (readonly)
Returns the value of attribute technical_protection_onix_code.
131 132 133 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 131 def technical_protection_onix_code @technical_protection_onix_code end |
#text_contents ⇒ Object (readonly)
:nodoc:
218 219 220 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 218 def text_contents @text_contents end |
#thema_subjects ⇒ Object (readonly)
Returns the value of attribute thema_subjects.
233 234 235 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 233 def thema_subjects @thema_subjects end |
#thickness ⇒ Object (readonly)
gruboś w milimetrach
54 55 56 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 54 def thickness @thickness end |
#title ⇒ Object (readonly)
tytuł ksiażki
100 101 102 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 100 def title @title end |
#title_details ⇒ Object (readonly)
Returns the value of attribute title_details.
230 231 232 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 230 def title_details @title_details end |
#to_xml ⇒ Object (readonly)
reprezentacja xml dla produktu
178 179 180 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 178 def to_xml @to_xml end |
#trade_title ⇒ Object (readonly)
Returns the value of attribute trade_title.
222 223 224 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 222 def trade_title @trade_title end |
#unlimited_licence ⇒ Object
:nodoc:
245 246 247 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 245 def unlimited_licence @unlimited_licence end |
#vat ⇒ Object (readonly)
stawka VAT
143 144 145 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 143 def vat @vat end |
#weight ⇒ Object (readonly)
waga w gramach
57 58 59 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 57 def weight @weight end |
#width ⇒ Object (readonly)
szerokość w milimetrach
51 52 53 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 51 def width @width end |
Instance Method Details
#authors ⇒ Object
494 495 496 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 494 def unnamed_persons? ? ["praca zbiorowa"] : @contributors.find_all { |c| c.role_name == "author" }.map(&:person_name) end |
#collateral_details_setup(data) ⇒ Object
433 434 435 436 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 433 def collateral_details_setup(data) @text_contents = data.css('TextContent').map { |text_detail| TextContent.new(text_detail) } @supporting_resources = data.css('SupportingResource').map { |supporting_data| SupportingResource.new(supporting_data) } end |
#descriptive_details_setup(data) ⇒ Object
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 373 def descriptive_details_setup(data) @country_of_manufacture = data.at_css("CountryOfManufacture").try(:text) @product_composition = data.at_css('ProductComposition').try(:text) @product_form = data.at_css('ProductForm').try(:text) if @product_form if @product_form.starts_with?("B") && !@cover_type @cover_type = Elibri::ONIX::Dict::CoverType.determine_cover_type(@product_form, data.at_css('ProductFormDetail').try(:text)) end if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(@product_form) @product_form_name = Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(@product_form).name(:en).downcase end simplified_product_form = @product_form.starts_with?("B") ? "BA" : @product_form if Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(simplified_product_form).try!(:digital?) @digital_formats = [] data.css("ProductFormDetail").each do |format| format_name = Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::find_by_onix_code(format.text).try(:name) @digital_formats << format_name.upcase.gsub("MOBIPOCKET", "MOBI") if format_name end end end data.css('ProductClassification').each do |cl| cl_type = cl.at_css('ProductClassificationType').text cl_value = cl.at_css('ProductClassificationCode').text if cl_type == Elibri::ONIX::Dict::Release_3_0::ProductClassificationType::PKWIU @pkwiu = cl_value elsif cl_type == Elibri::ONIX::Dict::Release_3_0::ProductClassificationType::CN @cn_code = cl_value end end @measures = data.css('Measure').map { |measure_data| Measure.new(measure_data) } @title_details = data.children.find_all { |node| node.name == 'TitleDetail' }.map { |title_data| TitleDetail.new(title_data) } @collections = data.css('Collection').map { |collection_data| Collection.new(collection_data) } @contributors = data.css('Contributor').map { |contributor_data| Contributor.new(contributor_data) } @no_contributor = !!data.at_css('NoContributor') @languages = data.css('Language').map { |language_data| Language.new(language_data) } @extents = data.css('Extent').map { |extent_data| Extent.new(extent_data) } @publisher_subjects = data.css('Subject').find_all { |sd| %w{24}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| PublisherSubject.new(sd) } @thema_subjects = data.css('Subject').find_all { |sd| %w{93 94 95 96 97 98 99}.include?(sd.at_css('SubjectSchemeIdentifier').try(:text)) }.map { |sd| ThemaSubject.new(sd) } @audience_ranges = data.css('AudienceRange').map { |audience_data| AudienceRange.new(audience_data) } #zabezpiecznie pliku if protection = data.at_css("EpubTechnicalProtection").try(:text) @technical_protection = Elibri::ONIX::Dict::Release_3_0::EpubTechnicalProtection::find_by_onix_code(protection).try(:name) @technical_protection_onix_code = protection end @edition_statement = data.at_css('EditionStatement').try(:text) if Elibri::ONIX::Dict::Release_3_0::EditionType.find_by_onix_code(data.at_css('EditionType').try(:text)) @edition_type_onix_code = data.at_css('EditionType').try(:text) end @number_of_illustrations = data.at_css('NumberOfIllustrations').try(:text).try(:to_i) end |
#exclusive_distributor_onix_code ⇒ Object
459 460 461 462 463 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 459 def exclusive_distributor_onix_code if @sales_restrictions.size > 0 @sales_restrictions[0].outlet_code end end |
#front_cover ⇒ Object
okładka ksiązki, instance SupportingResource
512 513 514 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 512 def front_cover @supporting_resources.find { |resource| resource.content_type_name == "front_cover" } end |
#inspect_include_fields ⇒ Object
40 41 42 43 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 40 def inspect_include_fields [:record_reference, :full_title, :front_cover, :publisher, :isbn13, :ean, :premiere, :contributors, :languages, :description, :product_form_name, :technical_protection, :digital_formats] end |
#licence_information_setup(data) ⇒ Object
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 333 def licence_information_setup(data) if data.namespaces.values.any? { |uri| uri =~ /elibri/ } && (data.at_xpath("elibri:SaleNotRestricted") || data.at_xpath("elibri:SaleRestrictedTo")) if data.at_xpath("elibri:SaleNotRestricted") @unlimited_licence = true elsif date = data.at_xpath("elibri:SaleRestrictedTo").try(:text) @unlimited_licence = false @licence_limited_to_before_type_cast = date @licence_limited_to = _parse_date(date) end else daten = data.css('PublishingDate').find { |d| d.at_css("PublishingDateRole") && d.at_css("PublishingDateRole").text == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::OUT_OF_PRINT_DATE } if daten date = daten.at_css('Date').text @licence_limited_to_before_type_cast = date @licence_limited_to = _parse_date(date) @unlimited_licence = false else @unlimited_licence = true end end end |
#no_contributor? ⇒ Boolean
flaga - true, jeśli produkt nie ma żadnego autora
480 481 482 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 480 def no_contributor? @no_contributor end |
#parsed_publishing_date ⇒ Object
data premiery w postaci listy [rok, miesiąc, dzień], [rok, miesiąc], [rok], lub pustej listy - jeśli data premiery nie jest znana (data premiery może nie być znana w przypadku backlisty)
539 540 541 542 543 544 545 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 539 def parsed_publishing_date if publishing_date publishing_date.parsed else [] end end |
#premiere ⇒ Object
data premiery, jako instancja Date (tylko wtedy, gdy dokładna data jest znana)
522 523 524 525 526 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 522 def premiere Date.new(*parsed_publishing_date) if parsed_publishing_date.size == 3 rescue ArgumentError nil end |
#preview_exists? ⇒ Boolean
flaga, czy istnieje podgląd produktu
490 491 492 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 490 def preview_exists? @preview_exists end |
#product_form_features_setup(data) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 356 def product_form_features_setup(data) data.each do |feature| ftype = feature.at_css("ProductFormFeatureType").inner_text v1, v2 = feature.at_css("ProductFormFeatureValue, ProductFormFeatureDescription").inner_text.split("-").map(&:to_i) if ftype == Elibri::ONIX::Dict::Release_3_0::ProductFormFeatureType::NUMBER_OF_GAME_PIECES @number_of_pieces = v1 elsif ftype == Elibri::ONIX::Dict::Release_3_0::ProductFormFeatureType::GAME_PLAYERS @players_number_from = v1 @players_number_to = v2 elsif ftype == Elibri::ONIX::Dict::Release_3_0::ProductFormFeatureType::GAME_PLAY_TIME @playing_time_from = v1 @playing_time_to = v2 end end end |
#proprietary_identifiers ⇒ Object
:nodoc:
533 534 535 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 533 def proprietary_identifiers @identifiers.find_all { |i| i.identifier_type == "proprietary" }.inject({}) { |res, ident| res[ident.type_name] = ident.value; res } end |
#publishing_details_setup(data) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 438 def publishing_details_setup(data) @imprint = Imprint.new(data.at_css('Imprint')) if data.at_css('Imprint') @publisher = Publisher.new(data.at_css('Publisher')) if data.at_css('Publisher') @publishing_status = data.at_css('PublishingStatus').try(:text) @city_of_publication = data.at_css("CityOfPublication").try(:text) publication_dates = data.css('PublishingDate').map do |node| PublishingDate.new(node) end @publishing_date = publication_dates.find { |date| date.role == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::PUBLICATION_DATE } = publication_dates.find { |date| date.role == Elibri::ONIX::Dict::Release_3_0::PublishingDateRole::PREORDER_EMBARGO_DATE } @preorder_embargo_date = Date.new(*.parsed) if @sales_restrictions = data.css('SalesRestriction').map { |restriction_data| SalesRestriction.new(restriction_data) } #ograniczenia terytorialne if data.at_css("CountriesIncluded").try(:text) == "PL" @sale_restricted_to_poland = true else @sale_restricted_to_poland = false end end |
#related_products_record_references ⇒ Object
528 529 530 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 528 def .map(&:record_reference) end |
#sale_restricted_to_poland? ⇒ Boolean
flaga, czy sprzedaż książki jest ograniczona do Polski
470 471 472 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 470 def sale_restricted_to_poland? @sale_restricted_to_poland end |
#sales_restrictions? ⇒ Boolean
465 466 467 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 465 def sales_restrictions? @sales_restrictions.size > 0 end |
#series_names ⇒ Object
lista nazwa serii, do których należy produkt
517 518 519 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 517 def series_names @series.map { |series| series[0] } end |
#unlimited_licence? ⇒ Boolean
flaga informująca, czy licencja jest bezterminowa
475 476 477 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 475 def unlimited_licence? @unlimited_licence end |
#unnamed_persons? ⇒ Boolean
flaga, czy książka to praca zbiorowa?
485 486 487 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 485 def unnamed_persons? @contributors.size == 1 && contributors[0].unnamed_persons.present? end |