acts_as_elibri_product 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/acts_as_elibri_product/version.rb +1 -1
- data/lib/acts_as_elibri_product.rb +5 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Usage guide:
|
|
14
14
|
|
15
15
|
* Add `acts_as_elibri_product TRAVERSE_VECTOR` to your product_model
|
16
16
|
|
17
|
-
* Schedule (for example in cron) regular calls to `ProductModel.batch_create_or_update_from_elibri` providing `xml_string` from eLibri API as an argument.
|
17
|
+
* Schedule (for example in cron) regular calls to `ProductModel.batch_create_or_update_from_elibri` providing `xml_string` from eLibri API as an argument, or providing `Elibri::ONIX::Release_3_0::ONIXMessage` from eLibri API as an argument.
|
18
18
|
|
19
19
|
TRAVERSE_VECTOR is a structure containing information about mapping elibri arguments to your model arguments. Attributes not specified here, will be ignored during data import.
|
20
20
|
|
@@ -45,7 +45,11 @@ module ActsAsElibriProduct
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def batch_create_or_update_from_elibri(xml_string)
|
48
|
-
|
48
|
+
if xml_string.is_a?(Elibri::ONIX::Release_3_0::ONIXMessage)
|
49
|
+
recreated_products = xml_string
|
50
|
+
else
|
51
|
+
recreated_products = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(xml_string)
|
52
|
+
end
|
49
53
|
recreated_products.products.each do |product|
|
50
54
|
xml = product.to_xml.to_s
|
51
55
|
dialect = product.elibri_dialect
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_elibri_product
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Piotr Szmielew
|