Module: BeyondApi::ProductVideos
- Included in:
- Products
- Defined in:
- lib/beyond_api/resources/products/videos.rb
Instance Method Summary collapse
-
#add_video(product_id, body) ⇒ OpenStruct
A
POST
request is used to create a video and add it to a product. -
#delete_video(product_id, video_id) ⇒ true
A
DELETE
request is used to delete a product video. -
#update_video(product_id, video_id, body) ⇒ OpenStruct
A
PUT
request is used to update a video. -
#video(product_id, video_id) ⇒ OpenStruct
A
GET
request is used to retrieve a single video of a product. -
#videos(product_id, params = {}) ⇒ OpenStruct
A
GET
request is used to retrieve the videos of a product.
Instance Method Details
#add_video(product_id, body) ⇒ OpenStruct
A POST
request is used to create a video and add it to a product.
$ curl 'https://api-shop.beyondshop.cloud/api/products/f7716244-568c-4536-bc25-317030f83395/videos' -i -X POST \
-H 'Content-Type: application/hal+json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"type" : "VIMEO",
"source" : "https://vimeo.com/7265982"
}'
33 34 35 36 37 |
# File 'lib/beyond_api/resources/products/videos.rb', line 33 def add_video(product_id, body) response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/videos", body) handle_response(response, status) end |
#delete_video(product_id, video_id) ⇒ true
A DELETE
request is used to delete a product video
$ curl 'https://api-shop.beyondshop.cloud/api/products/1cc9ef5e-62b1-43c7-8745-f4aa8be79934/videos/60869f60-1a4b-4013-b86c-00a2ab9ddc2c' -i -X DELETE \
-H 'Content-Type: application/hal+json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
57 58 59 60 61 |
# File 'lib/beyond_api/resources/products/videos.rb', line 57 def delete_video(product_id, video_id) response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/videos/#{video_id}") handle_response(response, status, respond_with_true: true) end |
#update_video(product_id, video_id, body) ⇒ OpenStruct
A PUT
request is used to update a video.
$ curl 'https://api-shop.beyondshop.cloud/api/products/9d33da61-1f60-4ad3-9de0-2f1dc0910ebb/videos/ef51af21-5381-4ccb-a107-8bfa574d3556' -i -X PUT \
-H 'Content-Type: application/hal+json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"type" : "VIMEO",
"source" : "https://vimeo.com/7265982"
}'
90 91 92 93 94 |
# File 'lib/beyond_api/resources/products/videos.rb', line 90 def update_video(product_id, video_id, body) response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/videos/#{video_id}", body) handle_response(response, status) end |
#video(product_id, video_id) ⇒ OpenStruct
A GET
request is used to retrieve a single video of a product.
$ curl 'https://api-shop.beyondshop.cloud/api/products/94c3baf9-1390-4bf8-a6c1-fb234533fa14/videos/ada27b8c-ddf0-489a-9143-5bec938c1e17' -i -X GET \
-H 'Content-Type: application/hal+json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
114 115 116 117 118 |
# File 'lib/beyond_api/resources/products/videos.rb', line 114 def video(product_id, video_id) response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/videos/#{video_id}") handle_response(response, status) end |
#videos(product_id, params = {}) ⇒ OpenStruct
A GET
request is used to retrieve the videos of a product.
$ curl 'https://api-shop.beyondshop.cloud/api/products/04c6ad65-465d-405e-a428-f73349104b65/videos' -i -X GET \
-H 'Content-Type: application/hal+json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
139 140 141 142 143 144 145 |
# File 'lib/beyond_api/resources/products/videos.rb', line 139 def videos(product_id, params = {}) response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/videos", params) handle_response(response, status) end |