Skip to content

ayalaalex/lightspeed_pos

 
 

Repository files navigation

Lightspeed POS

Build Status Code Climate

An unofficial gem for interacting with Lightspeed's Point of Sale API. Works with API keys for the time being.

Most definitely not production ready yet, but you can help by submitting pull requests!

Getting Started

First, intialize a new client:

client = Lightspeed::Client.new(api_key: "YOUR_API_KEY_HERE")

OR you may also choose to pass through an OAuth access token if you have one:

client = Lightspeed::Client.new(oauth_token: "YOUR_ACCESS_TOKEN_HERE")

Next, make a request for your accounts:

accounts = client.accounts

Pick the account you want to use, and then start using it:

account = accounts.first
account.items # This will return the first 100 items from the account

Account Resources

Account resources share a common API. Account resources that are currently supported by this library are:

  • Categories
  • Items
  • Item Matrices
  • Item Attribute Sets

To work with account resources, you first need to fetch an account. The examples below are for items, but will also work with other types listed above.

List

You can fetch a list of items with this:

account.items.all

You can pass query parameters to this by using the params keyword:

account.items.all(params: { itemMatrixID: 0 })

Show

You can fetch a particular item by its ID by doing this:

account.items.find(1)

Create

You can create a particular item by calling create:

account.items.create({
  description: "Onesie"
})

Update

You can update a particular item by calling update, passing that item's ID and providing a list of attributes to update:

account.items.update(1, {
  description: "Onesie"
})

This method isn't available on items themselves because I couldn't work out how to share the account ID easily there.

Destroy

You can destroy a particular item by calling destroy and passing that item's ID:

account.items.destroy(1)

For the Items resource, this is aliased to archive:

account.items.archive(1)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 94.7%
  • Shell 5.3%