Project

zenps-ruby

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

Development

~> 1.0
~> 2.1.0
~> 3.12
~> 3.5.0
~> 3.5.1
 Project Readme

Gem Version Codeship Status for aphilippartd/zenps-ruby Maintainability Test Coverage

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:

  • A string (email of user to be surveyed)
  • A hash containing the following keys:
    • email (compulsory)
    • first_name (optional)
    • last_name (optional)
    • locale (optional --> defaults to en unless overwritten in general call)
  • An object that responds to
    • email method (compulsory)
    • first_name method (optional)
    • last_name method (optional)
    • locale (optional --> defaults to en unless overwritten in general call)

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[String] 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

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. Coverage should remain as high as possible.
  • Make sure all tests pass as well as rubocop checks.

License

This gem is released under the MIT License.