Module: BeyondApi::ProductVariationProperties

Included in:
Products
Defined in:
lib/beyond_api/resources/products/variation_properties.rb

Instance Method Summary collapse

Instance Method Details

#update_variation_properties(product_id, body) ⇒ OpenStruct

A PATCH request is used to update the variation properties of a variation product.

$ curl 'https://api-shop.beyondshop.cloud/api/products/51953b86-7ccc-4e80-acbd-1a2fc921fc2e/variation-properties' -i -X PATCH \
    -H 'Content-Type: application/hal+json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '[ {
  "property" : "salesPrice",
  "enabled" : true
  }, {
    "property" : "listPrice",
    "enabled" : true
  }, {
    "property" : "refPrice",
    "enabled" : true
  }, {
    "property" : "manufacturerPrice",
    "enabled" : true
  }, {
    "property" : "productIdentifiers",
    "enabled" : true
} ]'

Examples:

body = [{
	"property": "salesPrice",
	"enabled": true
}, {
	"property": "listPrice",
	"enabled": true
}, {
	"property": "refPrice",
	"enabled": true
}, {
	"property": "manufacturerPrice",
	"enabled": true
}, {
	"property": "productIdentifiers",
	"enabled": true
}]

@variation_properties = session.products.update_variation_properties("7f32696a-df56-4380-a91b-fffb97f025b4", body)

Parameters:

  • product_id (String)

    the product UUID

  • body (Array<Hash>)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • prod:r



58
59
60
61
62
# File 'lib/beyond_api/resources/products/variation_properties.rb', line 58

def update_variation_properties(product_id, body)
  response, status = BeyondApi::Request.patch(@session, "/products/#{product_id}/variation-properties", body)

  handle_response(response, status)
end

#variation_properties(product_id) ⇒ OpenStruct

A GET request is used to retrieve the variation properties of a variation product.

$ curl 'https://api-shop.beyondshop.cloud/api/products/ea81446c-8fec-418c-8b3c-6e43fdee713a/variation-properties' -i -X GET \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@variation_properties = session.products.variation_properties("7f32696a-df56-4380-a91b-fffb97f025b4")

Parameters:

  • product_id (String)

    the product UUID

Returns:

  • (OpenStruct)

Scopes:

  • prod:r



80
81
82
83
84
# File 'lib/beyond_api/resources/products/variation_properties.rb', line 80

def variation_properties(product_id)
  response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/variation-properties")

  handle_response(response, status)
end