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/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
## Next Release
|
2
|
+
|
3
|
+
* Your contribution here.
|
4
|
+
|
5
|
+
## 1.0.0
|
6
|
+
Please note that this is the start of a new major release which breaks all backward compatibility.
|
7
|
+
|
8
|
+
* [#89](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/89): Complete rewrite of Bigcommerce API Client. - [@pedelman](https://github.com/pedelman).
|
9
|
+
|
10
|
+
## 0.x (Legacy)
|
11
|
+
For the old version of the API Client please view the [0.x branch](https://github.com/bigcommerce/bigcommerce-api-ruby/tree/0.x).
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# Contributing to Bigcommerce
|
2
|
+
|
3
|
+
|
4
|
+
We would love to see contributors! You're encouraged to submit [pull requests](https://github.com/bigcommerce/bigcommerce-api-ruby/pulls), [propose features, and discuss issues](https://github.com/bigcommerce/bigcommerce-api-ruby/issues).
|
5
|
+
|
6
|
+
#### Fork the Project
|
7
|
+
|
8
|
+
Fork the [project on Github](https://github.com/bigcommerce/bigcommerce-api-ruby) and check out your copy.
|
9
|
+
|
10
|
+
```
|
11
|
+
git clone your_forked_version_of_bigcommerce_api_ruby
|
12
|
+
cd bigcommerce-api-ruby
|
13
|
+
git remote add upstream https://github.com/bigcommerce/bigcommerce-api-ruby.git
|
14
|
+
```
|
15
|
+
|
16
|
+
#### Create a Feature Branch
|
17
|
+
|
18
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
19
|
+
|
20
|
+
```
|
21
|
+
git checkout master
|
22
|
+
git pull upstream master
|
23
|
+
git checkout -b my-feature-branch
|
24
|
+
```
|
25
|
+
|
26
|
+
#### Bundle Install and Test
|
27
|
+
|
28
|
+
Ensure that you can build the project and run tests.
|
29
|
+
|
30
|
+
```
|
31
|
+
bundle install
|
32
|
+
bundle exec rake
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Installing the gem locally (useful to run examples)
|
36
|
+
|
37
|
+
This will build the gem locally into the pkg directory, you can then install it manually by targeting that directory specifically.
|
38
|
+
|
39
|
+
```
|
40
|
+
bundle exec rake build
|
41
|
+
gem install pkg/bigcommerce-1.x.x.gem
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Write Tests
|
45
|
+
|
46
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/bigcommerce](spec/bigcommerce).
|
47
|
+
|
48
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
49
|
+
|
50
|
+
#### Write Code
|
51
|
+
|
52
|
+
Implement your feature or bug fix.
|
53
|
+
|
54
|
+
Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
|
55
|
+
|
56
|
+
Make sure that `bundle exec rake` completes without errors.
|
57
|
+
|
58
|
+
#### Write Documentation
|
59
|
+
|
60
|
+
Document any external behavior in the [README](README.md).
|
61
|
+
|
62
|
+
#### Update Changelog
|
63
|
+
|
64
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
|
65
|
+
|
66
|
+
#### Commit Changes
|
67
|
+
|
68
|
+
Make sure git knows your name and email address:
|
69
|
+
|
70
|
+
```
|
71
|
+
git config --global user.name "Your Name"
|
72
|
+
git config --global user.email "contributor@example.com"
|
73
|
+
```
|
74
|
+
|
75
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
76
|
+
|
77
|
+
```
|
78
|
+
git add ...
|
79
|
+
git commit
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Push
|
83
|
+
|
84
|
+
```
|
85
|
+
git push origin my-feature-branch
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Make a Pull Request
|
89
|
+
|
90
|
+
Go to https://github.com/contributor/bigcommerce-api-ruby and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
91
|
+
|
92
|
+
#### Rebase
|
93
|
+
|
94
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
95
|
+
|
96
|
+
```
|
97
|
+
git fetch upstream
|
98
|
+
git rebase upstream/master
|
99
|
+
git push origin my-feature-branch -f
|
100
|
+
```
|
101
|
+
|
102
|
+
#### Update CHANGELOG Again
|
103
|
+
|
104
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
105
|
+
|
106
|
+
```
|
107
|
+
* [#123](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/123): Added products resource - [@contributor](https://github.com/contributor).
|
108
|
+
```
|
109
|
+
|
110
|
+
Amend your previous commit and force push the changes.
|
111
|
+
|
112
|
+
```
|
113
|
+
git commit --amend
|
114
|
+
git push origin my-feature-branch -f
|
115
|
+
```
|
116
|
+
|
117
|
+
#### Check on Your Pull Request
|
118
|
+
|
119
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
data/DEPENDENCIES.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
### Bigcommerce 💙 Open Source
|
2
|
+
|
3
|
+
Many thanks to the contributors and authors of the following libraries!
|
4
|
+
|
5
|
+
- [Faraday](https://github.com/lostisland/faraday) Simple, but flexible HTTP client library, with support for multiple backends. - [MIT](https://github.com/lostisland/faraday/blob/master/LICENSE.md)
|
6
|
+
- [Faraday Middleware](https://github.com/lostisland/faraday_middleware) Various Faraday middlewares for Faraday-based API wrappers. - [MIT](https://github.com/lostisland/faraday_middleware/blob/master/LICENSE.md)
|
7
|
+
- [Hashie](https://github.com/intridea/hashie) Hashie is a collection of classes and mixins that make hashes more powerful. - [MIT](https://github.com/intridea/hashie/blob/master/LICENSE)
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
guard 'rspec', all_on_start: false, cmd: 'bundle exec rspec' do
|
2
|
+
# Watch spec directory
|
3
|
+
watch(/^spec\/.+_spec\.rb/)
|
4
|
+
|
5
|
+
# Watch lib/*.rb
|
6
|
+
watch(/^lib\/(.+)\.rb/) do |m|
|
7
|
+
"spec/bigcommerce/#{m[1]}_spec.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Watch lib/bigcommerce/*.rb
|
11
|
+
watch(%r{^lib/bigcommerce/(.+).rb$}) do |m|
|
12
|
+
"spec/bigcommerce/unit/#{m[1]}_spec.rb"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Watch lib/bigcommerce/(middleware|resources)/*.rb
|
16
|
+
watch(%r{^lib/bigcommerce/(middleware|resources)/(.+).rb$}) do |m|
|
17
|
+
"spec/bigcommerce/unit/#{m[1]}/#{m[2]}_spec.rb"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Watch spec_helper
|
21
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
22
|
+
end
|
data/LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
Copyright (C) Bigcommerce, 2015.
|
2
2
|
All rights reserved.
|
3
3
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
of this software and associated documentation files (the "Software"),
|
6
|
-
in the Software without restriction, including without limitation
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
furnished to do so, subject to the following conditions:
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the "Software"),
|
6
|
+
to deal in the Software without restriction, including without limitation
|
7
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following conditions:
|
10
10
|
|
11
|
-
The above copyright notice and this permission notice shall be included
|
12
|
-
all copies or substantial portions of the Software.
|
11
|
+
The above copyright notice and this permission notice shall be included
|
12
|
+
in all copies or substantial portions of the Software.
|
13
13
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
20
|
-
THE SOFTWARE.
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
16
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
20
|
+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Bigcommerce
|
1
|
+
# Bigcommerce
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/bigcommerce.png)](https://rubygems.org/gems/bigcommerce)
|
4
4
|
[![Build Status](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby.png?branch=master)](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby)
|
@@ -6,104 +6,95 @@
|
|
6
6
|
[![Code Climate](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby.png)](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby)
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/bigcommerce/bigcommerce-api-ruby/badge.png?branch=master)](https://coveralls.io/r/bigcommerce/bigcommerce-api-ruby?branch=master)
|
8
8
|
|
9
|
-
This
|
10
|
-
Ruby apps or via the console.
|
9
|
+
This is the official Bigcommerce API client to support our Rest API. You can find more information about becoming a Bigcommerce developer here: [developer.bigcommerce.com](http://developer.bigcommerce.com).
|
11
10
|
|
12
|
-
|
11
|
+
#### ⚠️ A note about the current client: ⚠️
|
12
|
+
This is a preview release of the 1.0.0 version of the Bigcommerce API Client. Please report issues if they come up.
|
13
13
|
|
14
|
-
If you
|
15
|
-
it and submit a changes with your pull request.
|
14
|
+
We have introduced a new major version of the API client and it is a complete rewrite (for the better). If you want to see the old version of the API client, please view it here: [Bigcommerce API client v0.x](https://github.com/bigcommerce/bigcommerce-api-ruby/tree/0.x). We recommend that developers upgrade to the latest client, but we will still support our developers who are unable to upgrade.
|
16
15
|
|
17
|
-
## Requirements
|
18
16
|
|
19
|
-
|
17
|
+
## Installation
|
18
|
+
Bigcommerce is available on Rubygems:
|
20
19
|
|
21
|
-
|
20
|
+
```sh
|
21
|
+
gem install bigcommerce --pre
|
22
|
+
```
|
22
23
|
|
23
|
-
|
24
|
+
You can also add it to your Gemfile.
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
```rb
|
27
|
+
gem 'bigcommerce', '>= 1.0.0.beta'
|
28
|
+
```
|
28
29
|
|
29
|
-
|
30
|
+
## Getting Started
|
31
|
+
In order to make requests to our API, you must register as a developer and have your credentials ready.
|
30
32
|
|
31
|
-
|
32
|
-
- Username of an authorized admin user of the store
|
33
|
-
- API key for the user
|
33
|
+
We currently have two different authentication schemes you can use depending on your use-case.
|
34
34
|
|
35
|
-
|
35
|
+
#### Public Apps
|
36
|
+
Public apps can be submitted to Bigcommerce App Store, allowing other businesses to install it in their Bigcommerce stores.
|
36
37
|
|
37
|
-
|
38
|
+
[More Information](https://developer.bigcommerce.com/api/using-oauth-intro)
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
#### Private Apps
|
41
|
+
To develop a custom integration for one store, your app needs to use Basic Authentication.
|
41
42
|
|
42
|
-
|
43
|
-
gem install bigcommerce
|
44
|
-
```
|
43
|
+
[More Information](https://developer.bigcommerce.com/api/legacy/basic-auth)
|
45
44
|
|
46
|
-
##
|
45
|
+
## Usage
|
46
|
+
For full examples on using the API client, please see the [examples folder](examples).
|
47
47
|
|
48
|
-
|
48
|
+
## Configuration
|
49
|
+
In order to authenticate the API client, you will need to configure the client like this:
|
49
50
|
|
50
|
-
|
51
|
+
#### Single Click (Public Apps):
|
51
52
|
|
52
|
-
|
53
|
-
|
53
|
+
- ```client_id```: Obtained from the "My Apps" section on the [developer portal](http://developer.bigcommerce.com).
|
54
|
+
- ```access_token```: Obtained after a token exchange in the auth callback.
|
55
|
+
- ```store_hash```: Also obtained after the token exchange.
|
54
56
|
|
55
57
|
```rb
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
:access_token => 'ACCESS_TOKEN'
|
62
|
-
})
|
58
|
+
Bigcommerce.configure do |config|
|
59
|
+
config.store_hash = 'store_hash'
|
60
|
+
config.client_id = 'client_id'
|
61
|
+
config.access_token = 'access_token'
|
62
|
+
end
|
63
63
|
```
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
#### Legacy Credentials
|
65
|
+
#### Private Apps:
|
68
66
|
|
69
|
-
To
|
67
|
+
To get all the private app credentials, simply visit your store admin page and navigate to the Settings > Legacy API Settings. Once there, you can create a new username to authenticate with.
|
70
68
|
|
71
69
|
```rb
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
})
|
70
|
+
Bigcommerce.configure do |config|
|
71
|
+
config.auth = 'legacy'
|
72
|
+
config.url = 'https://api_path.com'
|
73
|
+
config.username = 'username'
|
74
|
+
config.api_key = 'api_key'
|
75
|
+
end
|
79
76
|
```
|
80
77
|
|
81
|
-
|
78
|
+
__SSL Configuration:__
|
82
79
|
|
83
|
-
|
84
|
-
require 'bigcommerce'
|
85
|
-
|
86
|
-
api = Bigcommerce::Api.new({
|
87
|
-
:store_url => "https://store.mybigcommerce.com",
|
88
|
-
:username => "username",
|
89
|
-
:api_key => "api_key",
|
90
|
-
:ssl_client_cert => OpenSSL::X509::Certificate.new(File.read("cert.pem")),
|
91
|
-
:ssl_client_key => OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any"),
|
92
|
-
:ssl_ca_file => "ca_certificate.pem",
|
93
|
-
:verify_ssl => OpenSSL::SSL::VERIFY_PEER
|
94
|
-
})
|
95
|
-
```
|
96
|
-
Remember that the fields `:ssl_client_cert`, `:ssl_client_key`, `:ssl_ca_file`
|
97
|
-
and `:verify_ssl` are all required when enabling SSL certificates.
|
98
|
-
|
99
|
-
## Connecting to the store
|
100
|
-
|
101
|
-
Once you have authenticated with the OAuth or Legacy credentials, ping the time method to check that your configuration is working and you can connect successfully to the store:
|
80
|
+
If you are using your own self-signed certificate, you can pass SSL options to Faraday. This is not required, but may be useful in special edge cases.
|
102
81
|
|
103
82
|
```rb
|
104
|
-
|
83
|
+
Bigcommerce.configure do |config|
|
84
|
+
config.auth = 'legacy'
|
85
|
+
config.url = 'https://api_path.com'
|
86
|
+
config.username = 'username'
|
87
|
+
config.api_key = 'api_key'
|
88
|
+
config.ssl = {
|
89
|
+
# Faraday options here
|
90
|
+
}
|
91
|
+
end
|
105
92
|
```
|
106
93
|
|
107
|
-
|
94
|
+
For more information about configuring SSL with Faraday, please see the following:
|
95
|
+
|
96
|
+
- [Faraday SSL example](https://gist.github.com/mislav/938183)
|
97
|
+
- [Setting up SSL certificates](https://github.com/lostisland/faraday/wiki/Setting-up-SSL-certificates)
|
108
98
|
|
109
|
-
|
99
|
+
## Contributing
|
100
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
data/RELEASING.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Releasing Bigcommerce API Client
|
2
|
+
|
3
|
+
There're no particular rules about when to release the Bigcommerce API client. Release bug fixes frequently, features not so frequently, and breaking API changes rarely.
|
4
|
+
|
5
|
+
### Before A Release
|
6
|
+
|
7
|
+
Run tests, check that all tests succeed locally.
|
8
|
+
|
9
|
+
```sh
|
10
|
+
bundle install
|
11
|
+
bundle exec rake
|
12
|
+
```
|
13
|
+
|
14
|
+
This will ensure both style and that all the specs pass locally. Next, check that the last build succeeded in [Travis CI](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby) for all supported platforms.
|
15
|
+
|
16
|
+
Increment the version, modify [lib/bigcommerce/version.rb](lib/bigcommerce/version.rb).
|
17
|
+
|
18
|
+
* Increment the third number (minor version) if the release has bug fixes and/or very minor features, only (eg. change `1.0.1` to `1.0.2`).
|
19
|
+
* Increment the second number (patch version) if the release contains major features or breaking API changes (eg. change `1.0.10` to `1.1.0`).
|
20
|
+
|
21
|
+
Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
|
22
|
+
|
23
|
+
```markdown
|
24
|
+
1.1.0 (4/13/2015)
|
25
|
+
=================
|
26
|
+
```
|
27
|
+
|
28
|
+
Commit your changes.
|
29
|
+
|
30
|
+
```sh
|
31
|
+
git add CHANGELOG.md lib/bigcommerce/version.rb
|
32
|
+
git commit -m "Preparing for release, 1.1.0."
|
33
|
+
git push origin master
|
34
|
+
```
|
35
|
+
|
36
|
+
### Release 🎉
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ rake release
|
40
|
+
|
41
|
+
bigcommerce 1.1.0 built to pkg/bigcommerce-1.1.0.gem.
|
42
|
+
Tagged v1.1.0.
|
43
|
+
Pushed git commits and tags.
|
44
|
+
Pushed bigcommerce 1.1.0 to rubygems.org.
|
45
|
+
```
|
46
|
+
|
47
|
+
### Prepare for the Next Version
|
48
|
+
|
49
|
+
Add the next release to [CHANGELOG.md](CHANGELOG.md).
|
50
|
+
|
51
|
+
```markdown
|
52
|
+
Next Release
|
53
|
+
============
|
54
|
+
|
55
|
+
* Your contribution here.
|
56
|
+
```
|
57
|
+
|
58
|
+
Commit your changes.
|
59
|
+
|
60
|
+
```sh
|
61
|
+
git add CHANGELOG.md README.md
|
62
|
+
git commit -m "Preparing for next release."
|
63
|
+
git push origin master
|
64
|
+
```
|