Class: Elibri::ONIX::Release_3_0::Product

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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 { |related_data| RelatedProduct.new(related_data) }
  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_rangesObject (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_publicationObject (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_partObject (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_titleObject (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

#collectionsObject (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

#contributorsObject (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_priceObject (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_typeObject (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_stateObject (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_textObject (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

#descriptionObject (readonly)

Opis produktu, instancja TextContent



92
93
94
# File 'lib/elibri_onix/onix_3_0/product.rb', line 92

def description
  @description
end

#digital_formatsObject (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

#durationObject (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

#eanObject (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_statementObject (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_dialectObject (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_idObject (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_idObject (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_infosObject (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

#excerptsObject (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

#extentsObject (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_infosObject (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_sizeObject (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_titleObject (readonly)

pełen tytuł



110
111
112
# File 'lib/elibri_onix/onix_3_0/product.rb', line 110

def full_title
  @full_title
end

#heightObject (readonly)

:doc: wysokość w milimetrach



46
47
48
# File 'lib/elibri_onix/onix_3_0/product.rb', line 46

def height
  @height
end

#identifiersObject (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

#imprintObject (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_nameObject (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

#isbn13Object (readonly)

isbn13 - bez kresek



61
62
63
# File 'lib/elibri_onix/onix_3_0/product.rb', line 61

def isbn13
  @isbn13
end

#languagesObject (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_toObject (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_castObject (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

#measuresObject (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_contributorObject

:nodoc:



212
213
214
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212

def no_contributor
  @no_contributor
end

#notification_typeObject (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_illustrationsObject (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_pagesObject (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_titleObject (readonly)

tytuł oryginału



113
114
115
# File 'lib/elibri_onix/onix_3_0/product.rb', line 113

def original_title
  @original_title
end

#pkwiuObject (readonly)

PKWiU



150
151
152
# File 'lib/elibri_onix/onix_3_0/product.rb', line 150

def pkwiu
  @pkwiu
end

#preview_existsObject

:nodoc:



212
213
214
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212

def preview_exists
  @preview_exists
end

#product_compositionObject (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_formObject (readonly)



154
155
156
# File 'lib/elibri_onix/onix_3_0/product.rb', line 154

def product_form
  @product_form
end

#product_form_nameObject (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

#publisherObject (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_idObject (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_nameObject (readonly)

nazwa wydawnictwa



70
71
72
# File 'lib/elibri_onix/onix_3_0/product.rb', line 70

def publisher_name
  @publisher_name
end

#publishing_dateObject (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_statusObject (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_fromObject (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_toObject (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_referenceObject (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

Returns the value of attribute related_products.



209
210
211
# File 'lib/elibri_onix/onix_3_0/product.rb', line 209

def related_products
  @related_products
end

#reviewsObject (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_polandObject

: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_restrictionsObject (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

#seriesObject (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_descriptionObject (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

#subjectsObject (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

#subtitleObject (readonly)

podtytuł



101
102
103
# File 'lib/elibri_onix/onix_3_0/product.rb', line 101

def subtitle
  @subtitle
end

#supply_detailsObject (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_resourcesObject (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_contentsObject (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_protectionObject (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_codeObject (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_contentsObject (readonly)

:nodoc:



185
186
187
# File 'lib/elibri_onix/onix_3_0/product.rb', line 185

def text_contents
  @text_contents
end

#thicknessObject (readonly)

gruboś w milimetrach



52
53
54
# File 'lib/elibri_onix/onix_3_0/product.rb', line 52

def thickness
  @thickness
end

#titleObject (readonly)

tytuł ksiażki



98
99
100
# File 'lib/elibri_onix/onix_3_0/product.rb', line 98

def title
  @title
end

#title_detailsObject (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_xmlObject (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_titleObject (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_licenceObject

:nodoc:



212
213
214
# File 'lib/elibri_onix/onix_3_0/product.rb', line 212

def unlimited_licence
  @unlimited_licence
end

#vatObject (readonly)

stawka VAT



147
148
149
# File 'lib/elibri_onix/onix_3_0/product.rb', line 147

def vat
  @vat
end

#weightObject (readonly)

waga w gramach



55
56
57
# File 'lib/elibri_onix/onix_3_0/product.rb', line 55

def weight
  @weight
end

#widthObject (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

#authorsObject



355
356
357
# File 'lib/elibri_onix/onix_3_0/product.rb', line 355

def authors
  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_coverObject

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_fieldsObject



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

Returns:

  • (Boolean)


341
342
343
# File 'lib/elibri_onix/onix_3_0/product.rb', line 341

def no_contributor?
  @no_contributor 
end

#parsed_publishing_dateObject

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

#premiereObject

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?

Returns:

  • (Boolean)


351
352
353
# File 'lib/elibri_onix/onix_3_0/product.rb', line 351

def preview_exists?
  @preview_exists
end

#proprietary_identifiersObject

: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


392
393
394
# File 'lib/elibri_onix/onix_3_0/product.rb', line 392

def related_products_record_references
  related_products.map(&:record_reference)
end

#sale_restricted_to_poland?Boolean

flaga, czy sprzedaż książki jest ograniczona do Polski

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


326
327
328
# File 'lib/elibri_onix/onix_3_0/product.rb', line 326

def sales_restrictions?
  @sales_restrictions.size > 0
end

#series_namesObject

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

Returns:

  • (Boolean)


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?

Returns:

  • (Boolean)


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