forked from bigcommerce/bigcommerce-api-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoption_set.rb
More file actions
35 lines (27 loc) · 746 Bytes
/
option_set.rb
File metadata and controls
35 lines (27 loc) · 746 Bytes
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
require 'bigcommerce'
require 'securerandom'
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
# Create an option set
@option_set = Bigcommerce::OptionSet.create(
name: SecureRandom.hex
)
puts @option_set
# List option sets
puts Bigcommerce::OptionSet.all
# Get an option set
puts Bigcommerce::OptionSet.find(@option_set.id)
# Get a count of option sets
puts Bigcommerce::OptionSet.count
# Update an option set
puts Bigcommerce::OptionSet.update(
@option_set.id,
name: ':)'
)
# Delete an option set
puts Bigcommerce::OptionSet.destroy(@option_set.id)
# Delete all option sets
# Bigcommerce::OptionSet.destroy_all