Skip to content

Commit c2eaf31

Browse files
authored
Merge pull request #125 from pedelman/readme_changelog
Update the README and CHANGELOG
2 parents cdc661c + 8e21e7d commit c2eaf31

File tree

3 files changed

+113
-39
lines changed

3 files changed

+113
-39
lines changed

Diff for: CHANGELOG.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
## Next Release
2+
Your contribution here.
23

3-
* Your contribution here.
4-
* [#101](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/101): Fix #100 when exception and env.body is a string. - [@gregory](https://github.com/gregory).
4+
* [#000](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/000): Brief description here. - [@username](https://github.com/username).
55

66
## 1.0.0
77
Please note that this is the start of a new major release which breaks all backward compatibility.
88

9+
* [#123](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/123): Add thread safe method to query resources - [@pedelman](https://github.com/pedelman).
10+
* [#121](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/121): Update product resources and examples - [@pedelman](https://github.com/pedelman).
11+
* [#122](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/122): Update order resources and examples - [@pedelman](https://github.com/pedelman).
12+
* [#120](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/120): Add attributes to store information resource - [@pedelman](https://github.com/pedelman).
13+
* [#119](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/119): Update customer address - [@pedelman](https://github.com/pedelman).
14+
* [#117](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/117): Update banner example - [@pedelman](https://github.com/pedelman).
15+
* [#118](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/118): Update gift certificate example - [@pedelman](https://github.com/pedelman).
16+
* [#116](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/116): Update BlogTag resource - [@pedelman](https://github.com/pedelman).
17+
* [#115](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/115): Update BlogPost resource - [@pedelman](https://github.com/pedelman).
18+
* [#113](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/113): Update SKU resource per developer docs - [@pedelman](https://github.com/pedelman).
19+
* [#103](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/103): Add banner & gift cert resources - [@bc-AlyssNoland](https://github.com/bc-AlyssNoland).
20+
* [#101](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/101): Fix #100 when exception and env.body is a string. - [@gregory](https://github.com/gregory).
921
* [#89](https://github.com/bigcommerce/bigcommerce-api-ruby/pull/89): Complete rewrite of Bigcommerce API Client. - [@pedelman](https://github.com/pedelman).
1022

1123
## 0.x (Legacy)

Diff for: README.md

+98-36
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,77 @@
1-
# Bigcommerce
1+
# BigCommerce API Ruby
22

3-
[![Gem Version](https://badge.fury.io/rb/bigcommerce.png)](https://rubygems.org/gems/bigcommerce)
4-
[![Build Status](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby.png?branch=master)](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby)
5-
[![Dependency Status](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby.png?travis)](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby)
6-
[![Code Climate](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby.png)](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby)
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)
3+
[![Gem Version](https://badge.fury.io/rb/bigcommerce.svg)](https://rubygems.org/gems/bigcommerce)
4+
[![Build Status](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby.svg?branch=master)](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby)
5+
[![Dependency Status](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby.svg?travis)](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby)
86

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).
10-
11-
#### :warning: A note about the current client: :warning:
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-
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.
7+
This is the official BigCommerce API client to support our Stores API. You can find more information about becoming a BigCommerce developer here: [developer.bigcommerce.com](http://developer.bigcommerce.com).
158

169

1710
## Installation
18-
Bigcommerce is available on Rubygems:
11+
BigCommerce is available on [RubyGems](https://rubygems.org/gems/bigcommerce).
1912

2013
```sh
21-
gem install bigcommerce --pre
14+
gem install bigcommerce
2215
```
2316

2417
You can also add it to your Gemfile.
2518

2619
```rb
27-
gem 'bigcommerce', '>= 1.0.0.beta'
20+
gem 'bigcommerce', '~> 1.0.0'
2821
```
2922

23+
## Requirements
24+
- Ruby 2.0.0 or newer. Please refer to the `.travis.yml` to see which versions we officially support.
25+
3026
## Getting Started
31-
In order to make requests to our API, you must register as a developer and have your credentials ready.
27+
In order to make requests to our API, you must register as a developer and have your credentials ready.
3228

33-
We currently have two different authentication schemes you can use depending on your use-case.
29+
Its also very important to note that for the OAuth authentication mechanism, the resources you have acccess to depend on the scopes which your application has been granted by the merchant. For more information about the Store API scopes, see: [OAuth Scopes](https://developer.bigcommerce.com/api/scopes).
3430

35-
#### Public Apps
36-
Public apps can be submitted to Bigcommerce App Store, allowing other businesses to install it in their Bigcommerce stores.
31+
## Authentication
32+
We currently have two different authentication schemes you can use depending on your use case.
3733

38-
[More Information](https://developer.bigcommerce.com/api/using-oauth-intro)
34+
### OAuth
35+
OAuth apps can be submitted to [BigCommerce App Store](https://www.bigcommerce.com/apps), allowing other merchants to install it in their BigCommerce store.
3936

40-
#### Private Apps
41-
To develop a custom integration for one store, your app needs to use Basic Authentication.
37+
__[More Information](https://developer.bigcommerce.com/api/using-oauth-intro)__
4238

43-
[More Information](https://developer.bigcommerce.com/api/legacy/basic-auth)
39+
### Basic Authentication (Legacy)
40+
To develop a custom integration for one store, your app needs to use Basic Authentication.
4441

45-
## Usage
46-
For full examples on using the API client, please see the [examples folder](examples).
42+
__[More Information](https://developer.bigcommerce.com/api/legacy/basic-auth)__
4743

4844
## Configuration
49-
In order to authenticate the API client, you will need to configure the client like this:
45+
In order to authenticate the API client, you will need to configure the client like the following.
5046

51-
#### Single Click (Public Apps):
47+
### OAuth App
5248

5349
- ```client_id```: Obtained from the "My Apps" section on the [developer portal](http://developer.bigcommerce.com).
5450
- ```access_token```: Obtained after a token exchange in the auth callback.
5551
- ```store_hash```: Also obtained after the token exchange.
5652

5753
```rb
5854
Bigcommerce.configure do |config|
59-
config.store_hash = 'store_hash'
60-
config.client_id = 'client_id'
61-
config.access_token = 'access_token'
55+
config.store_hash = ENV['BC_STORE_HASH']
56+
config.client_id = ENV['BC_CLIENT_ID']
57+
config.access_token = ENV['BC_ACCESS_TOKEN']
6258
end
6359
```
6460

65-
#### Private Apps:
61+
### Basic Authentication (Legacy)
6662

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.
63+
To get all the basic auth credentials, simply visit your store admin page and navigate to the `Advanced Settings > Legacy API Settings`. Once there, you can create a new legacy api account to authenticate with.
6864

6965
```rb
7066
Bigcommerce.configure do |config|
7167
config.auth = 'legacy'
72-
config.url = 'https://api_path.com'
73-
config.username = 'username'
74-
config.api_key = 'api_key'
68+
config.url = ENV['BC_API_ENDPOINT_LEGACY']
69+
config.username = ENV['BC_USERNAME']
70+
config.api_key = ENV['BC_API_KEY']
7571
end
7672
```
7773

78-
__SSL Configuration:__
74+
__SSL Configuration__
7975

8076
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.
8177

@@ -96,5 +92,71 @@ For more information about configuring SSL with Faraday, please see the followin
9692
- [Faraday SSL example](https://gist.github.com/mislav/938183)
9793
- [Setting up SSL certificates](https://github.com/lostisland/faraday/wiki/Setting-up-SSL-certificates)
9894

95+
96+
## Usage
97+
For full examples on using the API client, please see the [examples folder](examples) and refer to the [developer documentation](https://developer.bigcommerce.com/api).
98+
99+
Example:
100+
101+
```rb
102+
# Configure the client to talk to a given store
103+
Bigcommerce.configure do |config|
104+
config.store_hash = ENV['BC_STORE_HASH']
105+
config.client_id = ENV['BC_CLIENT_ID']
106+
config.access_token = ENV['BC_ACCESS_TOKEN']
107+
end
108+
109+
# Make an API request for a given resource
110+
Bigcommerce::System.time
111+
=> #<Bigcommerce::System time=1466801314>
112+
```
113+
114+
### Thread Safety
115+
116+
The `Bigcommerce.configure` method is NOT thread safe. This mechanism is designed for applications or cli where thread safety is not a concern. If you need to guarantee thread safety, we support another mechanism to make threadsafe API requests.
117+
118+
Rather then setting up a single `connection` for all API requests, you will want to construct a new connection for each thread. If you can make sure that each of these connections is stored in a thread safe manner, you can pass the `connection` as you query the resource.
119+
120+
This connection is nothing more than a `Faraday::Connection` so if you want to write your own, or use your own adapers, you can feel free. Please refer to the [connection class](https://github.com/bigcommerce/bigcommerce-api-ruby/blob/master/lib/bigcommerce/connection.rb) for more details.
121+
122+
##### OAuth
123+
124+
```rb
125+
connection = Bigcommerce::Connection.build(
126+
Bigcommerce::Config.new(
127+
store_hash: ENV['BC_STORE_HASH'],
128+
client_id: ENV['BC_CLIENT_ID'],
129+
access_token: ENV['BC_ACCESS_TOKEN']
130+
)
131+
)
132+
=> #<Faraday::Connection:0x007fbf95068978 ... >>
133+
134+
Bigcommerce::System.time(connection: connection)
135+
=> #<Bigcommerce::System time=1466546702>
136+
137+
Bigcommerce::System.raw_request(:get, 'time', connection: connection)
138+
=> #<Faraday::Response:0x007fd4a4063170 ... >>
139+
```
140+
141+
##### Basic Auth
142+
143+
```rb
144+
connection_legacy = Bigcommerce::Connection.build(
145+
Bigcommerce::Config.new(
146+
auth: 'legacy',
147+
url: ENV['BC_API_ENDPOINT_LEGACY'],
148+
username: ENV['BC_USERNAME'],
149+
api_key: ENV['BC_API_KEY']
150+
)
151+
)
152+
=> #<Faraday::Connection:0x007fbf95068978 ... >>
153+
154+
Bigcommerce::System.time(connection: connection_legacy)
155+
=> #<Bigcommerce::System time=1466546702>
156+
157+
Bigcommerce::System.raw_request(:get, 'time', connection: connection_legacy)
158+
=> #<Faraday::Response:0x007fd4a4063170 ... >>
159+
```
160+
99161
## Contributing
100162
See [CONTRIBUTING.md](CONTRIBUTING.md)

Diff for: lib/bigcommerce/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Bigcommerce
2-
VERSION = '1.0.0.beta'.freeze
2+
VERSION = '1.0.0'.freeze
33
end

0 commit comments

Comments
 (0)