Project

usercycle

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby library for integrating with the USERcycle API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.11
~> 1.4.0
~> 1.6

Runtime

>= 0.8.1
 Project Readme

For full API documentation visit the official USERcycle docs at http://docs.usercycle.com/rest_api

Install

Add to Gemfile:

gem 'usercycle', :git => 'git://github.com/usercycle/usercycle-api-ruby.git'

Setup

require 'usercycle'

# put your own credentials here
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# set up a client to talk to the USERcycle API
@client = Usercycle::Client.new api_key

Events

Find by identity

identity = 'john.smith@example.com' #required
@client.event.find_by_identity(identity)

Create

identity = 'john.smith@example.com' #required
action = 'signed_up' #required
properties = { :first_name => 'John', :last_name => 'Smith' } #optional
occurred_at = 5.days.ago #optional
@client.event.create(identity, action, properties, occurred_at)

#create will return false if there was a communication error. If it's critical this data get into USERcycle, you should retry the operation.

Get

@client.event.get(uuid)

People

Coming soon.

Cohorts

Cohorts are used to group your users and track their actions over time. There are 3 types of cohort intervals - daily, weekly, and monthly.

Stats

Returns the last four sets of cohort metrics from the specified starting date. You can override the count by passing an optional second parameter.

We will automatically adjust passed dates to conform to the API requirements for weekly (date must be a Monday) and monthly (date must be the 1st of the month).

@client.cohort.stats.get_daily(start_date, [count])
@client.cohort.stats.get_weekly(start_date, [count])
@client.cohort.stats.get_monthly(start_date, [count])

Users

You can also retrieve a list of users who belong to a cohort according to one of the following macros:

  • AARRR (default)
  • activated
  • retained
  • trial
  • billed
@client.cohort.people.get_daily(start_date, [macro])
@client.cohort.people.get_weekly(start_date, [macro])
@client.cohort.people.get_monthly(start_date [macro])

License

usercycle-api-ruby is licensed under the 3-clause BSD license, see LICENSE file for details.