bento_client

Version, currently 1.0.03 versions

github.com/hostari/bento_client

A crystal lang wrapper for the Bentonow API.

0 stars
0 dependents
License: MIT

Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  bento_client:
    github: hostari/bento_client
    version: ~> 1.0.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 1.0.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

bento_client

A crystal lang wrapper for the Bento API.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      bento_client:
        github: hostari/bento_client
  2. Run shards install

Usage

Set the following api keys in .env: publishable_key, secret_key, site_uuid.

require "bento_client"

To build a new Bento client:

publishable_key = ENV["BENTO_PUBLISHABLE_KEY"]
secret_key = ENV["BENTO_SECRET_KEY"]
client = Bento::Client.new(publishable_key, secret_key)

Endpoints

Most useful available Bento API resources are implemented.

  1. Creating an Event - for single or batch processing of events such as adding users and other user information, adding tags to already exisiting users, or adding fields to existing users.
body = {
  events: [
    {
      type: "$completed_onboarding",
      email: "test@test.com"
    },
    {
      type: "$completed_onboarding",
      email: "test@test.com",
      fields: {
        first_name: "Jesse",
        last_name: "Pinkman"
      }
    },
    {
      email: "test@test.com",
      type: "$purchase",
      fields: {
        first_name: "Jesse"
      },
      details: {
        unique: {
          key: "test123"
        },
        value: {
          currency: "USD",
          amount: 8000
        },
        cart: {
          items: [
            {
              product_sku: "SKU123",
              product_name: "Test",
              quantity: 100
            }
          ],
          abandoned_checkout_url: "https://test.com"
        }
      }
    }
  ]
}.to_json
site_uuid = ENV["BENTO_SITE_UUID"]
event = Bento::Event.create_event(publishable_key, secret_key, site_uuid, body)

Contributing

  1. Fork it (https://github.com/hostari/bento_client/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors