Sha256: e368a0b56973aa1af978ccd2d767b0d1c2323615a951d262a851fe85e22dca7c

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

---
title: Clients
weight: 1
layout: reference
---

## Overview

Clients handle the authentication and requests to the ledger.  A ledger may have different authentication strategies,
so clients will accept different arguments.  For example, QuickBooks Online utilizes Oauth 2.0 while NetSuite offers
Token Based Authentication.  While similar, the required keys are different.

## How to use

Unless you are customizing LedgerSync, you will always pass an instantiated client to an object (e.g. an operation).
The object will handle using the client as needed.

## Gotchas

### Oauth 2.0

Clients store the authentication details for the ledger.  Given that Oauth 2.0 tokens can refresh during a request,
these clients will handle saving credentials back to the client instance.  Typically (though some clients offer
more automated solutions), you will want to save any changes back to your database.  You can use
`client.ledger_attributes_to_save` to retrieve a hash of which attributes to save. Your code to do so could look like
the following:

{% highlight ruby linenos %}
# Assuming `client` is defined as an instance of a ledger Client class
client.ledger_attributes_to_save.each do |attribute_to_save, value|
  # Store value
end
{% endhighlight %}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ledger_sync-1.4.2 documentation/site/reference/architecture/clients.md
ledger_sync-1.4.1 documentation/site/reference/architecture/clients.md
ledger_sync-1.4.0 documentation/site/reference/architecture/clients.md