Sha256: 185940e2372c3709439adc8b3bca22c92b9b8676c1d9729f4bc6aa43ba187e4d

Contents?: true

Size: 1.6 KB

Versions: 21

Compression:

Stored size: 1.6 KB

Contents

# HubSpot Ruby Leaky Bucket Sample App

This is a sample app for the [hubspot-ruby SDK](../../../../). Currently, this app focuses on demonstrating the mechanism (Leaky Bucket) of avoiding of rate limits. It will be useful for you if you don't want to reach rate limit (429 http error).

Please see the documentation on [Creating an app in HubSpot](https://developers.hubspot.com/docs-beta/creating-an-app)

### HubSpot Public API endpoints used in this application

  - [Contacts](https://developers.hubspot.com/docs-beta/crm/contacts)
  - [OAuth](https://developers.hubspot.com/docs-beta/working-with-oauth)

### Setup App

Make sure you have [Docker Compose](https://docs.docker.com/compose/) installed.

### Configure

1. Copy .env.template to .env
2. Specify authorization data in .env:
    - Paste HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET for OAuth

### Running

The best way to run this project (with the least configuration), is using docker compose.  Change to the webroot and start it

```bash
docker-compose up --build
```
You should now be able to navigate to [http://localhost:3000](http://localhost:3000).
Firstly you will need to authorize via OAuth there.
Then you can to go to the terminal window and execute the command that displayed on root page.
Rake task will execute process of multiple creation and deletion of contacts. Huge number of such operations may cause 429 error. To avoid this we use leaky bucket mechanism: worker sleeps some time before making request to API. This helps prevent the excess of the number of requests per minute.

Please note this app starts a few workers in order to test rate limit.

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-8.0.1 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-8.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-7.3.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-7.2.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-7.1.1 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-7.1.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-7.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-6.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-5.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-4.0.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-3.3.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-3.2.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-3.1.1 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-3.1.0.pre.beta sample-apps/leaky-bucket-app/README.md
hubspot-api-client-3.0.0.pre.beta sample-apps/leaky-bucket-app/README.md
hubspot-api-client-2.3.2 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-2.3.1 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-2.2.0 sample-apps/leaky-bucket-app/README.md
hubspot-api-client-2.1.0 sample-apps/leaky-bucket-app/README.md