-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathcustomer_group.rb
More file actions
35 lines (27 loc) · 866 Bytes
/
customer_group.rb
File metadata and controls
35 lines (27 loc) · 866 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
# List all customer groups
puts Bigcommerce::CustomerGroup.all
# Get a customer group
puts Bigcommerce::CustomerGroup.find(1)
# Get a count of all customer groups
puts Bigcommerce::CustomerGroup.count
# Create a customer group
@customer_group = Bigcommerce::CustomerGroup.create(
name: "Customer Group #{SecureRandom.hex}"
)
puts @customer_group
# Update a customer group
puts Bigcommerce::CustomerGroup.update(
@customer_group.id,
name: "Customer_group #{SecureRandom.hex}"
)
# Delete a customer group
puts Bigcommerce::CustomerGroup.destroy(@customer_group.id)
# Delete all customer groups
# puts Bigcommerce::CustomerGroup.destroy_all