zenps-ruby

Wrapper for Zenps API

Installation

gem install zenps-ruby

Or with bundler

gem 'zenps-ruby'

Configuration

This library needs to be configured with a Zenps Api key. Configuration can be performed as follows using a hash

Zenps.configure(zenps_key: 'YOUR_ZENPS_KEY')

or with a yml configuration file

Zenps.configure_with('path/to/your/configuration/file.yml')

Usage

This wrapper allows you to send NPS surveys to your user in batch…

Zenps::Survey.call([user_1, user_2], event: 'sign_up')

…or on a per-user basis

Zenps::Survey.call(user, event: 'sign_up')

A user subject can either be:

This allows for the gem to be used eg. in a rails application with User models that respond to the email method (and/or locale) as follows

Zenps::Survey.call(User.limit(10), event: 'sign_up')

but also in a more simple way as follows

Zenps::Survey.call('john.doe@acme.com', event: 'sign_up')

The following options are available on the Survey call method:

| Options | Type | Mandatory | Description | | ——–|:—————:| :——–:|————————————————:| | locale | String | false | Overwrites the user's AND default locale | | event | String | true | Typically the event triggering the NPS survey | | tags | Array | false | Tags giving you granularity in your analytics |

Example:

Zenps::Survey.call(user, locale: 'fr', event: 'sign_up', tags: ['man', 'facebook'])

Contributing to zenps-ruby

License

This gem is released under the MIT License.