Class: BeyondApi::ProductsView
- Includes:
- Utils
- Defined in:
- lib/beyond_api/resources/products_view.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(params = {}) ⇒ OpenStruct
A
GET
request is used to list all products. -
#available_tags ⇒ OpenStruct
A
GET
request is used to list all available tags. -
#find(product_id) ⇒ OpenStruct
TODO: To be documented.
-
#search_by_tag(tag, params = {}) ⇒ OpenStruct
A
GET
request is used to search for products matching any tag of the list given by a client. -
#search_by_term(term, params = {}) ⇒ OpenStruct
A
GET
request is used to search for products matching any tag of the list given by a client.
Methods included from Utils
#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct
Methods inherited from Base
Constructor Details
This class inherits a constructor from BeyondApi::Base
Instance Method Details
#all(params = {}) ⇒ OpenStruct
A GET
request is used to list all products.
$ curl 'https://api-shop.beyondshop.cloud/api/product-view/products' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json'
25 26 27 28 29 |
# File 'lib/beyond_api/resources/products_view.rb', line 25 def all(params = {}) path = "/product-view/products" handle_all_request(path, :products, params) end |
#available_tags ⇒ OpenStruct
A GET
request is used to list all available tags.
$ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-available-tags' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json'
43 44 45 46 47 48 49 50 |
# File 'lib/beyond_api/resources/products_view.rb', line 43 def path = "/product-view/products/search/find-available-tags" response, status = BeyondApi::Request.get(@session, path) handle_response(response, status) end |
#find(product_id) ⇒ OpenStruct
TODO: To be documented. NOTE: 10.4 10.5 and 10.6 are the same call with different response.
$ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/f75f8fb2-5a48-4d94-aad6-3d3692c06472' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json'
67 68 69 70 71 72 73 74 |
# File 'lib/beyond_api/resources/products_view.rb', line 67 def find(product_id) path = "/product-view/products/#{product_id}" response, status = BeyondApi::Request.get(@session, path) handle_response(response, status) end |
#search_by_tag(tag, params = {}) ⇒ OpenStruct
A GET
request is used to search for products matching any tag of the list given by a client. The intention is to offer product search capabilities for a shop’s storefront.
$ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-by-tags?tag=number0' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json'
92 93 94 95 96 97 98 99 100 |
# File 'lib/beyond_api/resources/products_view.rb', line 92 def search_by_tag(tag, params = {}) path = "/product-view/products/search/find-by-tags" response, status = BeyondApi::Request.get(@session, path, params.merge(tag: tag)) handle_response(response, status) end |
#search_by_term(term, params = {}) ⇒ OpenStruct
A GET
request is used to search for products matching any tag of the list given by a client. The intention is to offer product search capabilities for a shop’s storefront.
$ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-by-term?query=search+snippet' -i -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json'
118 119 120 121 122 123 124 125 126 |
# File 'lib/beyond_api/resources/products_view.rb', line 118 def search_by_term(term, params = {}) path = "/product-view/products/search/find-by-term" response, status = BeyondApi::Request.get(@session, path, params.merge(query: term)) handle_response(response, status) end |