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:
[ :elibri_dialect, :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, :product_composition, :publisher, :product_form, :no_contributor, :edition_statement, :number_of_illustrations, :publishing_status, :publishing_date, :premiere, :front_cover, :series_names, :city_of_publication, :elibri_product_category1_id, :elibri_product_category2_id, :preview_exists, :short_description, :sale_restricted_to_poland, :technical_protection_onix_code, :unlimited_licence ]
- RELATIONS =
:nodoc:
[ :contributors, #IMPORTANT :related_products, :languages, :measures, :supply_details, :measures, :title_details, :collections, :extents, :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
-
#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.
-
#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.
-
#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.
-
#elibri_dialect ⇒ Object
readonly
Returns the value of attribute elibri_dialect.
-
#elibri_product_category1_id ⇒ Object
readonly
id kategorii elibri (1).
-
#elibri_product_category2_id ⇒ Object
readonly
id kategorii elibri (2).
-
#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.
-
#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.
-
#original_title ⇒ Object
readonly
tytuł oryginału.
-
#pkwiu ⇒ Object
readonly
PKWiU.
-
#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.
-
#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.
-
#subjects ⇒ Object
readonly
Returns the value of attribute subjects.
-
#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:.
-
#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
-
#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
czy istnieje podgląd?.
-
#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:
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 215 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 = [] @subjects = [] @audience_ranges = [] ##publishing_details @sales_restrictions = [] #moving to parsing attributes @elibri_dialect = data.at_xpath('//elibri:Dialect').try(:text) @record_reference = data.at_xpath('xmlns:RecordReference').try(:text) @notification_type = data.at_xpath('xmlns:NotificationType').try(:text) @deletion_text = data.at_xpath('xmlns:DeletionText').try(:text) @cover_type = data.at_xpath('elibri:CoverType').try(:text) @cover_price = BigDecimal.new(data.at_xpath('elibri:CoverPrice').try(:text)) if data.at_xpath('elibri:CoverPrice') @vat = data.at_xpath('elibri:Vat').try(:text).try(:to_i) @pkwiu = data.at_xpath('elibri:PKWiU').try(:text) @preview_exists = (data.at_xpath('elibri:preview_exists').try(:text) == "true") @identifiers = data.xpath('xmlns:ProductIdentifier').map { |ident_data| ProductIdentifier.new(ident_data) } begin @related_products = data.at_xpath('xmlns:RelatedMaterial').xpath('xmlns:RelatedProduct').map { || RelatedProduct.new() } rescue @related_products = [] end begin @supply_details = data.at_xpath('xmlns:ProductSupply').xpath('xmlns:SupplyDetail').map { |supply_data| SupplyDetail.new(supply_data) } rescue @supply_details = [] end descriptive_details_setup(data.at_xpath('xmlns:DescriptiveDetail')) if data.at_xpath('xmlns:DescriptiveDetail') collateral_details_setup(data.at_xpath('xmlns:CollateralDetail')) if data.at_xpath('xmlns:CollateralDetail') publishing_details_setup(data.at_xpath('xmlns:PublishingDetail')) if data.at_xpath('xmlns:PublishingDetail') licence_information_setup(data) @excerpt_infos = data.xpath("//elibri:excerpt").map { |node| ExcerptInfo.new(node) } @file_infos = data.xpath("//elibri:master").map { |node| FileInfo.new(node) } after_parse end |
Instance Attribute Details
#audience_ranges ⇒ Object (readonly)
Returns the value of attribute audience_ranges.
202 203 204 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 202 def audience_ranges @audience_ranges end |
#city_of_publication ⇒ Object (readonly)
miasto, w którym została wydana ksiażka
176 177 178 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 176 def city_of_publication @city_of_publication end |
#collection_part ⇒ Object (readonly)
numer w cyklu
107 108 109 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 107 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)
104 105 106 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 104 def collection_title @collection_title end |
#collections ⇒ Object (readonly)
Returns the value of attribute collections.
199 200 201 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 199 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
161 162 163 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 161 def contributors @contributors end |
#cover_price ⇒ Object (readonly)
sugerowana cena detaliczna brutto produktu
144 145 146 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 144 def cover_price @cover_price end |
#cover_type ⇒ Object (readonly)
typ okładki, np. ‘miękka ze skrzydełkami’
141 142 143 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 141 def cover_type @cover_type end |
#current_state ⇒ Object (readonly)
Status produktu - jedna z wartości: announced, :preorder, :published, :out_of_print, :deleted
80 81 82 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 80 def current_state @current_state end |
#deletion_text ⇒ Object (readonly)
Returns the value of attribute deletion_text.
192 193 194 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 192 def deletion_text @deletion_text end |
#description ⇒ Object (readonly)
Opis produktu, instancja TextContent
92 93 94 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 92 def description @description end |
#digital_formats ⇒ Object (readonly)
lista formatów, w jakich jest dostępny ebook (PDF, MOBI, EPUB)
131 132 133 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 131 def digital_formats @digital_formats end |
#duration ⇒ Object (readonly)
czas trwania nagrania w audiobooku, w minutach
67 68 69 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 67 def duration @duration end |
#ean ⇒ Object (readonly)
ean, jeśli jest inny, niż isbn13
58 59 60 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 58 def ean @ean end |
#edition_statement ⇒ Object (readonly)
informacja o numerze wydania
167 168 169 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 167 def edition_statement @edition_statement end |
#elibri_dialect ⇒ Object (readonly)
Returns the value of attribute elibri_dialect.
187 188 189 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 187 def elibri_dialect @elibri_dialect end |
#elibri_product_category1_id ⇒ Object (readonly)
id kategorii elibri (1)
119 120 121 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 119 def elibri_product_category1_id @elibri_product_category1_id end |
#elibri_product_category2_id ⇒ Object (readonly)
id kategorii elibri (2)
122 123 124 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 122 def elibri_product_category2_id @elibri_product_category2_id end |
#excerpt_infos ⇒ Object (readonly)
informacje o fragmentach utworów (produkty cyfrowe)
179 180 181 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 179 def excerpt_infos @excerpt_infos end |
#excerpts ⇒ Object (readonly)
Returns the value of attribute excerpts.
189 190 191 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 189 def excerpts @excerpts end |
#extents ⇒ Object (readonly)
Returns the value of attribute extents.
200 201 202 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 200 def extents @extents end |
#file_infos ⇒ Object (readonly)
informacje o plikach master (produkty cyfrowe)
182 183 184 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 182 def file_infos @file_infos end |
#file_size ⇒ Object (readonly)
Returns the value of attribute file_size.
186 187 188 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 186 def file_size @file_size end |
#full_title ⇒ Object (readonly)
pełen tytuł
110 111 112 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 110 def full_title @full_title end |
#height ⇒ Object (readonly)
:doc: wysokość w milimetrach
46 47 48 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 46 def height @height end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
204 205 206 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 204 def identifiers @identifiers end |
#imprint ⇒ Object (readonly)
Returns the value of attribute imprint.
195 196 197 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 195 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.
77 78 79 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 77 def imprint_name @imprint_name end |
#isbn13 ⇒ Object (readonly)
isbn13 - bez kresek
61 62 63 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 61 def isbn13 @isbn13 end |
#languages ⇒ Object (readonly)
lista języków, lista intancji Language
164 165 166 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 164 def languages @languages end |
#licence_limited_to ⇒ Object (readonly)
data końca licencji, jeśli licencja nie jest bezterminowa, instancja Date
128 129 130 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 128 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
125 126 127 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 125 def licence_limited_to_before_type_cast @licence_limited_to_before_type_cast end |
#measures ⇒ Object (readonly)
Returns the value of attribute measures.
194 195 196 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 194 def measures @measures end |
#no_contributor ⇒ Object
:nodoc:
212 213 214 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212 def no_contributor @no_contributor end |
#notification_type ⇒ Object (readonly)
Returns the value of attribute notification_type.
191 192 193 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 191 def notification_type @notification_type end |
#number_of_illustrations ⇒ Object (readonly)
liczba ilustracji
170 171 172 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 170 def number_of_illustrations @number_of_illustrations end |
#number_of_pages ⇒ Object (readonly)
ilość stron w książce drukowanej
64 65 66 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 64 def number_of_pages @number_of_pages end |
#original_title ⇒ Object (readonly)
tytuł oryginału
113 114 115 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 113 def original_title @original_title end |
#pkwiu ⇒ Object (readonly)
PKWiU
150 151 152 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 150 def pkwiu @pkwiu end |
#preview_exists ⇒ Object
:nodoc:
212 213 214 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212 def preview_exists @preview_exists end |
#product_composition ⇒ Object (readonly)
Returns the value of attribute product_composition.
193 194 195 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 193 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
154 155 156 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 154 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
158 159 160 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 158 def product_form_name @product_form_name end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
196 197 198 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 196 def publisher @publisher end |
#publisher_id ⇒ Object (readonly)
ID wydawnictwa w systemie elibri
73 74 75 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 73 def publisher_id @publisher_id end |
#publisher_name ⇒ Object (readonly)
nazwa wydawnictwa
70 71 72 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 70 def publisher_name @publisher_name end |
#publishing_date ⇒ Object (readonly)
Returns the value of attribute publishing_date.
208 209 210 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 208 def publishing_date @publishing_date end |
#publishing_status ⇒ Object (readonly)
Returns the value of attribute publishing_status.
197 198 199 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 197 def publishing_status @publishing_status end |
#reading_age_from ⇒ Object (readonly)
Wiek czytelnika - od
83 84 85 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 83 def reading_age_from @reading_age_from end |
#reading_age_to ⇒ Object (readonly)
Wiek czytelnika - do
86 87 88 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 86 def reading_age_to @reading_age_to end |
#record_reference ⇒ Object (readonly)
record reference - wewnętrzny identyfikator rekordu, niezmienny i unikatowy
138 139 140 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 138 def record_reference @record_reference end |
#related_products ⇒ Object (readonly)
Returns the value of attribute related_products.
209 210 211 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 209 def @related_products end |
#reviews ⇒ Object (readonly)
Returns the value of attribute reviews.
188 189 190 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 188 def reviews @reviews end |
#sale_restricted_to_poland ⇒ Object
:nodoc:
212 213 214 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212 def sale_restricted_to_poland @sale_restricted_to_poland end |
#sales_restrictions ⇒ Object (readonly)
Returns the value of attribute sales_restrictions.
207 208 209 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 207 def sales_restrictions @sales_restrictions end |
#series ⇒ Object (readonly)
lista serii, w postaci [nazwa serii, numer w serii]
95 96 97 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 95 def series @series end |
#short_description ⇒ Object (readonly)
krótki opis, jeśli wydawca takowy zamieści, instancja TextContent
116 117 118 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 116 def short_description @short_description end |
#subjects ⇒ Object (readonly)
Returns the value of attribute subjects.
201 202 203 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 201 def subjects @subjects end |
#subtitle ⇒ Object (readonly)
podtytuł
101 102 103 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 101 def subtitle @subtitle end |
#supply_details ⇒ Object (readonly)
Returns the value of attribute supply_details.
203 204 205 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 203 def supply_details @supply_details end |
#supporting_resources ⇒ Object (readonly)
Returns the value of attribute supporting_resources.
206 207 208 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 206 def supporting_resources @supporting_resources end |
#table_of_contents ⇒ Object (readonly)
Spis treści - jeśli wydawca takowy umieścił, instancja TextContent
89 90 91 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 89 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
134 135 136 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 134 def technical_protection @technical_protection end |
#technical_protection_onix_code ⇒ Object (readonly)
Returns the value of attribute technical_protection_onix_code.
135 136 137 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 135 def technical_protection_onix_code @technical_protection_onix_code end |
#text_contents ⇒ Object (readonly)
:nodoc:
185 186 187 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 185 def text_contents @text_contents end |
#thickness ⇒ Object (readonly)
gruboś w milimetrach
52 53 54 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 52 def thickness @thickness end |
#title ⇒ Object (readonly)
tytuł ksiażki
98 99 100 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 98 def title @title end |
#title_details ⇒ Object (readonly)
Returns the value of attribute title_details.
198 199 200 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 198 def title_details @title_details end |
#to_xml ⇒ Object (readonly)
reprezentacja xml dla produktu
173 174 175 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 173 def to_xml @to_xml end |
#trade_title ⇒ Object (readonly)
Returns the value of attribute trade_title.
190 191 192 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 190 def trade_title @trade_title end |
#unlimited_licence ⇒ Object
:nodoc:
212 213 214 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212 def unlimited_licence @unlimited_licence end |
#vat ⇒ Object (readonly)
stawka VAT
147 148 149 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 147 def vat @vat end |
#weight ⇒ Object (readonly)
waga w gramach
55 56 57 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 55 def weight @weight end |
#width ⇒ Object (readonly)
szerokość w milimetrach
49 50 51 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 49 def width @width end |
Instance Method Details
#authors ⇒ Object
355 356 357 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 355 def unnamed_persons? ? ["praca zbiorowa"] : @contributors.find_all { |c| c.role_name == "author" }.map(&:person_name) end |
#collateral_details_setup(data) ⇒ Object
305 306 307 308 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 305 def collateral_details_setup(data) @text_contents = data.xpath('xmlns:TextContent').map { |text_detail| TextContent.new(text_detail) } @supporting_resources = data.xpath('xmlns:SupportingResource').map { |supporting_data| SupportingResource.new(supporting_data) } end |
#descriptive_details_setup(data) ⇒ Object
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 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 274 def descriptive_details_setup(data) @product_composition = data.at_xpath('xmlns:ProductComposition').try(:text) @product_form = data.at_xpath('xmlns:ProductForm').try(:text) @product_form_name = Elibri::ONIX::Dict::Release_3_0::ProductFormCode::find_by_onix_code(@product_form).name(:en).downcase @measures = data.xpath('xmlns:Measure').map { |measure_data| Measure.new(measure_data) } @title_details = data.xpath('xmlns:TitleDetail').map { |title_data| TitleDetail.new(title_data) } @collections = data.xpath('xmlns:Collection').map { |collection_data| Collection.new(collection_data) } @contributors = data.xpath('xmlns:Contributor').map { |contributor_data| Contributor.new(contributor_data) } @no_contributor = !!data.at_xpath('xmlns:NoContributor') @languages = data.xpath('xmlns:Language').map { |language_data| Language.new(language_data) } @extents = data.xpath('xmlns:Extent').map { |extent_data| Extent.new(extent_data) } @subjects = data.xpath('xmlns:Subject').map { |subject_data| Subject.new(subject_data) } @audience_ranges = data.xpath('xmlns:AudienceRange').map { |audience_data| AudienceRange.new(audience_data) } if data.xpath("xmlns:ProductFormDetail").size > 0 @digital_formats = [] data.xpath("xmlns:ProductFormDetail").each do |format| @digital_formats << Elibri::ONIX::Dict::Release_3_0::ProductFormDetail::find_by_onix_code(format.text).name.upcase.gsub("MOBIPOCKET", "MOBI") end end #zabezpiecznie pliku if protection = data.at_xpath("xmlns:EpubTechnicalProtection").try(:text) @technical_protection = Elibri::ONIX::Dict::Release_3_0::EpubTechnicalProtection::find_by_onix_code(protection).name @technical_protection_onix_code = protection end @edition_statement = data.at_xpath('xmlns:EditionStatement').try(:text) @number_of_illustrations = data.at_xpath('xmlns:NumberOfIllustrations').try(:text).try(:to_i) end |
#front_cover ⇒ Object
okładka ksiązki, instance SupportingResource
378 379 380 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 378 def front_cover @supporting_resources.find { |resource| resource.content_type_name == "front_cover" } end |
#inspect_include_fields ⇒ Object
38 39 40 41 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 38 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
264 265 266 267 268 269 270 271 272 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 264 def licence_information_setup(data) 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 = Date.new(date[0...4].to_i, date[4...6].to_i, date[6...8].to_i) end end |
#no_contributor? ⇒ Boolean
flaga - true, jeśli produkt nie ma żadnego autora
341 342 343 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 341 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)
403 404 405 406 407 408 409 410 411 412 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 403 def parsed_publishing_date if sales_restrictions? date = sales_restrictions[0].end_date [date.year, date.month, date.day] elsif publishing_date publishing_date.parsed else [] end end |
#premiere ⇒ Object
data premiery, jako instancja Date (tylko wtedy, gdy dokładna data jest znana)
388 389 390 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 388 def premiere Date.new(*parsed_publishing_date) if parsed_publishing_date.size == 3 end |
#preview_exists? ⇒ Boolean
czy istnieje podgląd?
351 352 353 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 351 def preview_exists? @preview_exists end |
#proprietary_identifiers ⇒ Object
:nodoc:
397 398 399 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 397 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
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 310 def publishing_details_setup(data) @imprint = Imprint.new(data.at_xpath('xmlns:Imprint')) if data.at_xpath('xmlns:Imprint') @publisher = Publisher.new(data.at_xpath('xmlns:Publisher')) if data.at_xpath('xmlns:Publisher') @publishing_status = data.at_xpath('xmlns:PublishingStatus').try(:text) @city_of_publication = data.at_xpath("xmlns:CityOfPublication").try(:text) @publishing_date = PublishingDate.new(data.at_xpath('xmlns:PublishingDate')) if data.at_xpath('xmlns:PublishingDate') @sales_restrictions = data.xpath('xmlns:SalesRestriction').map { |restriction_data| SalesRestriction.new(restriction_data) } #ograniczenia terytorialne if data.at_xpath(".//xmlns:CountriesIncluded").try(:text) == "PL" @sale_restricted_to_poland = true else @sale_restricted_to_poland = false end end |
#related_products_record_references ⇒ Object
392 393 394 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 392 def .map(&:record_reference) end |
#sale_restricted_to_poland? ⇒ Boolean
flaga, czy sprzedaż książki jest ograniczona do Polski
331 332 333 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 331 def sale_restricted_to_poland? @sale_restricted_to_poland end |
#sales_restrictions? ⇒ Boolean
326 327 328 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 326 def sales_restrictions? @sales_restrictions.size > 0 end |
#series_names ⇒ Object
lista nazwa serii, do których należy produkt
383 384 385 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 383 def series_names @series.map { |series| series[0] } end |
#unlimited_licence? ⇒ Boolean
flaga informująca, czy licencja jest bezterminowa
336 337 338 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 336 def unlimited_licence? @unlimited_licence end |
#unnamed_persons? ⇒ Boolean
flaga, czy książka to praca zbiorowa?
346 347 348 |
# File 'lib/elibri_onix/onix_3_0/product.rb', line 346 def unnamed_persons? @contributors.size == 1 && contributors[0].unnamed_persons.present? end |