Sha256: 0121410cc429865590385746f207574debbcb4719e40ff31c95ef057240ed088

Contents?: true

Size: 1.46 KB

Versions: 23

Compression:

Stored size: 1.46 KB

Contents

---
title: Clients
weight: 1
layout: guides
---

## 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.

As most clients implement basic request functionality (e.g. `get`, `put`, `post`, `delete`, etc.), you can call these methods directly to perform custom requests.  Refer to the specific Client definitions for what parameters are permitted.

## 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

23 entries across 23 versions & 1 rubygems

Version Path
ledger_sync-3.0.0 documentation/site/guides/architecture/clients.md
ledger_sync-2.6.0 documentation/site/guides/architecture/clients.md
ledger_sync-2.5.0 documentation/site/guides/architecture/clients.md
ledger_sync-2.4.4 documentation/site/guides/architecture/clients.md
ledger_sync-2.3.1 documentation/site/guides/architecture/clients.md
ledger_sync-2.2.3 documentation/site/guides/architecture/clients.md
ledger_sync-2.2.1 documentation/site/guides/architecture/clients.md
ledger_sync-2.2.0 documentation/site/guides/architecture/clients.md
ledger_sync-2.0.2 documentation/site/guides/architecture/clients.md
ledger_sync-2.0.1 documentation/site/guides/architecture/clients.md
ledger_sync-2.0.0 documentation/site/guides/architecture/clients.md
ledger_sync-2.0.0.pre.1 documentation/site/guides/architecture/clients.md
ledger_sync-1.8.1 documentation/site/guides/architecture/clients.md
ledger_sync-1.8.0 documentation/site/guides/architecture/clients.md
ledger_sync-1.7.0 documentation/site/guides/architecture/clients.md
ledger_sync-1.6.0 documentation/site/guides/architecture/clients.md
ledger_sync-1.5.2 documentation/site/guides/architecture/clients.md
ledger_sync-1.5.1 documentation/site/guides/architecture/clients.md
ledger_sync-1.5.0 documentation/site/guides/architecture/clients.md
ledger_sync-1.4.4 documentation/site/guides/architecture/clients.md