Code Monkey home page Code Monkey logo

bigcommerce_api's Introduction

Bigcommerce API (V2) Client

Full featured Ruby Gem to connect to the Big Commerce API. Similar to the the official gem by Bigcommerce, but with more Ruby-like syntax, allowing you to interact with Ruby objects (with familiar find and save methods) instead of hashes.

Additionally, it is compatible with the new OAuth authentication.

Developed and maintained by Whiplash Merchandising.

Requirements

  • Ruby 1.8.7+
  • Rubygems
  • JSON
  • ActiveSupport 2.3.5+
  • Httparty

A valid username, API key, and store URL OR app client id, OAuth token, and store hash/id are required to authenticate requests.

Installation

git clone git://github.com/ideaoforder/bigcommerce_api.git
cd bigcommerce_api
rake install

Or if you're using Bundler:

gem 'bigcommerce_api'

Configuration

To use the API client in your Ruby code:

require 'rubygems'
require 'bigcommerce_api'

You can currently connect using the existing api key auth:

api = BigcommerceAPI::Base.new(
	:api_key => 'XXXXXXXXXXXXX', 
	:username => 'XXXXXXXX', 
	:store_url => 'https://YOUR_STORE.mybigcommerce.com'
)

Or using the new OAuth credentials:

api = BigcommerceAPI::Base.new(
    :client_id => APP_CLIENT_ID,
    :store_hash => STORE_HASH/ID,
    :access_token => OAUTH_ACCESS_TOKEN
)

You can test your connection by getting the time

 api.time

A valid time means your connection and credentials are good.

You can also get your store info settings via the 'api' instance:

api.store

Usage

The API currently gives you read/write access to MOST of your Big Commerce API V2 resources (https://developer.bigcommerce.com/docs/api/v2)

$ irb

BigcommerceAPI::Base.new(:api_key => 'XXXXXXXXXXXXX', :username => 'XXXXXXXX', :store_url => 'https://YOUR_STORE.mybigcommerce.com')

products = BigcommerceAPI::Product.all

order = BigcommerceAPI::Order.find(NNN)
order.status_id = 3
if order.save
  puts "success!"
else
  puts order.errors.join('; ')
end

orders = BigcommerceAPI::Order.all(:status_id => 11, :min_date_created => '2008-01-01'})

shipment = BigcommerceAPI::Shipment.create(
	:order_id => bc_order.id, 
	:order_address_id => SHIPMENT_ADDRESS_ID, 
	:tracking_number => 'XXXXXX', 
	:order_date => bc_order.date_created, 
	:items => [{:order_product_id => bc_order_product.id, :quantity => NNN}]
)

Contributing to bigcommerce_api

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2014 Mark Dickson / Whiplash Merchandising. See LICENSE.txt for further details.

bigcommerce_api's People

Contributors

ideaoforder avatar machineboy2045 avatar

Watchers

Shanmuga avatar James Cloos avatar  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.