Class: BeyondApi::ProductAttributeDefinitions
- Includes:
- Utils
- Defined in:
- lib/beyond_api/resources/product_attribute_definitions.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(params = {}) ⇒ OpenStruct
A
GET
request will list the available product attribute definitions. -
#create(body) ⇒ OpenStruct
A
POST
request is used to create a product attribute definition. -
#delete(product_attribute_name) ⇒ true
A
DELETE
request is used to delete a product attribute definition. -
#find(product_attribute_name) ⇒ OpenStruct
A
GET
request is used to retrieve a single product attribute definition by name.
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 will list the available product attribute definitions.
$ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X GET \
-H 'Authorization: Bearer <Access token>'
26 27 28 29 30 |
# File 'lib/beyond_api/resources/product_attribute_definitions.rb', line 26 def all(params = {}) path = "/product-attribute-definitions" handle_all_request(path, :product_attribute_definitions, params) end |
#create(body) ⇒ OpenStruct
A POST
request is used to create a product attribute definition.
$ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"key" : "filling_capacity",
"type" : "NUMBER",
"displayName" : "Filling Capacity",
"format" : "#,###.## ml"
}'
60 61 62 63 64 65 66 67 68 |
# File 'lib/beyond_api/resources/product_attribute_definitions.rb', line 60 def create(body) path = "/product-attribute-definitions" response, status = BeyondApi::Request.post(@session, path, body) handle_response(response, status) end |
#delete(product_attribute_name) ⇒ true
A DELETE
request is used to delete a product attribute definition.
$ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions/color' -i -X DELETE \
-H 'Authorization: Bearer <Access token>'
85 86 87 88 89 90 91 92 |
# File 'lib/beyond_api/resources/product_attribute_definitions.rb', line 85 def delete(product_attribute_name) path = "/product-attribute-definitions/#{product_attribute_name}" response, status = BeyondApi::Request.delete(@session, path) handle_response(response, status, respond_with_true: true) end |
#find(product_attribute_name) ⇒ OpenStruct
A GET
request is used to retrieve a single product attribute definition by name.
$ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions/filling_capacity' -i -X GET \
-H 'Authorization: Bearer <Access token>'
109 110 111 112 113 114 115 116 |
# File 'lib/beyond_api/resources/product_attribute_definitions.rb', line 109 def find(product_attribute_name) path = "/product-attribute-definitions/#{product_attribute_name}" response, status = BeyondApi::Request.get(@session, path) handle_response(response, status) end |