elibri_api_client 1.1.14 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- resp.parsed_response.css('Product').first
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
 
@@ -2,7 +2,7 @@ module Elibri
2
2
  class ApiClient
3
3
  z = $VERBOSE
4
4
  $VERBOSE = nil
5
- VERSION = "1.1.14"
5
+ VERSION = "1.1.15"
6
6
  Version = VERSION
7
7
  $VERBOSE = z
8
8
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: elibri_api_client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.14
5
+ version: 1.1.15
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Marcin Urba\xC5\x84ski"