Class: PowaApi::ProductService
- Inherits:
-
PowaService
- Object
- PowaService
- PowaApi::ProductService
- Defined in:
- lib/powa_api/product_service.rb
Class Method Summary collapse
- .get_products(batch_number = nil) ⇒ Object
- .get_products_by_sku(*skus) ⇒ Object
- .get_published_products(publish_token, batch_number = nil) ⇒ Object
- .get_published_products_by_sku(*skus) ⇒ Object
Methods inherited from PowaService
Class Method Details
.get_products(batch_number = nil) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/powa_api/product_service.rb', line 51 def self.get_products(batch_number = nil) client = Savon.client wsdl response = client.request :get_products do soap.xml do |xml| xml.soapenv(:Envelope, namespaces) do |xml| header_block(xml) xml.soapenv(:Body) do |xml| xml.urn(:GetProductsRequest) do |xml| xml.batchNumber batch_number if batch_number end end end end end [response.to_array(:get_products_response).first[:product]].flatten.compact end |
.get_products_by_sku(*skus) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/powa_api/product_service.rb', line 74 def self.get_products_by_sku(*skus) client = Savon.client wsdl response = client.request :get_products_by_sku do soap.xml do |xml| xml.soapenv(:Envelope, namespaces) do |xml| header_block(xml) xml.soapenv(:Body) do |xml| xml.urn(:GetProductsBySkuRequest) do |xml| xml.skuList do |xml| skus.each do |sku| xml.sku sku end end end end end end end [response.to_array(:get_products_by_sku_response).first[:product]].flatten.compact end |
.get_published_products(publish_token, batch_number = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/powa_api/product_service.rb', line 4 def self.get_published_products(publish_token, batch_number = nil) client = Savon.client wsdl response = client.request :get_published_products do soap.xml do |xml| xml.soapenv(:Envelope, namespaces) do |xml| header_block(xml) xml.soapenv(:Body) do |xml| xml.urn(:GetPublishedProductsRequest) do |xml| xml.publishToken publish_token xml.batchNumber batch_number if batch_number end end end end end [response.to_array(:get_published_products_response).first[:products]].flatten.compact end |
.get_published_products_by_sku(*skus) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/powa_api/product_service.rb', line 26 def self.get_published_products_by_sku(*skus) client = Savon.client wsdl response = client.request :get_published_products_by_sku do soap.xml do |xml| xml.soapenv(:Envelope, namespaces) do |xml| header_block(xml) xml.soapenv(:Body) do |xml| xml.urn(:GetProductsBySkuRequest) do |xml| xml.skuList do |xml| skus.each do |sku| xml.sku sku end end end end end end end [response.to_array(:get_products_by_sku_response).first[:product]].flatten.compact end |