elibri_api_client 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/elibri_api_client.rb
CHANGED
@@ -45,7 +45,7 @@ module Elibri
|
|
45
45
|
|
46
46
|
# Metody API delegujemy do odpowiedniego adaptera:
|
47
47
|
def_delegators :@api_adapter, :refill_all_queues!, :pending_data?, :pending_queues, :publishers, :last_pop_from_queue, :pop_from_queue,
|
48
|
-
:remove_from_queue, :onix_xml_for_product, :get_product, :add_to_queue
|
48
|
+
:remove_from_queue, :onix_xml_for_product, :get_product, :add_to_queue, :get_onix_message_with_product
|
49
49
|
|
50
50
|
end
|
51
51
|
end
|
@@ -126,18 +126,26 @@ module Elibri
|
|
126
126
|
end
|
127
127
|
|
128
128
|
# Zwroc ONIX dla konkretnego produktu.
|
129
|
-
def onix_xml_for_product(product_or_rr) #:nodoc:
|
129
|
+
def onix_xml_for_product(product_or_rr, full_message = false) #:nodoc:
|
130
130
|
if product_or_rr.kind_of? Elibri::ApiClient::ApiAdapters::V1::Product
|
131
131
|
rr = product_or_rr.record_reference
|
132
132
|
else
|
133
133
|
rr = product_or_rr
|
134
134
|
end
|
135
135
|
resp = get "/products/#{rr}", :headers => {"X-eLibri-API-ONIX-dialect" => @onix_dialect}
|
136
|
-
|
136
|
+
if full_message
|
137
|
+
resp.parsed_response
|
138
|
+
else
|
139
|
+
resp.parsed_response.css('Product').first
|
140
|
+
end
|
137
141
|
end
|
138
142
|
|
139
143
|
def get_product(product_or_rr)
|
140
|
-
Elibri::ONIX::Release_3_0::Product.new(onix_xml_for_product(product_or_rr))
|
144
|
+
Elibri::ONIX::Release_3_0::Product.new(onix_xml_for_product(product_or_rr, false))
|
145
|
+
end
|
146
|
+
|
147
|
+
def get_onix_message_with_product(product_or_rr)
|
148
|
+
Elibri::ONIX::Release_3_0::ONIXMessage.new(onix_xml_for_product(product_or_rr, true))
|
141
149
|
end
|
142
150
|
|
143
151
|
|