Project

heap

0.04
Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Implements Heap's server-side API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0
>= 0.8.10
>= 2.0.1
>= 5.8.4
>= 3.12
>= 0.11.2
>= 0.8.7.6

Runtime

>= 0.8.11
 Project Readme

This module is deprecated.

(DEPRECATED) Heap Server-Side API Client for Ruby

Build Status Coverage Status Dependency Status Yard Docs Gem Version

This is a Ruby client for the Heap server-side API.

Notice

This client is deprecated and this repo is no longer maintained or supported.

Prerequisites

This gem is tested on MRI 1.8.7 and above, and on JRuby 1.7 and above.

Installation

If you're using bundler, add the following line to your Gemfile.

gem 'heap', '~> 1.0'

Otherwise, install the heap gem and activate it in your code manually.

gem install heap
require 'heap'

Setup

Place the following code in a file that executes when your application initializes.

Heap.app_id = 'YOUR_APP_ID'

In a Ruby on Rails application, place the following snippet in an initializer, such as config/initializers/heap.rb.

if Rails.env.production?
  Heap.app_id = 'YOUR_APP_ID'
else
  Heap.app_id = 'YOUR_DEV_APP_ID'
end

In some testing environments, connecting to outside servers is undesirable. Set the stubbed accessor to true to have all API calls succeed without generating any network traffic.

class StubbedHeapTest < MiniTest::Test
  def setup
    Heap.stubbed = true
  end

  def teardown
    Heap.stubbed = false
  end

  ...
end

Usage

Track a server-side event. The properties are optional.

Heap.track 'event-name', 'user-identity', property: 'value'

Add properties to a user.

Heap.add_user_properties 'user-identity', plan: 'premium1'

If the global API client instance stored in Heap is not a good fit for your application's architecture, create your own client instances.

heap_client = Heap.new app_id: 'YOUR_APP_ID'
heap_client.track 'event-name', 'user-identity', property: 'value'

Development

After cloning the repository, install the required gems.

bundle install

Make sure the tests pass after making a change.

rake test

If you submit a pull request, Travis CI will run the test suite against your code on the Ruby VMs that we support. Please fix any errors that it reports.

Legacy Gem Releases

Gem versions below 1.0 come from this repository, which is an entirely different codebase. We are very grateful to @HectorMalot for donating the heap gem name to us.

If you are using a pre-1.0 gem, please consider upgrading to an officially supported release. In the meantime, you can pin the old version in your Gemfile.

gem 'heap', '~> 0.3'

Copyright

Copyright (c) 2016 Heap Inc., released under the MIT license.