Giter Club home page Giter Club logo

bigcommerce-api-ruby's Introduction

BigCommerce API V2 - Ruby Client

This library provides a wrapper around the BigCommerce REST API for use within Ruby apps or via the console.

Note

The Ruby Client is still in alpha and core features of the API may be unsupported and undocumented.

Requirements

  • Ruby 1.8.7+
  • Rubygems
  • JSON

To connect to the API, you need the following credentials:

  • Secure URL pointing to a BigCommerce store
  • Username of an authorized admin user of the store
  • API key for the user

A valid API key is required to authenticate requests. To grant API access for user, go to Control Panel > Users > Edit User and make sure that the 'Enable the XML API?' checkbox is ticked.

Installation

Download the lib folder and copy it to a path accessible within your app, or install the package directly from Rubygems:

gem install bigcommerce

Configuration

To use the API client in your Ruby code, provide the required credentials as follows:

require 'bigcommerce'

api = BigCommerce::Api.new({
	:store_url => "https://store.mybigcommerce.com",
	:username  => "admin",
	:api_key   => "d81aada4c19c34d913e18f07fd7f36ca"
})

Connecting to the store

Ping the get_time method to check that your configuration is working and you can connect successfully to the store:

ping = api.get_time

Usage

The API object acts as a gateway to all top level resources in the V2 API.

$ irb
>
> api = BigCommerce::Api.new(...)
>
> api.get_products.each { |product| puts product.name }
>
> api.get_customers.each { |customer| puts customer.email }
>
> puts api.get_orders_count
>
> category = api.get_category(11)
> category.name = "Laptops"
> category.update
>
> brand = BigCommerce::Api::Brand.new
> brand.name = "Samsung"
> brand.create
>
> option = api.get_option(22)
> option.delete
>

bigcommerce-api-ruby's People

Contributors

maetl avatar mikelarkin avatar winfred avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.