bigcommerce 0.10.0 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +620 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +119 -0
- data/DEPENDENCIES.md +7 -0
- data/Gemfile +15 -0
- data/Guardfile +22 -0
- data/LICENSE +15 -15
- data/README.md +61 -70
- data/RELEASING.md +64 -0
- data/Rakefile +8 -6
- data/bigcommerce.gemspec +22 -53
- data/examples/README.md +148 -0
- data/examples/configuration/legacy_auth.rb +12 -0
- data/examples/configuration/oauth.rb +9 -0
- data/examples/content/blog_post.rb +39 -0
- data/examples/content/blog_tag.rb +10 -0
- data/examples/content/redirect.rb +43 -0
- data/examples/customers/customer.rb +36 -0
- data/examples/customers/customer_address.rb +50 -0
- data/examples/customers/customer_group.rb +35 -0
- data/examples/exception_handling.rb +50 -0
- data/examples/geography/country.rb +16 -0
- data/examples/geography/state.rb +19 -0
- data/examples/marketing/coupon.rb +44 -0
- data/examples/orders/order.rb +53 -0
- data/examples/orders/order_coupon.rb +17 -0
- data/examples/orders/order_message.rb +17 -0
- data/examples/orders/order_product.rb +23 -0
- data/examples/orders/order_shipping_address.rb +23 -0
- data/examples/orders/order_status.rb +15 -0
- data/examples/orders/order_tax.rb +17 -0
- data/examples/orders/shipment.rb +57 -0
- data/examples/payments/payment_method.rb +10 -0
- data/examples/products/brand.rb +36 -0
- data/examples/products/bulk_pricing_rule.rb +47 -0
- data/examples/products/category.rb +37 -0
- data/examples/products/configurable_field.rb +29 -0
- data/examples/products/custom_field.rb +44 -0
- data/examples/products/google_product_search_mapping.rb +12 -0
- data/examples/products/option.rb +37 -0
- data/examples/products/option_set.rb +35 -0
- data/examples/products/option_set_option.rb +50 -0
- data/examples/products/option_value.rb +43 -0
- data/examples/products/product.rb +44 -0
- data/examples/products/product_image.rb +42 -0
- data/examples/products/product_option.rb +17 -0
- data/examples/products/product_review.rb +12 -0
- data/examples/products/product_rule.rb +54 -0
- data/examples/products/product_video.rb +45 -0
- data/examples/products/sku.rb +48 -0
- data/examples/shipping/shipping_method.rb +13 -0
- data/examples/store/store_info.rb +10 -0
- data/examples/system/time.rb +10 -0
- data/examples/tax/tax_class.rb +13 -0
- data/examples/webhooks/webhook.rb +29 -0
- data/lib/bigcommerce.rb +50 -8
- data/lib/bigcommerce/exception.rb +51 -0
- data/lib/bigcommerce/middleware/auth.rb +16 -0
- data/lib/bigcommerce/middleware/http_exception.rb +14 -0
- data/lib/bigcommerce/request.rb +89 -0
- data/lib/bigcommerce/resource_actions.rb +51 -0
- data/lib/bigcommerce/resources/content/blog_post.rb +31 -0
- data/lib/bigcommerce/resources/content/blog_tag.rb +17 -0
- data/lib/bigcommerce/resources/content/redirect.rb +21 -0
- data/lib/bigcommerce/resources/customers/customer.rb +30 -0
- data/lib/bigcommerce/resources/customers/customer_address.rb +34 -0
- data/lib/bigcommerce/resources/customers/customer_group.rb +21 -0
- data/lib/bigcommerce/resources/geography/country.rb +22 -0
- data/lib/bigcommerce/resources/geography/state.rb +25 -0
- data/lib/bigcommerce/resources/marketing/coupon.rb +30 -0
- data/lib/bigcommerce/resources/orders/order.rb +73 -0
- data/lib/bigcommerce/resources/orders/order_coupon.rb +20 -0
- data/lib/bigcommerce/resources/orders/order_message.rb +23 -0
- data/lib/bigcommerce/resources/orders/order_product.rb +64 -0
- data/lib/bigcommerce/resources/orders/order_shipping_address.rb +50 -0
- data/lib/bigcommerce/resources/orders/order_status.rb +16 -0
- data/lib/bigcommerce/resources/orders/order_tax.rb +23 -0
- data/lib/bigcommerce/resources/orders/shipment.rb +30 -0
- data/lib/bigcommerce/resources/payments/payment_method.rb +17 -0
- data/lib/bigcommerce/resources/products/brand.rb +23 -0
- data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +26 -0
- data/lib/bigcommerce/resources/products/category.rb +29 -0
- data/lib/bigcommerce/resources/products/configurable_field.rb +30 -0
- data/lib/bigcommerce/resources/products/custom_field.rb +24 -0
- data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +26 -0
- data/lib/bigcommerce/resources/products/option.rb +20 -0
- data/lib/bigcommerce/resources/products/option_set.rb +18 -0
- data/lib/bigcommerce/resources/products/option_set_option.rb +19 -0
- data/lib/bigcommerce/resources/products/option_value.rb +15 -0
- data/lib/bigcommerce/resources/products/product.rb +97 -0
- data/lib/bigcommerce/resources/products/product_image.rb +31 -0
- data/lib/bigcommerce/resources/products/product_option.rb +17 -0
- data/lib/bigcommerce/resources/products/product_review.rb +22 -0
- data/lib/bigcommerce/resources/products/product_rule.rb +31 -0
- data/lib/bigcommerce/resources/products/product_video.rb +24 -0
- data/lib/bigcommerce/resources/products/sku.rb +29 -0
- data/lib/bigcommerce/resources/resource.rb +10 -0
- data/lib/bigcommerce/resources/shipping/shipping_method.rb +15 -0
- data/lib/bigcommerce/resources/store/store_information.rb +37 -0
- data/lib/bigcommerce/resources/system/time.rb +15 -0
- data/lib/bigcommerce/resources/tax/tax_class.rb +15 -0
- data/lib/bigcommerce/resources/webhooks/webhook.rb +22 -0
- data/lib/bigcommerce/subresource_actions.rb +43 -0
- data/lib/bigcommerce/version.rb +1 -4
- data/spec/bigcommerce/bigcommerce_spec.rb +76 -0
- data/spec/bigcommerce/unit/actions_spec.rb +151 -0
- data/spec/bigcommerce/unit/exception_spec.rb +53 -0
- data/spec/bigcommerce/unit/middleware/auth_spec.rb +18 -0
- data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +40 -0
- data/spec/bigcommerce/unit/request_spec.rb +180 -0
- data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/country_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/state_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +23 -0
- data/spec/bigcommerce/unit/resources/products/brand_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/category_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/option_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/sku_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/resource_spec.rb +4 -0
- data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/system/time_spec.rb +12 -0
- data/spec/bigcommerce/unit/version_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -25
- metadata +203 -127
- data/lib/big_commerce.rb +0 -1
- data/lib/bigcommerce/api.rb +0 -473
- data/lib/bigcommerce/connection.rb +0 -171
- data/lib/bigcommerce/product.rb +0 -13
- data/lib/bigcommerce/resource.rb +0 -50
- data/spec/big_commerce_spec.rb +0 -9
- data/spec/integration/orders_spec.rb +0 -18
- data/spec/support/integration_context.rb +0 -13
- data/spec/support/mock_api_context.rb +0 -10
- data/spec/unit/api_request_spec.rb +0 -34
- data/spec/unit/api_spec.rb +0 -49
- data/spec/unit/connection_spec.rb +0 -23
- data/spec/unit/date_time_spec.rb +0 -31
- data/spec/unit/version_spec.rb +0 -13
data/Rakefile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'ci/reporter/rake/rspec'
|
3
1
|
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'bigcommerce'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
5
|
+
RSpec::Core::RakeTask.new do |spec|
|
8
6
|
spec.pattern = 'spec/**/*_spec.rb'
|
7
|
+
spec.verbose = false
|
9
8
|
end
|
10
9
|
|
11
|
-
|
10
|
+
require 'rubocop/rake_task'
|
11
|
+
RuboCop::RakeTask.new(:rubocop)
|
12
|
+
|
13
|
+
task default: [:rubocop, :spec]
|
data/bigcommerce.gemspec
CHANGED
@@ -1,59 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'bigcommerce/version'
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
6
|
-
s.
|
7
|
-
|
8
|
-
s.
|
9
|
-
s.authors = ["Mark Rickerby", "Rob Howard", "Saranyan Vigraham", "Sasha Gerrand"]
|
10
|
-
s.date = "2015-01-27"
|
11
|
-
s.description = "Enables Ruby applications to communicate with the Bigcommerce API V2."
|
6
|
+
s.name = 'bigcommerce'
|
7
|
+
s.homepage = 'https://github.com/bigcommerce/bigcommerce-api-ruby'
|
8
|
+
s.authors = ['Patrick Edelman']
|
9
|
+
s.version = Bigcommerce::VERSION
|
12
10
|
s.license = 'MIT'
|
13
|
-
s.email = ["mark.rickerby@bigcommerce.com", "rob.howard@bigcommerce.com", "saranyan.vigraham@bigcommerce.com", "sasha.gerrand@bigcommerce.com"]
|
14
|
-
s.files = ["LICENSE", "Rakefile", "README.md", "bigcommerce.gemspec", "./lib/big_commerce.rb", "./lib/bigcommerce/api.rb", "./lib/bigcommerce/connection.rb", "./lib/bigcommerce/version.rb", "./lib/bigcommerce/resource.rb", "./lib/bigcommerce/product.rb", "./lib/bigcommerce.rb", "./spec/big_commerce_spec.rb", "./spec/integration/orders_spec.rb", "./spec/spec_helper.rb", "./spec/support/integration_context.rb", "./spec/support/mock_api_context.rb", "./spec/unit/api_request_spec.rb", "./spec/unit/api_spec.rb", "./spec/unit/connection_spec.rb", "./spec/unit/date_time_spec.rb", "./spec/unit/version_spec.rb", "spec/big_commerce_spec.rb", "spec/integration/orders_spec.rb", "spec/unit/api_request_spec.rb", "spec/unit/api_spec.rb", "spec/unit/connection_spec.rb", "spec/unit/date_time_spec.rb", "spec/unit/version_spec.rb"]
|
15
|
-
s.homepage = "http://github.com/bigcommerce/bigcommerce-api-ruby"
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubygems_version = "2.1.11"
|
18
|
-
s.summary = "Enables Ruby applications to communicate with the Bigcommerce API"
|
19
|
-
s.test_files = ["spec/big_commerce_spec.rb", "spec/integration/orders_spec.rb", "spec/unit/api_request_spec.rb", "spec/unit/api_spec.rb", "spec/unit/connection_spec.rb", "spec/unit/date_time_spec.rb", "spec/unit/version_spec.rb"]
|
20
11
|
|
21
|
-
|
22
|
-
|
12
|
+
s.description = 'Bigcommerce API Ruby client library. Allows developers to \
|
13
|
+
easily communicate with the Bigcommerce API, for either CLI tools or public \
|
14
|
+
apps. More info: http://developer.bigcommerce.com'
|
15
|
+
s.summary = 'Ruby client library for the Bigcommerce v2 API'
|
16
|
+
|
17
|
+
s.required_ruby_version = '>= 1.9.3'
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
s.files = `git ls-files`.split($ORS)
|
20
|
+
s.test_files = Dir['spec/**/*.rb']
|
21
|
+
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'bundler'
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
28
|
-
s.add_development_dependency(%q<coveralls>, [">= 0"])
|
29
|
-
s.add_development_dependency(%q<ci_reporter_rspec>, [">= 0"])
|
30
|
-
s.add_development_dependency(%q<mocha>, [">= 0"])
|
31
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
32
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.11"])
|
33
|
-
s.add_development_dependency(%q<vcr>, [">= 0"])
|
34
|
-
s.add_development_dependency(%q<webmock>, ["= 1.9"])
|
35
|
-
else
|
36
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
37
|
-
s.add_dependency(%q<json>, [">= 0"])
|
38
|
-
s.add_dependency(%q<rest-client>, [">= 0"])
|
39
|
-
s.add_dependency(%q<coveralls>, [">= 0"])
|
40
|
-
s.add_dependency(%q<ci_reporter_rspec>, [">= 0"])
|
41
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
42
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
43
|
-
s.add_dependency(%q<rspec>, ["~> 2.11"])
|
44
|
-
s.add_dependency(%q<vcr>, [">= 0"])
|
45
|
-
s.add_dependency(%q<webmock>, ["= 1.9"])
|
46
|
-
end
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
49
|
-
s.add_dependency(%q<json>, [">= 0"])
|
50
|
-
s.add_dependency(%q<rest-client>, [">= 0"])
|
51
|
-
s.add_dependency(%q<coveralls>, [">= 0"])
|
52
|
-
s.add_dependency(%q<ci_reporter_rspec>, [">= 0"])
|
53
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
54
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
55
|
-
s.add_dependency(%q<rspec>, ["~> 2.11"])
|
56
|
-
s.add_dependency(%q<vcr>, [">= 0"])
|
57
|
-
s.add_dependency(%q<webmock>, ["= 1.9"])
|
58
|
-
end
|
25
|
+
s.add_dependency 'faraday'
|
26
|
+
s.add_dependency 'faraday_middleware'
|
27
|
+
s.add_dependency 'hashie'
|
59
28
|
end
|
data/examples/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# Examples
|
2
|
+
In this directory you can find examples which you may find helpful to reference in development. If you have some useful snippets, please feel free to open a PR into the appropriate file(s).
|
3
|
+
|
4
|
+
#### Resource Reference
|
5
|
+
For reference on the individual resources and the schema of the objects, please visit [developer.bigcommerce.com](https://developer.bigcommerce.com).
|
6
|
+
|
7
|
+
## Configuration
|
8
|
+
#### [Private Apps](configuration/legacy_auth.rb)
|
9
|
+
Public apps (also known as Single-Click Apps) must use OAuth authentication.
|
10
|
+
|
11
|
+
#### [Public Apps](configuration/oauth.rb)
|
12
|
+
To develop a custom integration for one store, your app needs to use Basic Authentication.
|
13
|
+
|
14
|
+
## Content
|
15
|
+
#### [Blog Posts](content/blog_post.rb)
|
16
|
+
A content entry in the store’s blog
|
17
|
+
|
18
|
+
#### [Blog Tags](content/blog_tag.rb)
|
19
|
+
Index of tags used on the store’s blog.
|
20
|
+
|
21
|
+
#### [Redirects](content/redirect.rb)
|
22
|
+
A 301 redirect, mapping from a given URL path to another URL
|
23
|
+
|
24
|
+
## Customers
|
25
|
+
#### [Customers](customers/customer.rb)
|
26
|
+
Identity and account details for customers shopping on Bigcommerce stores
|
27
|
+
|
28
|
+
#### [Customer Addresses](customers/customer_address.rb)
|
29
|
+
Postal address belonging to a Customer
|
30
|
+
|
31
|
+
#### [Customer Groups](customers/customer_group.rb)
|
32
|
+
Grouping of customers who share the same level of access and discounts at a store
|
33
|
+
|
34
|
+
## Geography
|
35
|
+
#### [Countries](geography/country.rb)
|
36
|
+
A country or territory, identifiable by an ISO 3166 country code
|
37
|
+
|
38
|
+
#### [States](geography/state.rb)
|
39
|
+
A state or province, identifiable by an ISO 3166 subdivision code
|
40
|
+
|
41
|
+
## Marketing
|
42
|
+
#### [Coupons](marketing/coupon.rb)
|
43
|
+
Applies a category or product discount to an order for customers who enter a given code
|
44
|
+
|
45
|
+
## Orders
|
46
|
+
#### [Orders](orders/order.rb)
|
47
|
+
The order object contains a record of the purchase agreement between a shopper and a merchant.
|
48
|
+
|
49
|
+
#### [Order Coupons](orders/order_coupon.rb)
|
50
|
+
Coupon code applied to an order
|
51
|
+
|
52
|
+
#### [Order Messages](orders/order_message.rb)
|
53
|
+
Messages associated with an order.
|
54
|
+
|
55
|
+
#### [Order Products](orders/order_product.rb)
|
56
|
+
Product line items associated with an order.
|
57
|
+
|
58
|
+
#### [Order Shipping Addresses](orders/order_shipping_address.rb)
|
59
|
+
Shipping addresses associated with an order.
|
60
|
+
|
61
|
+
#### [Order Statuses](orders/order_status.rb)
|
62
|
+
Statuses that can be assigned to orders. Each status represents a state in the fulfilment workflow.
|
63
|
+
|
64
|
+
#### [Order Taxes](orders/order_tax.rb)
|
65
|
+
Taxes applied to an order.
|
66
|
+
|
67
|
+
#### [Shipments](orders/shipment.rb)
|
68
|
+
Shipping package consignments tracked from an order.
|
69
|
+
|
70
|
+
## Payments
|
71
|
+
#### [Payment Methods](payments/payment_methods.rb)
|
72
|
+
Enabled payment methods.
|
73
|
+
|
74
|
+
## Products
|
75
|
+
#### [Brands](products/brand.rb)
|
76
|
+
Brand facets for identifying and categorising products according to their manufacturer or company metonym.
|
77
|
+
|
78
|
+
#### [Bulk Pricing Rules](products/bulk_pricing_rule.rb)
|
79
|
+
Bulk pricing rules applied to a product.
|
80
|
+
|
81
|
+
#### [Categories](products/category.rb)
|
82
|
+
Index of hierarchical categories used to organise and group products.
|
83
|
+
|
84
|
+
#### [Configurable Fields ](products/configurable_field.rb)
|
85
|
+
Configurable fields associated with a product.
|
86
|
+
|
87
|
+
#### [Custom Fields](products/custom_field.rb)
|
88
|
+
Custom fields associated with a product.
|
89
|
+
|
90
|
+
#### [Google Product Search Mappings](products/google_product_search_mapping.rb)
|
91
|
+
Custom fields associated with a product.
|
92
|
+
|
93
|
+
#### [Options](products/option.rb)
|
94
|
+
Shared attributes that control value facets on a product.
|
95
|
+
|
96
|
+
#### [Option Sets](products/option_set.rb)
|
97
|
+
A reusable set of option facets that can be applied to products.
|
98
|
+
|
99
|
+
#### [Option Set Options](products/option_set_option.rb)
|
100
|
+
Options belonging to an option set.
|
101
|
+
|
102
|
+
#### [Option Values](products/option_value.rb)
|
103
|
+
Values that can be selected for an option.
|
104
|
+
|
105
|
+
#### [Products](products/product.rb)
|
106
|
+
Catalog of saleable items in the store.
|
107
|
+
|
108
|
+
#### [Product Images](products/product_image.rb)
|
109
|
+
Images associated with a product.
|
110
|
+
|
111
|
+
#### [Product Options](products/product_option.rb)
|
112
|
+
Options associated directly with a product.
|
113
|
+
|
114
|
+
#### [Product Reviews](products/product_review.rb)
|
115
|
+
Reviews associated to a product.
|
116
|
+
|
117
|
+
#### [Product Rules](products/product_rule.rb)
|
118
|
+
Rules that modify the default behaviour of products.
|
119
|
+
|
120
|
+
#### [Product Videos](products/product_video.rb)
|
121
|
+
Embedded videos displayed on product listings.
|
122
|
+
|
123
|
+
#### [SKUs](products/sku.rb)
|
124
|
+
Stock Keeping Unit identifiers associated with products.
|
125
|
+
|
126
|
+
## Shipping
|
127
|
+
#### [Shipping Methods](shipping/shipping_method.rb)
|
128
|
+
List of enabled shipping methods.
|
129
|
+
|
130
|
+
## Store
|
131
|
+
#### [Store Information](store/store_info.rb)
|
132
|
+
Metadata that describes the store.
|
133
|
+
|
134
|
+
## System
|
135
|
+
#### [Time](system/time.rb)
|
136
|
+
Timestamp ping to check the system status.
|
137
|
+
|
138
|
+
## Tax
|
139
|
+
#### [Tax Classes](tax/tax_class.rb)
|
140
|
+
Applies a category or product discount to an order for customers who enter a given code
|
141
|
+
|
142
|
+
## Webhooks
|
143
|
+
#### [Webhooks](webhooks/webhook.rb)
|
144
|
+
Applies a category or product discount to an order for customers who enter a given code
|
145
|
+
|
146
|
+
## Exception Handling
|
147
|
+
#### [Exceptions](exception_handling.rb)
|
148
|
+
All the errors we will throw with a convenient method to rescue the errors and take an action for each type
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bigcommerce'
|
2
|
+
|
3
|
+
Bigcommerce.configure do |config|
|
4
|
+
config.auth = 'legacy'
|
5
|
+
# You will get this url when registering for an API key
|
6
|
+
config.url = ENV['BC_API_ENDPOINT_LEGACY']
|
7
|
+
config.username = ENV['BC_USERNAME']
|
8
|
+
config.api_key = ENV['BC_API_KEY']
|
9
|
+
end
|
10
|
+
|
11
|
+
puts Bigcommerce::System.time
|
12
|
+
puts Bigcommerce.api_limit
|
@@ -0,0 +1,39 @@
|
|
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 blog posts
|
10
|
+
@posts = Bigcommerce::BlogPost.all(page: 1)
|
11
|
+
puts @posts
|
12
|
+
|
13
|
+
# Get a blog post
|
14
|
+
puts Bigcommerce::BlogPost.find(@posts[0].id)
|
15
|
+
|
16
|
+
# Get a count of blog posts
|
17
|
+
puts Bigcommerce::BlogPost.count
|
18
|
+
|
19
|
+
# Create a blog post
|
20
|
+
@post = Bigcommerce::BlogPost.create(
|
21
|
+
title: 'Brand new producrts for sale!',
|
22
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do \
|
23
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. \
|
24
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui \
|
25
|
+
officia deserunt mollit anim id est laborum.'
|
26
|
+
)
|
27
|
+
puts @post
|
28
|
+
|
29
|
+
# Update a blog post
|
30
|
+
puts Bigcommerce::BlogPost.update(
|
31
|
+
@post.id,
|
32
|
+
title: 'Oops wrong title.'
|
33
|
+
)
|
34
|
+
|
35
|
+
# Delete a blog post
|
36
|
+
puts Bigcommerce::BlogPost.destroy(@post.id)
|
37
|
+
|
38
|
+
# Delete all blog posts
|
39
|
+
# puts Bigcommerce::BlogPost.destroy_all
|
@@ -0,0 +1,43 @@
|
|
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 redirects
|
10
|
+
@redirects = Bigcommerce::Redirect.all(page: 1)
|
11
|
+
puts @redirects
|
12
|
+
|
13
|
+
# Get a redirect
|
14
|
+
puts Bigcommerce::Redirect.find(@redirects[0].id)
|
15
|
+
|
16
|
+
# Get a count of redirects
|
17
|
+
puts Bigcommerce::Redirect.count
|
18
|
+
|
19
|
+
# Create a redirect
|
20
|
+
@redirect = Bigcommerce::Redirect.create(
|
21
|
+
path: '/womens_clothing',
|
22
|
+
forward: {
|
23
|
+
type: 'category',
|
24
|
+
ref: 3
|
25
|
+
}
|
26
|
+
)
|
27
|
+
puts @redirect
|
28
|
+
|
29
|
+
# Update a redirect
|
30
|
+
puts Bigcommerce::Redirect.update(
|
31
|
+
@redirect.id,
|
32
|
+
path: '/womens_clothing',
|
33
|
+
forward: {
|
34
|
+
type: 'category',
|
35
|
+
ref: 3
|
36
|
+
}
|
37
|
+
)
|
38
|
+
|
39
|
+
# Delete a redirect
|
40
|
+
puts Bigcommerce::Redirect.destroy(@redirect.id)
|
41
|
+
|
42
|
+
# Delete all redirects
|
43
|
+
# puts Bigcommerce::Redirect.destroy_all
|
@@ -0,0 +1,36 @@
|
|
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 customers
|
10
|
+
puts Bigcommerce::Customer.all(page: 1)
|
11
|
+
|
12
|
+
# Get a customer
|
13
|
+
puts Bigcommerce::Customer.find(1)
|
14
|
+
|
15
|
+
# Get a count of customers
|
16
|
+
puts Bigcommerce::Customer.count
|
17
|
+
|
18
|
+
# Create a customer
|
19
|
+
@customer = Bigcommerce::Customer.create(
|
20
|
+
first_name: 'Karl',
|
21
|
+
last_name: 'The Fog',
|
22
|
+
email: 'test@example.com'
|
23
|
+
)
|
24
|
+
puts @customer
|
25
|
+
|
26
|
+
# Update a customer
|
27
|
+
puts Bigcommerce::Customer.update(
|
28
|
+
@customer.id,
|
29
|
+
first_name: 'Karrrl'
|
30
|
+
)
|
31
|
+
|
32
|
+
# Delete a customer
|
33
|
+
puts Bigcommerce::Customer.destroy(@customer.id)
|
34
|
+
|
35
|
+
# Delete all customers
|
36
|
+
# puts Bigcommerce::Customer.destroy_all
|
@@ -0,0 +1,50 @@
|
|
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
|
+
@customer = Bigcommerce::Customer.all[0]
|
10
|
+
|
11
|
+
# List a customer address
|
12
|
+
@customer_addresses = Bigcommerce::CustomerAddress.all(@customer.id)
|
13
|
+
puts @customer_addresses
|
14
|
+
|
15
|
+
# Get a customer address
|
16
|
+
puts Bigcommerce::CustomerAddress.find(@customer.id, @customer_addresses[0].id)
|
17
|
+
|
18
|
+
# Get a count of customer addresses
|
19
|
+
puts Bigcommerce::CustomerAddress.count(@customer.id)
|
20
|
+
|
21
|
+
# Get a count of all customer addresses for all customers
|
22
|
+
puts Bigcommerce::CustomerAddress.count_all
|
23
|
+
|
24
|
+
# Create a customer address
|
25
|
+
@customer_address = Bigcommerce::CustomerAddress.create(
|
26
|
+
@customer.id,
|
27
|
+
first_name: 'Foo',
|
28
|
+
last_name: 'Bar',
|
29
|
+
phone: '5555555555',
|
30
|
+
street_1: '685 Market St.',
|
31
|
+
city: 'San Francisco',
|
32
|
+
state: 'California',
|
33
|
+
zip: '94019',
|
34
|
+
country: 'United States'
|
35
|
+
)
|
36
|
+
puts @customer_address
|
37
|
+
|
38
|
+
# Update a customer address
|
39
|
+
puts Bigcommerce::CustomerAddress.update(
|
40
|
+
@customer.id,
|
41
|
+
@customer_address.id,
|
42
|
+
first_name: 'Foo',
|
43
|
+
last_name: 'Bar'
|
44
|
+
)
|
45
|
+
|
46
|
+
# Delete a customer address
|
47
|
+
puts Bigcommerce::CustomerAddress.destroy(@customer.id, @customer_address.id)
|
48
|
+
|
49
|
+
# Delete all customer addresses
|
50
|
+
# puts Bigcommerce::CustomerAddress.destroy_all(@customer.id)
|