elibri_onix_generator 0.4.12 → 0.4.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +81 -0
- data/lib/elibri_onix_generator/model/product.rb +2 -2
- data/lib/elibri_onix_generator/version.rb +1 -1
- data/lib/elibri_onix_generator.rb +517 -234
- metadata +4 -5
- data/README +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54edee4f4f12797cac83cc7a2d2d621edab2c6ab99825fd0f6d15bb4615a24c5
|
4
|
+
data.tar.gz: 86d295e4483a62b47e724b864ba998f643a0ef734d877683196f331669b29d5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db8997a10b54b24f14990e0502c1488a29c39b01cfd0983fdce25ee58eba71bc6fb14c8caf739281277efe3f9e862be27a739092e2b0763de10864856113b9cf
|
7
|
+
data.tar.gz: c2224efcb2d06a509af681e9bd4b7b5a90833d998df9e65b80d9efae3c4a403ac7cabf508356bfc9cc8be362d0e90ab0ff41dfc6081b8785ffeaeccc3db2e573
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
XML Generator gem used by elibri.
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
|
5
|
+
class OnixGenerator
|
6
|
+
include Elibri::ONIX::Generator
|
7
|
+
end
|
8
|
+
|
9
|
+
book = OpenStruct.new(
|
10
|
+
product_form_onix_code: "BC",
|
11
|
+
public?: true,
|
12
|
+
publisher_name_for_onix: "Czarne",
|
13
|
+
record_reference: "6e9b713797aba6a41c0f",
|
14
|
+
notification_type: OpenStruct.new(onix_code: Elibri::ONIX::Dict::Release_3_0::NotificationType::ADVANCED_NOTIFICATION),
|
15
|
+
isbn_value: "9788380499997",
|
16
|
+
title_parts: [
|
17
|
+
OpenStruct.new(level: Elibri::ONIX::Dict::Release_3_0:: TitleType::DISTINCTIVE_TITLE,
|
18
|
+
title: "Tragedia na Przełęczy Diatłowa",
|
19
|
+
subtitle: "Historia bez końca")
|
20
|
+
],
|
21
|
+
authorship_kind: "user_given",
|
22
|
+
edition_statement: "wydanie pierwsze",
|
23
|
+
contributors: [
|
24
|
+
OpenStruct.new(
|
25
|
+
role_onix_code: Elibri::ONIX::Dict::Release_3_0::ContributorRole::AUTHOR,
|
26
|
+
generated_full_name: "Alice Lugen",
|
27
|
+
name: "Alice",
|
28
|
+
last_name: "Lugen",
|
29
|
+
),
|
30
|
+
],
|
31
|
+
publishing_status_onix_code: Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::FORTHCOMING,
|
32
|
+
publication_date_with_onix_format_code: [ "20200415", Elibri::ONIX::Dict::Release_3_0::DateFormat::YYYYMMDD ],
|
33
|
+
attachments: [
|
34
|
+
OpenStruct.new(
|
35
|
+
onix_resource_mode: Elibri::ONIX::Dict::Release_3_0::ResourceMode::IMAGE,
|
36
|
+
attachment_type_code: Elibri::ONIX::Dict::Release_3_0::ResourceContentType::FRONT_COVER,
|
37
|
+
updated_at: Time.now,
|
38
|
+
url_for_onix: "http://www.elibri.com.pl/system/product_attachments/production/000/157/528/original/3d270120/tragedia_na_przeleczy.jpg"
|
39
|
+
),
|
40
|
+
],
|
41
|
+
other_texts: [
|
42
|
+
OpenStruct.new(
|
43
|
+
text: "<p>\r Pod koniec stycznia 1959 roku grupa turystów...</p>",
|
44
|
+
type_onix_code: Elibri::ONIX::Dict::Release_3_0::OtherTextType::MAIN_DESCRIPTION,
|
45
|
+
exportable?: true
|
46
|
+
)
|
47
|
+
],
|
48
|
+
original_title: "",
|
49
|
+
languages: [
|
50
|
+
OpenStruct.new(
|
51
|
+
language_onix_code: "pol",
|
52
|
+
role_onix_code: Elibri::ONIX::Dict::Release_3_0::LanguageRole::LANGUAGE_OF_TEXT,
|
53
|
+
)
|
54
|
+
],
|
55
|
+
kind_of_measurable?: true,
|
56
|
+
width: 133,
|
57
|
+
height: 215,
|
58
|
+
thema_codes_for_onix_with_heading_text: [ "DNP" ],
|
59
|
+
series_membership_kind: "user_given",
|
60
|
+
series_memberships: [ OpenStruct.new(series_name: "Poza serią") ],
|
61
|
+
product_availabilities: [
|
62
|
+
OpenStruct.new(
|
63
|
+
supplier_role_onix_code: Elibri::ONIX::Dict::Release_3_0::SupplierRole::PUB_TO_RET,
|
64
|
+
supplier: OpenStruct.new(name: "Czarne"),
|
65
|
+
product_availability_onix_code: Elibri::ONIX::Dict::Release_3_0::ProductAvailabilityType::CONTACT_SUPPLIER,
|
66
|
+
price_infos: [
|
67
|
+
OpenStruct.new(
|
68
|
+
amount: "39.9",
|
69
|
+
vat: 5,
|
70
|
+
currency_code: "PLN",
|
71
|
+
)
|
72
|
+
]
|
73
|
+
)
|
74
|
+
]
|
75
|
+
)
|
76
|
+
|
77
|
+
|
78
|
+
generator = OnixGenerator.new(book, pure_onix: true)
|
79
|
+
puts generator.to_s
|
80
|
+
|
81
|
+
```
|
@@ -79,8 +79,8 @@ module Elibri
|
|
79
79
|
|
80
80
|
def attachments
|
81
81
|
if cover_url
|
82
|
-
[OpenStruct.new({"onix_resource_mode" => "03", "attachment_type_code" => "01",
|
83
|
-
"file" => OpenStruct.new({ "url" => cover_url })})]
|
82
|
+
[OpenStruct.new({"onix_resource_mode" => "03", "attachment_type_code" => "01",
|
83
|
+
"url_for_onix" => cover_url, "file" => OpenStruct.new({ "url" => cover_url })})]
|
84
84
|
else
|
85
85
|
[]
|
86
86
|
end
|