Module: Epages::REST::Products
Overview
implements the calls in developer.epages.com/apps/api-reference/resource-product.html
Instance Method Summary collapse
-
#assign_categories(options = {}) ⇒ Object
implements the call developer.epages.com/apps/api-reference/post-shops-shopid-product-category-assignments.html Same as Epages::REST::Categories#‘assign_products`.
-
#create_product(data, options = {}) ⇒ Object
call the API to create a new product wit hte data provided and return the product created as Epages::Product implements the call developer.epages.com/apps/api-reference/post-shops-shopid-products.html.
-
#delete_from_categories(options = {}) ⇒ Object
implements the call developer.epages.com/apps/api-reference/delete-shops-shopid-product-category-assignments.html Same as Epages::REST::Categories#‘delete_products`.
-
#export_products(options = {}) ⇒ Object
call the API and return a CSV with the proper data of the products implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-export.html.
-
#product(product, options = {}) ⇒ Object
call the API and return a Epages::Product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid.html.
-
#product_add_slideshow_image(product, image) ⇒ Object
call the API to post a new image to the slideshow of a product and return an array of Epages::ImageSize (slides) of the product implements the call developer.epages.com/apps/api-reference/post-shops-shopid-products-productid-slideshow.html.
-
#product_custom_attributes(product, options = {}) ⇒ Object
call the API and return an array of Epages::CustomAttribute of the product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-custom-attributes.html.
-
#product_delete_slideshow_image(product, image) ⇒ Object
call the API to delete an image from the slideshow of a product implements the call developer.epages.com/apps/api-reference/delete-shops-shopid-products-productid-slideshow-imagename.html.
-
#product_lowest_price(product, options = {}) ⇒ Object
call the API and return a hash with the lowest price of the product and the respective link implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-lowest-price.html.
-
#product_slideshow(product) ⇒ Object
call the API and return an array of Epages::ImageSize (slides) of the product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-slideshow.html.
-
#product_slideshow_sequence(product) ⇒ Object
call the API to get the slideshow sequence of a product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-slideshow-sequence.html.
-
#product_update_slideshow_sequence(product, data) ⇒ Object
call the API to update the slideshow sequence of a product implements the call developer.epages.com/apps/api-reference/put-shops-shopid-products-productid-slideshow-sequence.html.
-
#product_variations(product, options = {}) ⇒ Object
call the API and return a Hash with the respective variation_attributes and the variation products implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-variations.html.
-
#products(options = {}) ⇒ Object
call the API and return an array of Epages::Product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products.html.
-
#update_product(product, options = {}) ⇒ Object
call the API and return a Epages::Product implements the call developer.epages.com/apps/api-reference/patch-shops-shopid-products-productid.html.
-
#updated_products_by_property(property, options = {}) ⇒ Object
call the API and return an array of Epages::Product with updated attribute implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-updated-productproperty.html.
-
#watched_products(options = {}) ⇒ Object
call the API and returns the list of all watched products.
Methods included from Utils
#epages_id, #format_date, #format_dates_options, #parse_legal_info, #parse_links, #parse_price_info, #parse_product_lowest_price, #parse_product_variations, #parse_suggestions_to_products, #parse_variation_object, #parse_variations, #perform_delete_request, #perform_delete_with_object, #perform_get_request, #perform_get_with_key_and_objects, #perform_get_with_object, #perform_get_with_objects, #perform_multipart_post_with_objects, #perform_patch_with_object, #perform_post_request, #perform_post_with_key_and_objects, #perform_post_with_object, #perform_post_with_objects, #perform_put_request, #perform_put_with_object, #perform_request, #perform_request_with_key_and_objects, #perform_request_with_object, #perform_request_with_objects, #process_thread
Instance Method Details
#assign_categories(options = {}) ⇒ Object
implements the call developer.epages.com/apps/api-reference/post-shops-shopid-product-category-assignments.html Same as Epages::REST::Categories#‘assign_products`
154 155 156 |
# File 'lib/epages/rest/products.rb', line 154 def assign_categories( = {}) perform_post_request('/product-category-assignments', ) end |
#create_product(data, options = {}) ⇒ Object
call the API to create a new product wit hte data provided and return the product created as Epages::Product implements the call developer.epages.com/apps/api-reference/post-shops-shopid-products.html
32 33 34 |
# File 'lib/epages/rest/products.rb', line 32 def create_product(data, = {}) perform_post_with_object("/products#{()}", data, Epages::Product) end |
#delete_from_categories(options = {}) ⇒ Object
implements the call developer.epages.com/apps/api-reference/delete-shops-shopid-product-category-assignments.html Same as Epages::REST::Categories#‘delete_products`
160 161 162 |
# File 'lib/epages/rest/products.rb', line 160 def delete_from_categories( = {}) perform_delete_request('/product-category-assignments', ) end |
#export_products(options = {}) ⇒ Object
call the API and return a CSV with the proper data of the products implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-export.html
140 141 142 |
# File 'lib/epages/rest/products.rb', line 140 def export_products( = {}) perform_get_request('/products/export', ) end |
#product(product, options = {}) ⇒ Object
call the API and return a Epages::Product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid.html
22 23 24 25 |
# File 'lib/epages/rest/products.rb', line 22 def product(product, = {}) id = epages_id(product) perform_get_with_object("/products/#{id}", , Epages::Product) end |
#product_add_slideshow_image(product, image) ⇒ Object
call the API to post a new image to the slideshow of a product and return an array of Epages::ImageSize (slides) of the product implements the call developer.epages.com/apps/api-reference/post-shops-shopid-products-productid-slideshow.html
71 72 73 74 |
# File 'lib/epages/rest/products.rb', line 71 def (product, image) id = epages_id(product) perform_multipart_post_with_objects("/products/#{id}/slideshow", image, Epages::ImageSize) end |
#product_custom_attributes(product, options = {}) ⇒ Object
call the API and return an array of Epages::CustomAttribute of the product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-custom-attributes.html
110 111 112 113 |
# File 'lib/epages/rest/products.rb', line 110 def product_custom_attributes(product, = {}) id = epages_id(product) perform_get_with_key_and_objects("/products/#{id}/custom-attributes", , :items, Epages::CustomAttribute) end |
#product_delete_slideshow_image(product, image) ⇒ Object
call the API to delete an image from the slideshow of a product implements the call developer.epages.com/apps/api-reference/delete-shops-shopid-products-productid-slideshow-imagename.html
81 82 83 84 |
# File 'lib/epages/rest/products.rb', line 81 def (product, image) id = epages_id(product) perform_delete_request("/products/#{id}/slideshow/#{image}") end |
#product_lowest_price(product, options = {}) ⇒ Object
call the API and return a hash with the lowest price of the product and the respective link implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-lowest-price.html
120 121 122 123 124 |
# File 'lib/epages/rest/products.rb', line 120 def product_lowest_price(product, = {}) id = epages_id(product) response = perform_get_request("/products/#{id}/lowest-price", ) parse_product_lowest_price(response) end |
#product_slideshow(product) ⇒ Object
call the API and return an array of Epages::ImageSize (slides) of the product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-slideshow.html
61 62 63 64 |
# File 'lib/epages/rest/products.rb', line 61 def (product) id = epages_id(product) perform_get_with_key_and_objects("/products/#{id}/slideshow", {}, :items, Epages::ImageSize) end |
#product_slideshow_sequence(product) ⇒ Object
call the API to get the slideshow sequence of a product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-slideshow-sequence.html
90 91 92 93 |
# File 'lib/epages/rest/products.rb', line 90 def (product) id = epages_id(product) perform_get_request("/products/#{id}/slideshow/sequence", {}) end |
#product_update_slideshow_sequence(product, data) ⇒ Object
call the API to update the slideshow sequence of a product implements the call developer.epages.com/apps/api-reference/put-shops-shopid-products-productid-slideshow-sequence.html
100 101 102 103 |
# File 'lib/epages/rest/products.rb', line 100 def (product, data) id = epages_id(product) perform_put_request("/products/#{id}/slideshow/sequence", data) end |
#product_variations(product, options = {}) ⇒ Object
call the API and return a Hash with the respective variation_attributes and the variation products implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-productid-variations.html
51 52 53 54 55 |
# File 'lib/epages/rest/products.rb', line 51 def product_variations(product, = {}) id = epages_id(product) response = perform_get_request("/products/#{id}/variations", ) parse_product_variations(response) end |
#products(options = {}) ⇒ Object
call the API and return an array of Epages::Product implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products.html
13 14 15 |
# File 'lib/epages/rest/products.rb', line 13 def products( = {}) perform_get_with_object('/products', , Epages::ProductsResponse) end |
#update_product(product, options = {}) ⇒ Object
call the API and return a Epages::Product implements the call developer.epages.com/apps/api-reference/patch-shops-shopid-products-productid.html
41 42 43 44 |
# File 'lib/epages/rest/products.rb', line 41 def update_product(product, = {}) id = epages_id(product) perform_patch_with_object("/products/#{id}", , Epages::Product) end |
#updated_products_by_property(property, options = {}) ⇒ Object
call the API and return an array of Epages::Product with updated attribute implements the call developer.epages.com/apps/api-reference/get-shops-shopid-products-updated-productproperty.html
131 132 133 134 |
# File 'lib/epages/rest/products.rb', line 131 def updated_products_by_property(property, = {}) res = perform_get_request("/products/updated/#{property.to_s.camelize(:lower)}", ) res[:items].collect { |i| Epages::Product.new(i[:item]) } end |
#watched_products(options = {}) ⇒ Object
call the API and returns the list of all watched products. Watched products refers to items currently out of stock and therefore can be watched by online shop customers. implements the call developer.epages.com/apps/api-reference/get-shops-shopid-watched-products.html
148 149 150 |
# File 'lib/epages/rest/products.rb', line 148 def watched_products( = {}) perform_get_with_key_and_objects('/watched-products', , :items, Epages::Product) end |