bigcommerce 1.0.0.beta → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +115 -39
  3. data/bigcommerce.gemspec +12 -13
  4. data/lib/bigcommerce.rb +5 -34
  5. data/lib/bigcommerce/config.rb +14 -0
  6. data/lib/bigcommerce/connection.rb +26 -0
  7. data/lib/bigcommerce/exception.rb +25 -18
  8. data/lib/bigcommerce/request.rb +8 -9
  9. data/lib/bigcommerce/resource_actions.rb +11 -11
  10. data/lib/bigcommerce/resources/content/blog_post.rb +3 -5
  11. data/lib/bigcommerce/resources/content/blog_tag.rb +2 -3
  12. data/lib/bigcommerce/resources/content/redirect.rb +2 -2
  13. data/lib/bigcommerce/resources/customers/customer.rb +22 -2
  14. data/lib/bigcommerce/resources/customers/customer_address.rb +5 -5
  15. data/lib/bigcommerce/resources/customers/customer_group.rb +2 -2
  16. data/lib/bigcommerce/resources/geography/country.rb +4 -3
  17. data/lib/bigcommerce/resources/geography/state.rb +6 -5
  18. data/lib/bigcommerce/resources/marketing/banner.rb +21 -0
  19. data/lib/bigcommerce/resources/marketing/coupon.rb +2 -2
  20. data/lib/bigcommerce/resources/marketing/gift_certificates.rb +25 -0
  21. data/lib/bigcommerce/resources/orders/order.rb +46 -44
  22. data/lib/bigcommerce/resources/orders/order_coupon.rb +5 -5
  23. data/lib/bigcommerce/resources/orders/order_message.rb +8 -7
  24. data/lib/bigcommerce/resources/orders/order_product.rb +37 -36
  25. data/lib/bigcommerce/resources/orders/order_shipping_address.rb +24 -23
  26. data/lib/bigcommerce/resources/orders/order_status.rb +2 -1
  27. data/lib/bigcommerce/resources/orders/order_tax.rb +8 -7
  28. data/lib/bigcommerce/resources/orders/shipment.rb +11 -10
  29. data/lib/bigcommerce/resources/products/brand.rb +2 -2
  30. data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +6 -5
  31. data/lib/bigcommerce/resources/products/category.rb +2 -2
  32. data/lib/bigcommerce/resources/products/configurable_field.rb +6 -5
  33. data/lib/bigcommerce/resources/products/custom_field.rb +6 -5
  34. data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +9 -8
  35. data/lib/bigcommerce/resources/products/option.rb +2 -2
  36. data/lib/bigcommerce/resources/products/option_set.rb +2 -2
  37. data/lib/bigcommerce/resources/products/option_set_option.rb +2 -1
  38. data/lib/bigcommerce/resources/products/option_value.rb +1 -0
  39. data/lib/bigcommerce/resources/products/product.rb +61 -61
  40. data/lib/bigcommerce/resources/products/product_image.rb +4 -4
  41. data/lib/bigcommerce/resources/products/product_option.rb +2 -1
  42. data/lib/bigcommerce/resources/products/product_review.rb +1 -5
  43. data/lib/bigcommerce/resources/products/product_rule.rb +4 -4
  44. data/lib/bigcommerce/resources/products/product_video.rb +4 -4
  45. data/lib/bigcommerce/resources/products/sku.rb +15 -9
  46. data/lib/bigcommerce/resources/shipping/shipping_method.rb +2 -1
  47. data/lib/bigcommerce/resources/store/store_information.rb +18 -14
  48. data/lib/bigcommerce/resources/system/time.rb +2 -2
  49. data/lib/bigcommerce/resources/tax/tax_class.rb +2 -1
  50. data/lib/bigcommerce/resources/webhooks/webhook.rb +2 -1
  51. data/lib/bigcommerce/subresource_actions.rb +14 -14
  52. data/lib/bigcommerce/version.rb +1 -1
  53. metadata +47 -166
  54. data/.gitignore +0 -17
  55. data/.rspec +0 -2
  56. data/.rubocop.yml +0 -620
  57. data/.travis.yml +0 -15
  58. data/CHANGELOG.md +0 -11
  59. data/CONTRIBUTING.md +0 -119
  60. data/DEPENDENCIES.md +0 -7
  61. data/Gemfile +0 -15
  62. data/Guardfile +0 -22
  63. data/LICENSE +0 -20
  64. data/RELEASING.md +0 -64
  65. data/Rakefile +0 -13
  66. data/examples/README.md +0 -148
  67. data/examples/configuration/legacy_auth.rb +0 -12
  68. data/examples/configuration/oauth.rb +0 -9
  69. data/examples/content/blog_post.rb +0 -39
  70. data/examples/content/blog_tag.rb +0 -10
  71. data/examples/content/redirect.rb +0 -43
  72. data/examples/customers/customer.rb +0 -36
  73. data/examples/customers/customer_address.rb +0 -50
  74. data/examples/customers/customer_group.rb +0 -35
  75. data/examples/exception_handling.rb +0 -50
  76. data/examples/geography/country.rb +0 -16
  77. data/examples/geography/state.rb +0 -19
  78. data/examples/marketing/coupon.rb +0 -44
  79. data/examples/orders/order.rb +0 -53
  80. data/examples/orders/order_coupon.rb +0 -17
  81. data/examples/orders/order_message.rb +0 -17
  82. data/examples/orders/order_product.rb +0 -23
  83. data/examples/orders/order_shipping_address.rb +0 -23
  84. data/examples/orders/order_status.rb +0 -15
  85. data/examples/orders/order_tax.rb +0 -17
  86. data/examples/orders/shipment.rb +0 -57
  87. data/examples/payments/payment_method.rb +0 -10
  88. data/examples/products/brand.rb +0 -36
  89. data/examples/products/bulk_pricing_rule.rb +0 -47
  90. data/examples/products/category.rb +0 -37
  91. data/examples/products/configurable_field.rb +0 -29
  92. data/examples/products/custom_field.rb +0 -44
  93. data/examples/products/google_product_search_mapping.rb +0 -12
  94. data/examples/products/option.rb +0 -37
  95. data/examples/products/option_set.rb +0 -35
  96. data/examples/products/option_set_option.rb +0 -50
  97. data/examples/products/option_value.rb +0 -43
  98. data/examples/products/product.rb +0 -44
  99. data/examples/products/product_image.rb +0 -42
  100. data/examples/products/product_option.rb +0 -17
  101. data/examples/products/product_review.rb +0 -12
  102. data/examples/products/product_rule.rb +0 -54
  103. data/examples/products/product_video.rb +0 -45
  104. data/examples/products/sku.rb +0 -48
  105. data/examples/shipping/shipping_method.rb +0 -13
  106. data/examples/store/store_info.rb +0 -10
  107. data/examples/system/time.rb +0 -10
  108. data/examples/tax/tax_class.rb +0 -13
  109. data/examples/webhooks/webhook.rb +0 -29
  110. data/spec/bigcommerce/bigcommerce_spec.rb +0 -76
  111. data/spec/bigcommerce/unit/actions_spec.rb +0 -151
  112. data/spec/bigcommerce/unit/exception_spec.rb +0 -53
  113. data/spec/bigcommerce/unit/middleware/auth_spec.rb +0 -18
  114. data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +0 -40
  115. data/spec/bigcommerce/unit/request_spec.rb +0 -180
  116. data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +0 -12
  117. data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +0 -12
  118. data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +0 -12
  119. data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +0 -21
  120. data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +0 -12
  121. data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +0 -12
  122. data/spec/bigcommerce/unit/resources/geography/country_spec.rb +0 -12
  123. data/spec/bigcommerce/unit/resources/geography/state_spec.rb +0 -21
  124. data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +0 -12
  125. data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +0 -21
  126. data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +0 -21
  127. data/spec/bigcommerce/unit/resources/orders/order_spec.rb +0 -13
  128. data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +0 -21
  129. data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +0 -23
  130. data/spec/bigcommerce/unit/resources/products/brand_spec.rb +0 -12
  131. data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +0 -21
  132. data/spec/bigcommerce/unit/resources/products/category_spec.rb +0 -12
  133. data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +0 -21
  134. data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +0 -21
  135. data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +0 -14
  136. data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +0 -12
  137. data/spec/bigcommerce/unit/resources/products/option_spec.rb +0 -12
  138. data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +0 -21
  139. data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +0 -14
  140. data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +0 -21
  141. data/spec/bigcommerce/unit/resources/products/product_spec.rb +0 -13
  142. data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +0 -21
  143. data/spec/bigcommerce/unit/resources/products/sku_spec.rb +0 -21
  144. data/spec/bigcommerce/unit/resources/resource_spec.rb +0 -4
  145. data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +0 -12
  146. data/spec/bigcommerce/unit/resources/system/time_spec.rb +0 -12
  147. data/spec/bigcommerce/unit/version_spec.rb +0 -7
  148. data/spec/spec_helper.rb +0 -11
