All Projects → bigcommerce → Bigcommerce Api Ruby

bigcommerce / Bigcommerce Api Ruby

Licence: mit
Connect Ruby applications with the Bigcommerce Platform

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Bigcommerce Api Ruby

xing-android-sdk
The Official XING API client for Java/Android
Stars: ✭ 33 (-52.17%)
Mutual labels:  oauth, api-client
Httpie Oauth
OAuth plugin for HTTPie
Stars: ✭ 78 (+13.04%)
Mutual labels:  api-client, oauth
youtube-deno
A Deno client library of the YouTube Data API.
Stars: ✭ 30 (-56.52%)
Mutual labels:  oauth, api-client
Twitch4j
Modular Async/Sync/Reactive Twitch API Client / IRC Client
Stars: ✭ 209 (+202.9%)
Mutual labels:  api-client, oauth
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+1053.62%)
Mutual labels:  api-client, oauth
Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+1485.51%)
Mutual labels:  oauth
Oauth
OAuth 2.0 Authorization Server & Authorization Middleware for Gin-Gonic
Stars: ✭ 61 (-11.59%)
Mutual labels:  oauth
Api Php Client
PHP client of Akeneo PIM API
Stars: ✭ 56 (-18.84%)
Mutual labels:  api-client
Quandl Python
Stars: ✭ 1,076 (+1459.42%)
Mutual labels:  api-client
Chump
The Best API Wrapper for Pushover.
Stars: ✭ 67 (-2.9%)
Mutual labels:  api-client
Ohloh api
Ohloh API examples
Stars: ✭ 64 (-7.25%)
Mutual labels:  oauth
React Native Learning Resources
Collection of some good resources for react-native ✨ 🔥 💥
Stars: ✭ 61 (-11.59%)
Mutual labels:  oauth
Groupy
A simple yet powerful API wrapper for the GroupMe messaging service.
Stars: ✭ 57 (-17.39%)
Mutual labels:  api-client
Redux Api Call
One declarative API to create reducers, action creators and selectors for any API calls
Stars: ✭ 63 (-8.7%)
Mutual labels:  api-client
Netcore Postgres Oauth Boiler
A basic .NET Core website boilerplate using PostgreSQL for storage, Adminer for db management, Let's Encrypt for SSL certificates and NGINX for routing.
Stars: ✭ 57 (-17.39%)
Mutual labels:  oauth
Igdb
Go client for the Internet Game Database API
Stars: ✭ 65 (-5.8%)
Mutual labels:  api-client
Github
Ruby interface to GitHub API
Stars: ✭ 1,081 (+1466.67%)
Mutual labels:  api-client
Mvvmdemo
MVVMDemo With ReactiveCocoa
Stars: ✭ 60 (-13.04%)
Mutual labels:  api-client
Slacko
A neat interface for Slack
Stars: ✭ 64 (-7.25%)
Mutual labels:  api-client
Somfy Open Api
REST API client for the Somfy Open API
Stars: ✭ 59 (-14.49%)
Mutual labels:  api-client

BigCommerce API Ruby

Gem Version Build Status Dependency Status

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.

Installation

BigCommerce is available on RubyGems.

gem install bigcommerce

You can also add it to your Gemfile.

gem 'bigcommerce', '~> 1.0'

Requirements

  • Ruby 2.0.0 or newer. Please refer to the .travis.yml to see which versions we officially support.

Getting Started

To make requests to our API, you must register as a developer and have your credentials ready.

Also very important: For the OAuth authentication mechanism, the resources to which you have acccess depend on the scopes that the merchant has granted to your application. For more information about Store API scopes, see: OAuth Scopes.

Authentication

We currently have two different authentication schemes that you can select, depending on your use case.

OAuth

OAuth apps can be submitted to BigCommerce App Store, allowing other merchants to install these apps in their BigCommerce stores.

More Information

Basic Authentication (Legacy)

To develop a custom integration for one store, your app needs to use Basic Authentication.

More Information

Configuration

To authenticate your API client, you will need to configure the client like the following examples.

