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,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
- @order = Bigcommerce::Order.all[0]
10
-
11
- # List order messages
12
- @order_messages = Bigcommerce::OrderMessage.all(@order.id)
13
- puts @order_messages
14
-
15
- # Get an order message
16
- @order_message = @order_messages[0]
17
- puts Bigcommerce::OrderMessage.find(@order.id, @order_message.id)
@@ -1,23 +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
- @order = Bigcommerce::Order.all[0]
10
-
11
- # List order products
12
- @order_products = Bigcommerce::OrderProduct.all(@order.id)
13
- puts @order_products
14
-
15
- # Get an order product
16
- @order_product = @order_products[0]
17
- puts Bigcommerce::OrderProduct.find(@order.id, @order_product.id)
18
-
19
- # Get a count of order products
20
- puts Bigcommerce::OrderProduct.count(@order.id)
21
-
22
- # Get a count of all order products for all orders
23
- puts Bigcommerce::OrderProduct.count_all
@@ -1,23 +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
- @order = Bigcommerce::Order.all[0]
10
-
11
- # List order shipping address
12
- @order_shipping_addresses = Bigcommerce::OrderShippingAddress.all(@order.id)
13
- puts @order_shipping_addresses
14
-
15
- # Get an order shipping address
16
- @order_shipping_address = @order_shipping_addresses[0]
17
- puts Bigcommerce::OrderShippingAddress.find(@order.id, @order_shipping_address.id)
18
-
19
- # Get a count of order shipping addresses
20
- puts Bigcommerce::OrderShippingAddress.count(@order.id)
21
-
22
- # Get a count of all order shipping addresses for all order
23
- puts Bigcommerce::OrderShippingAddress.count_all
@@ -1,15 +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 order statuses
10
- @order_statuses = Bigcommerce::OrderStatus.all
11
- puts @order_statuses
12
-
13
- # Get an order status
14
- @order_status = @order_statuses[0]
15
- puts Bigcommerce::OrderStatus.find(@order_status.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
- @order = Bigcommerce::Order.find(109)
10
-
11
- # List order taxes
12
- @order_taxes = Bigcommerce::OrderTax.all(@order.id)
13
- puts @order_taxes
14
-
15
- # Get an order tax
16
- @order_tax = @order_taxes[0]
17
- puts Bigcommerce::OrderTax.find(@order.id, @order_tax.id)
@@ -1,57 +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
- @order = Bigcommerce::Order.all[0]
10
-
11
- # Create a shipment
12
- @order_product = Bigcommerce::OrderProduct.all(@order.id)[0]
13
-
14
- @order_address = Bigcommerce::OrderShippingAddress.all(@order.id)[0]
15
-
16
- @shipment = Bigcommerce::Shipment.create(
17
- @order.id,
18
- tracking_number: 'ups12345',
19
- comments: 'Notes about the shipment',
20
- order_address_id: @order_address.id,
21
- items: [
22
- {
23
- order_product_id: @order_product.id,
24
- quantity: 1
25
- }
26
- ]
27
- )
28
- puts @shipment
29
-
30
- # List shipments
31
- @shipments = Bigcommerce::Shipment.all(@order.id)
32
- puts @shipments
33
-
34
- # Get a shipment
35
- @shipment = @shipments[0]
36
- puts Bigcommerce::Shipment.find(@order.id, @shipment.id)
37
-
38
- # Get a count of shipments
39
- puts Bigcommerce::Shipment.count(@order.id)
40
-
41
- # Get a count of all shipments for all orders
42
- puts Bigcommerce::Shipment.count_all
43
-
44
- # Update a shipment
45
- puts Bigcommerce::Shipment.update(
46
- @order.id,
47
- @shipment.id,
48
- tracking_number: 'fedex1245',
49
- comments: 'Notes about the shipment',
50
- order_address_id: @order_address.id
51
- )
52
-
53
- # Delete a shipment
54
- puts Bigcommerce::Shipment.destroy(@order.id, @shipment.id)
55
-
56
- # Delete multiple shipments
57
- # puts Bigcommerce::Shipment.destroy_all(@order.id)
@@ -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
- # List payment methods
10
- puts Bigcommerce::PaymentMethod.all
@@ -1,36 +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 brands
11
- puts Bigcommerce::Brand.all(page: 2)
12
-
13
- # Get a brand
14
- puts Bigcommerce::Brand.find(10)
15
-
16
- # Get a count of brands
17
- puts Bigcommerce::Brand.count
18
-
19
- # Create a brand
20
- @brand = Bigcommerce::Brand.create(
21
- name: SecureRandom.hex,
22
- page_title: "Title #{SecureRandom.hex}"
23
- )
24
- puts @brand
25
-
26
- # Update a brand
27
- puts Bigcommerce::Brand.update(
28
- @brand.id,
29
- name: 'Foobar'
30
- )
31
-
32
- # Delete a brand
33
- puts Bigcommerce::Brand.destroy(@brand.id)
34
-
35
- # Delete all brands
36
- # Bigcommerce::Brand.destroy_all
@@ -1,47 +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 products bulk pricing rule
13
- @bulk_pricing_rule = Bigcommerce::BulkPricingRule.create(
14
- @product.id,
15
- min: 1,
16
- max: 5,
17
- type: 'price',
18
- type_value: 2
19
- )
20
- puts @bulk_pricing_rule
21
-
22
- # List bulk pricing rules
23
- puts Bigcommerce::BulkPricingRule.all(@product.id)
24
-
25
- # Get a product bulk pricing rule
26
- puts Bigcommerce::BulkPricingRule.find(@product.id, @bulk_pricing_rule.id)
27
-
28
- # Get a count of bulk pricing rules
29
- puts Bigcommerce::BulkPricingRule.count(@product.id)
30
-
31
- # Get a count of all bulk pricing rules for all products
32
- puts Bigcommerce::BulkPricingRule.count_all
33
-
34
- # Update a bulk pricing rule
35
- puts Bigcommerce::BulkPricingRule.update(
36
- @product.id,
37
- @bulk_pricing_rule.id,
38
- min: 2,
39
- type: 'price',
40
- type_value: 2
41
- )
42
-
43
- # Delete a product bulk pricing rule
44
- puts Bigcommerce::BulkPricingRule.destroy(@product.id, @bulk_pricing_rule.id)
45
-
46
- # Delete multiple bulk pricing rules
47
- # puts Bigcommerce::BulkPricingRule.destroy(@product.id)
@@ -1,37 +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 categories
11
- @categories = Bigcommerce::Category.all
12
- puts @categories
13
-
14
- # Get a category
15
- @category = @categories[0]
16
- puts Bigcommerce::Category.find(@category.id)
17
-
18
- # Get a count of categories
19
- puts Bigcommerce::Category.count
20
-
21
- # Create a category
22
- @category = Bigcommerce::Category.create(
23
- name: SecureRandom.hex
24
- )
25
- puts @category
26
-
27
- # Update a category
28
- puts Bigcommerce::Category.update(
29
- @category.id,
30
- name: 'Foobar'
31
- )
32
-
33
- # Delete a category
34
- puts Bigcommerce::Category.destroy(@category.id)
35
-
36
- # Delete all categories
37
- # Bigcommerce::Category.destroy_all
@@ -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
- @product = Bigcommerce::Product.all[0]
10
-
11
- # List configurable fields
12
- @configurable_fields = Bigcommerce::ConfigurableField.all(@product.id)
13
- puts @configurable_fields
14
-
15
- # Get a configurable field
16
- @configurable_field = @configurable_fields[0]
17
- puts Bigcommerce::ConfigurableField.all(@product.id, @configurable_field.id)
18
-
19
- # Get a count of configurable fields
20
- puts Bigcommerce::ConfigurableField.count(@product.id)
21
-
22
- # Get a count of all configurable fields for all products
23
- puts Bigcommerce::ConfigurableField.count(@product.id)
24
-
25
- # Delete a configurable field
26
- puts Bigcommerce::ConfigurableField.destroy(@product.id, @configurable_field.id)
27
-
28
- # Delete multiple configurable fields
29
- # puts Bigcommerce::ConfigurableField.destroy_all(@product.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
- @product = Bigcommerce::Product.all[0]
11
-
12
- # Create a custom field
13
- @custom_field = Bigcommerce::CustomField.create(
14
- @product.id,
15
- name: SecureRandom.hex,
16
- text: SecureRandom.hex
17
- )
18
- puts @custom_field
19
-
20
- # List custom fields
21
- puts Bigcommerce::CustomField.all(@product.id)
22
-
23
- # Get a custom field
24
- puts Bigcommerce::CustomField.find(@product.id, @custom_field.id)
25
-
26
- # Get a count of custom fields
27
- puts Bigcommerce::CustomField.count(@product.id)
28
-
29
- # Get a count of custom fields for all products
30
- puts Bigcommerce::CustomField.count_all
31
-
32
- # Update a custom field
33
- puts Bigcommerce::CustomField.update(
34
- @product.id,
35
- @custom_field.id,
36
- name: ':)',
37
- text: ':)'
38
- )
39
-
40
- # Delete a custom field
41
- puts Bigcommerce::CustomField.destroy(@product.id, @custom_field.id)
42
-
43
- # Delete multiple custom fields
44
- # puts Bigcommerce::CustomField.destroy_all(@product.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 Google product search mappings
12
- puts Bigcommerce::GoogleProductSearchMapping.all(@product.id)
@@ -1,37 +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
- # Create an option
11
- @option = Bigcommerce::Option.create(
12
- name: SecureRandom.hex,
13
- type: 'CS'
14
- )
15
- puts @option
16
-
17
- # List options
18
- puts Bigcommerce::Option.all
19
-
20
- # Get an option
21
- puts Bigcommerce::Option.find(@option.id)
22
-
23
- # Get a count of options
24
- puts Bigcommerce::Option.count
25
-
26
- # Update an option
27
- puts Bigcommerce::Option.update(
28
- @option.id,
29
- name: ':)',
30
- type: 'CS'
31
- )
32
-
33
- # Delete an option
34
- puts Bigcommerce::Option.destroy(@option.id)
35
-
36
- # Delete all options
37
- # Bigcommerce::Option.destroy_all
@@ -1,35 +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
- # Create an option set
11
- @option_set = Bigcommerce::OptionSet.create(
12
- name: SecureRandom.hex
13
- )
14
- puts @option_set
15
-
16
- # List option sets
17
- puts Bigcommerce::OptionSet.all
18
-
19
- # Get an option set
20
- puts Bigcommerce::OptionSet.find(@option_set.id)
21
-
22
- # Get a count of option sets
23
- puts Bigcommerce::OptionSet.count
24
-
25
- # Update an option set
26
- puts Bigcommerce::OptionSet.update(
27
- @option_set.id,
28
- name: ':)'
29
- )
30
-
31
- # Delete an option set
32
- puts Bigcommerce::OptionSet.destroy(@option_set.id)
33
-
34
- # Delete all option sets
35
- # Bigcommerce::OptionSet.destroy_all