0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Consume Klaviyo's API using ActiveResource
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0.1
~> 4.11.0
~> 2.15.0
~> 0.5.1
~> 5.11.0
>= 0
~> 3.6.0
~> 12.3.2
~> 3.5.1

Runtime

 Project Readme

KlaviyoAPI

Build Status

The best way to consume Klaviyo's v1 & v2 APIs!

Installation

Add this line to your application's Gemfile

gem 'klaviyo_api'

Usage

Basic Account object

# frozen_string_literal: true

require 'klaviyo_api'

class Account
  attr_accessor :api_key

  def initialize(api_key)
    @api_key = api_key
  end

  def with_klaviyo_session(&block)
    KlaviyoAPI::Session.temp api_key, &block
  end
end

account = Account.new 'pk_xxxyyyzzz'

GET /lists

account.with_klaviyo_session { KlaviyoAPI::List.all }

GET /list/:list_id

account.with_klaviyo_session { KlaviyoAPI::List.find 'AbC123xYz' }

Development

After checking out the repository, run bin/setup to install dependencies. Then, run rake test to run the tests.

You can also run bin/console for an interactive prompt that will allow you to experiment. You can create a file in the root of the project called dev-config.yml and add your API key to it:

api_key: <your-api-key>

This will tell the console to pre-authenticate the Klaviyo session, making it easier to test.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rewindio/klaviyo_api.