@@ -1,50 +0,0 @@
1
- require 'bigcommerce'
2
- require 'securerandom'
3
-
4
- Bigcommerce.configure do |config|
5
- config.store_hash = ENV['BC_STORE_HASH']
6
- config.client_id = ENV['BC_CLIENT_ID']
7
- config.access_token = ENV['BC_ACCESS_TOKEN']
8
- end
9
-
10
- @option_set = Bigcommerce::OptionSet.create(
11
- name: SecureRandom.hex
12
- )
13
-
14
- @option = Bigcommerce::Option.create(
15
- name: SecureRandom.hex,
16
- type: 'CS'
17
- )
18
-
19
- # Create an option set option
20
- @option_set_option = Bigcommerce::OptionSetOption.create(
21
- @option_set.id,
22
- option_id: @option.id,
23
- display_name: SecureRandom.hex,
24
- sort_order: 1,
25
- is_required: true
26
- )
27
- puts @option_set_option
28
-
29
- # List option set options
30
- puts Bigcommerce::OptionSetOption.all(@option_set.id)
31
-
32
- puts Bigcommerce::OptionSetOption.count(@option_set.id)
33
-
34
- # Get an option set option
35
- puts Bigcommerce::OptionSetOption.find(@option_set.id, @option_set_option.id)
36
-
37
- # Update an option set option
38
- puts Bigcommerce::OptionSetOption.update(
39
- @option_set.id,
40
- @option_set_option.id,
41
- display_name: 'Pick a color...',
42
- sort_order: 2,
43
- is_required: false
44
- )
45
-
46
- # Delete an option set option
47
- puts Bigcommerce::OptionSetOption.destroy(@option_set.id, @option_set_option.id)
48
-
49
- # Delete multiple option set options
50
- # puts Bigcommerce::OptionSetOption.destroy_all(@option_set.id)
@@ -1,43 +0,0 @@
1
- require 'bigcommerce'
2
- require 'securerandom'
3
-
4
- Bigcommerce.configure do |config|
5
- config.store_hash = ENV['BC_STORE_HASH']
6
- config.client_id = ENV['BC_CLIENT_ID']
7
- config.access_token = ENV['BC_ACCESS_TOKEN']
8
- end
9
-
10
- @option = Bigcommerce::Option.create(
11
- name: SecureRandom.hex,
12
- type: 'CS'
13
- )
14
-
15
- # Create an option value
16
- @option_value = Bigcommerce::OptionValue.create(
17
- @option.id,
18
- label: SecureRandom.hex,
19
- sort_order: 0,
20
- value: '#FFFFFF'
21
- )
22
- puts @option_value
23
-
24
- # List option values
25
- puts Bigcommerce::OptionValue.all(@option.id)
26
-
27
- # Get an option value
28
- puts Bigcommerce::OptionValue.find(@option.id, @option_value.id)
29
-
30
- # Update an option value
31
- puts Bigcommerce::OptionValue.update(
32
- @option.id,
33
- @option_value.id,
34
- label: SecureRandom.hex,
35
- sort_order: 0,
36
- value: '#000000'
37
- )
38
-
39
- # Delete an option value
40
- puts Bigcommerce::OptionValue.destroy(@option.id, @option_value.id)
41
-
42
- # Delete multiple option values
43
- # puts Bigcommerce::OptionValue.destroy_all(@option.id)
@@ -1,44 +0,0 @@
1
- require 'bigcommerce'
2
- require 'securerandom'
3
-
4
- Bigcommerce.configure do |config|
5
- config.store_hash = ENV['BC_STORE_HASH']
6
- config.client_id = ENV['BC_CLIENT_ID']
7
- config.access_token = ENV['BC_ACCESS_TOKEN']
8
- end
9
-
10
- # List products
11
- @products = Bigcommerce::Product.all
12
- puts @products
13
-
14
- # Get a product
15
- @product = @products[0]
16
- puts Bigcommerce::Product.find(@product.id)
17
-
18
- # Get products count
19
- puts Bigcommerce::Product.count
20
-
21
- # Create a product
22
- @category = Bigcommerce::Category.all[0]
23
- @product = Bigcommerce::Product.create(
24
- name: SecureRandom.hex,
25
- type: 'physical',
26
- description: SecureRandom.hex,
27
- price: '19.95',
28
- categories: [@category.id],
29
- availability: 'available',
30
- weight: '0.5'
31
- )
32
- puts @product
33
-
34
- # Update a product
35
- puts Bigcommerce::Product.update(
36
- @product.id,
37
- custom_url: '/foo-bar/'
38
- )
39
-
40
- # Delete a product
41
- puts Bigcommerce::Product.destroy(@product.id)
42
-
43
- # Delete all products
44
- # puts Bigcommerce::Product.destroy_all
@@ -1,42 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- @product = Bigcommerce::Product.all[0]
10
-
11
- # List product images
12
- @product_images = Bigcommerce::ProductImage.all(@product.id)
13
- puts @product_images
14
-
15
- # Get a count of product images
16
- puts Bigcommerce::ProductImage.count(@product.id)
17
-
18
- # Get a count of all product images for all products
19
- puts Bigcommerce::ProductImage.count_all
20
-
21
- # Create a product image
22
- @product_image = Bigcommerce::ProductImage.create(
23
- @product.id,
24
- image_file: 'http://i.imgur.com/Z5aV28x.gif'
25
- )
26
- puts @product_image
27
-
28
- # Get a product image
29
- puts Bigcommerce::ProductImage.find(@product.id, @product_image.id)
30
-
31
- # Update a product image
32
- puts Bigcommerce::ProductImage.update(
33
- @product.id,
34
- @product_image.id,
35
- image_file: 'http://i.imgur.com/4Dl6Y9d.gif'
36
- )
37
-
38
- # Delete a product image
39
- puts Bigcommerce::ProductImage.destroy(@product.id, @product_image.id)
40
-
41
- # Delete all product images
42
- # puts Bigcommerce::ProductImage.destroy_all(@product.id)
@@ -1,17 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- @product = Bigcommerce::Product.all[0]
10
-
11
- # List product options
12
- @product_options = Bigcommerce::ProductOption.all(@product.id)
13
- puts @product_options
14
-
15
- # Get a product option
16
- @product_option = @product_options[0]
17
- puts Bigcommerce::ProductOption.find(@product.id, @product_option.id)
@@ -1,12 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- @product = Bigcommerce::Product.all[0]
10
-
11
- # List product reviews
12
- puts Bigcommerce::ProductReview.all(@product.id)
@@ -1,54 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- @product = Bigcommerce::Product.all[0]
10
-
11
- # List product rules
12
- @product_rules = Bigcommerce::ProductRule.all(@product.id)
13
- puts @product_rules
14
-
15
- # Get a count of product rules
16
- puts Bigcommerce::ProductRule.count(@product.id)
17
-
18
- # Get a count of all product rules for all products
19
- puts Bigcommerce::ProductRule.count_all
20
-
21
- # Create a product rule
22
- @product_rule = Bigcommerce::ProductRule.create(
23
- @product.id,
24
- conditions: [
25
- {
26
- product_option_id: 95,
27
- option_value_id: 13,
28
- sku_id: nil
29
- }
30
- ]
31
- )
32
- puts @product_rule
33
-
34
- # Get a product rule
35
- puts Bigcommerce::ProductRule.find(@product.id, @product_rule.id)
36
-
37
- # Update a product rule
38
- puts Bigcommerce::ProductRule.update(
39
- @product.id,
40
- @product_rule.id,
41
- conditions: [
42
- {
43
- product_option_id: 95,
44
- option_value_id: 12,
45
- sku_id: nil
46
- }
47
- ]
48
- )
49
-
50
- # Delete a product rule
51
- puts Bigcommerce::ProductRule.destroy(@product.id, @product_rule.id)
52
-
53
- # Delete all product rules
54
- # puts Bigcommerce::ProductRule.destroy_all(@product.id)
@@ -1,45 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- @product = Bigcommerce::Product.all[0]
10
-
11
- # Create a product video
12
- @product_video = Bigcommerce::ProductVideo.create(
13
- @product.id,
14
- url: 'https://www.youtube.com/watch?v=T9RFb8xXZlk'
15
- )
16
- puts @product_video
17
-
18
- # List product videos
19
- @product_videos = Bigcommerce::ProductVideo.all(@product.id)
20
- puts @product_videos
21
-
22
- # Get a count of product videos
23
- puts Bigcommerce::ProductVideo.count(@product.id)
24
-
25
- # Get a count of all product videos for all products
26
- puts Bigcommerce::ProductVideo.count_all
27
-
28
- # Get a product video
29
- puts Bigcommerce::ProductVideo.find(@product.id, @product_video.id)
30
-
31
- # Update a product video
32
- # TODO
33
- # puts Bigcommerce::ProductVideo.update(
34
- # @product.id,
35
- # @product_video.id,
36
- # url: 'https://www.youtube.com/watch?v=LXgTp40Y3zo'
37
- # )
38
-
39
- # Delete a product video
40
- # TODO
41
- # puts Bigcommerce::ProductVideo.destroy(@product.id, product_video.id)
42
-
43
- # Delete all product videos
44
- # TODO
45
- # puts Bigcommerce::ProductVideo.destroy_all(@product.id)
@@ -1,48 +0,0 @@
1
- require 'bigcommerce'
2
- require 'securerandom'
3
-
4
- Bigcommerce.configure do |config|
5
- config.store_hash = ENV['BC_STORE_HASH']
6
- config.client_id = ENV['BC_CLIENT_ID']
7
- config.access_token = ENV['BC_ACCESS_TOKEN']
8
- end
9
-
10
- @product = Bigcommerce::Product.all[0]
11
-
12
- # Create a product sku
13
- @sku = Bigcommerce::Sku.create(
14
- @product.id,
15
- sku: SecureRandom.hex,
16
- options: [
17
- product_option_id: 95,
18
- option_value_id: 10
19
- ]
20
- )
21
- puts @sku
22
-
23
- # List product skus
24
- @skus = Bigcommerce::Sku.all(@product.id)
25
- puts @skus
26
-
27
- # Get a count of product skus
28
- puts Bigcommerce::Sku.count
29
-
30
- # Get a product sku
31
- puts Bigcommerce::Sku.find(@product.id, @sku.id)
32
-
33
- # Update a product sku
34
- puts Bigcommerce::Sku.update(
35
- @product.id,
36
- @sku.id,
37
- sku: SecureRandom.hex,
38
- options: [
39
- product_option_id: 95,
40
- option_value_id: 7
41
- ]
42
- )
43
-
44
- # Delete a product image
45
- puts Bigcommerce::Sku.destroy(@product.id, @sku.id)
46
-
47
- # Delete all product skus
48
- # puts Bigcommerce::Sku.destroy_all(@product.id)
@@ -1,13 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- # List shipping methods
10
- puts Bigcommerce::ShippingMethod.all
11
-
12
- # Get a shipping method
13
- puts Bigcommerce::ShippingMethod.find(1)
@@ -1,10 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- # Get store information
10
- puts Bigcommerce::StoreInfo.info
@@ -1,10 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- # Get current server time
10
- puts Bigcommerce::System.time
@@ -1,13 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- # List tax classes
10
- puts Bigcommerce::TaxClass.all
11
-
12
- # Get a tax classes
13
- puts Bigcommerce::TaxClass.find(1)
@@ -1,29 +0,0 @@
1
- require 'bigcommerce'
2
-
3
- Bigcommerce.configure do |config|
4
- config.store_hash = ENV['BC_STORE_HASH']
5
- config.client_id = ENV['BC_CLIENT_ID']
6
- config.access_token = ENV['BC_ACCESS_TOKEN']
7
- end
8
-
9
- # List all webhooks
10
- puts Bigcommerce::Webhook.all
11
-
12
- # Get a webhook
13
- puts Bigcommerce::Webhook.find(1)
14
-
15
- # Create a webhook
16
- @webhook = Bigcommerce::Webhook.create(
17
- scope: 'store/order/*',
18
- destination: 'https://app.example.com/orders'
19
- )
20
-
21
- # Update a webhook
22
- puts Bigcommerce::Webhook.update(
23
- @webhook.id,
24
- scope: 'store/order/*',
25
- destination: 'https://app.example.com/products'
26
- )
27
-
28
- # Delete a webhook
29
- puts Bigcommerce::Webhook.destroy(@webhook.id)