OAuth App

  • client_id: Obtained from the on the BigCommerce Developer Portal's "My Apps" section.
  • access_token: Obtained after a token exchange in the auth callback.
  • store_hash: Also obtained after the token exchange.
Bigcommerce.configure do |config|
  config.store_hash = ENV['BC_STORE_HASH']
  config.client_id = ENV['BC_CLIENT_ID']
  config.access_token = ENV['BC_ACCESS_TOKEN']
end

Basic Authentication (Legacy)

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 on which to authenticate.

Bigcommerce.configure do |config|
  config.auth = 'legacy'
  config.url = ENV['BC_API_ENDPOINT_LEGACY']
  config.username = ENV['BC_USERNAME']
  config.api_key = ENV['BC_API_KEY']
end

SSL Configuration

If you are using your own, self-signed, certificate, you can pass SSL options to Faraday. This is not required, but might be useful in special edge cases.

Bigcommerce.configure do |config|
  config.auth = 'legacy'
  config.url = 'https://api_path.com'
  config.username = 'username'
  config.api_key = 'api_key'
  config.ssl = {
    # Faraday options here
  }
end

For more information about configuring SSL with Faraday, please see the following:

Customer Login API

If you want to generate tokens for storefront login using the Customer Login API, you need to configure your app's client secret.

  • store_hash: The store hash of the store you are operating against.
  • client_id: Obtained from the on the BigCommerce Developer Portal's "My Apps" section.
  • client_secret: Obtained from the on the BigCommerce Developer Portal's "My Apps" section.
Bigcommerce.configure do |config|
  config.store_hash = ENV['BC_STORE_HASH']
  config.client_id = ENV['BC_CLIENT_ID']
  config.client_secret = ENV['BC_CLIENT_SECRET']
end

Usage

For full examples of using the API client, please see the examples folder and refer to BigCommerce's developer documentation.

Example:

# Configure the client to talk to a given store
Bigcommerce.configure do |config|
  config.store_hash = ENV['BC_STORE_HASH']
  config.client_id = ENV['BC_CLIENT_ID']
  config.access_token = ENV['BC_ACCESS_TOKEN']
end

# Make an API request for a given resource
Bigcommerce::System.time
=> #<Bigcommerce::System time=1466801314>

Thread Safety

The Bigcommerce.configure method is NOT thread-safe. This mechanism is designed for applications or CLI's (command-line interfaces) where thread safety is not a concern. If you need to guarantee thread safety, we support this alternative mechanism to make thread-safe API requests:

Rather then setting up a single connection for all API requests, you would construct a new connection for each thread. If you can ensure that each of these connections is stored in a thread-safe manner, you can pass the connection as you query the resource.

This connection is nothing more than a Faraday::Connection – so if you want to write your own, or to use your own adapters, you can feel free. Please refer to this gem's connection class for more details.

OAuth
connection = Bigcommerce::Connection.build(
  Bigcommerce::Config.new(
    store_hash: ENV['BC_STORE_HASH'],
    client_id: ENV['BC_CLIENT_ID'],
    access_token: ENV['BC_ACCESS_TOKEN']
  )
)
=> #<Faraday::Connection:0x007fbf95068978 ... >>

Bigcommerce::System.time(connection: connection)
=> #<Bigcommerce::System time=1466546702>

Bigcommerce::System.raw_request(:get, 'time', connection: connection)
=> #<Faraday::Response:0x007fd4a4063170 ... >>
Basic Auth
connection_legacy = Bigcommerce::Connection.build(
  Bigcommerce::Config.new(
    auth: 'legacy',
    url: ENV['BC_API_ENDPOINT_LEGACY'],
    username: ENV['BC_USERNAME'],
    api_key: ENV['BC_API_KEY']
  )
)
=> #<Faraday::Connection:0x007fbf95068978 ... >>

Bigcommerce::System.time(connection: connection_legacy)
=> #<Bigcommerce::System time=1466546702>

Bigcommerce::System.raw_request(:get, 'time', connection: connection_legacy)
=> #<Faraday::Response:0x007fd4a4063170 ... >>

Contributing

See CONTRIBUTING.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].