forked from bigcommerce/bigcommerce-api-ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
/
product_video.rb
45 lines (35 loc) · 1.11 KB
/
product_video.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'bigcommerce'
Bigcommerce.configure do |config|
config.store_hash = ENV['BC_STORE_HASH']
config.client_id = ENV['BC_CLIENT_ID']
config.access_token = ENV['BC_ACCESS_TOKEN']
end
@product = Bigcommerce::Product.all[0]
# Create a product video
@product_video = Bigcommerce::ProductVideo.create(
@product.id,
url: 'https://www.youtube.com/watch?v=T9RFb8xXZlk'
)
puts @product_video
# List product videos
@product_videos = Bigcommerce::ProductVideo.all(@product.id)
puts @product_videos
# Get a count of product videos
puts Bigcommerce::ProductVideo.count(@product.id)
# Get a count of all product videos for all products
puts Bigcommerce::ProductVideo.count_all
# Get a product video
puts Bigcommerce::ProductVideo.find(@product.id, @product_video.id)
# Update a product video
# TODO
# puts Bigcommerce::ProductVideo.update(
# @product.id,
# @product_video.id,
# url: 'https://www.youtube.com/watch?v=LXgTp40Y3zo'
# )
# Delete a product video
# TODO
# puts Bigcommerce::ProductVideo.destroy(@product.id, product_video.id)
# Delete all product videos
# TODO
# puts Bigcommerce::ProductVideo.destroy_all(@product.id)