<commit_before># Lightspeed POS

[![Build Status](https://travis-ci.org/radar/lightspeed_pos.svg?branch=master)](https://travis-ci.org/radar/lightspeed_pos)
[![Code Climate](https://codeclimate.com/github/radar/lightspeed-pos/badges/gpa.svg)](https://codeclimate.com/github/radar/lightspeed-pos)


An _unofficial_ gem for interacting with [Lightspeed's Point of Sale API](http://www.lightspeedpos.com/retail/help/developers/api/basics/). 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:

```ruby
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:

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

Next, make a request for your accounts:

```ruby
accounts = client.accounts
```

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

```ruby
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

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:

```ruby
account.items.all
```

### Show

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

```ruby
account.items.find(1)
```

### Create

You can create a particular item by calling `create`:

```ruby
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:

```ruby
account.items.update(1, {
  description: "Onesie"<commit_msg>Add more info to README<commit_after># Lightspeed POS

[![Build Status](https://travis-ci.org/radar/lightspeed_pos.svg?branch=master)](https://travis-ci.org/radar/lightspeed_pos)
[![Code Climate](https://codeclimate.com/github/radar/lightspeed-pos/badges/gpa.svg)](https://codeclimate.com/github/radar/lightspeed-pos)


An _unofficial_ gem for interacting with [Lightspeed's Point of Sale API](http://www.lightspeedpos.com/retail/help/developers/api/basics/). 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:

```ruby
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:

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

Next, make a request for your accounts:

```ruby
accounts = client.accounts
```

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

```ruby
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:

```ruby
account.items.all
```

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

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

### Show

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

```ruby
account.items.find(1)
```

### Create

You can create a particular item by calling `create`:

```ruby
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:

```ruby
account.items.update(1, {
  description: "Onesie"
{'fraction_non_alphanumeric': 0.1108641975308642, 'fraction_numerical': 0.0027160493827160493, 'mean_word_length': 4.778887303851641, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '713210', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1214, 'n_words': 466}