peach-ruby

Ruby library for Peach API

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add peach-ruby

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install peach-ruby

Usage

Configure the SDK with your API Token:

require 'peach-ruby'

Peach.configure do |config|
  config.api_token = '<YOUR API TOKEN>'
end

And then use it:

require 'peach-ruby'

contact = {
  id: 1,
  name: 'John Doe',
  language: 'en',
  last_name: 'Doe',
  account_id: 1,
  first_name: 'John',
  country_code: '91',
  phone_number: '+919988776655'
}
# you may pass in an OpenStruct as well, if needed
Peach::TemplateMessage.deliver('wat_1234abcd', { foo: 'bar' }, contact)

Development

Install dependencies

bin/setup

Run tests

bundle exec rake spec

Use the interactive prompt

bin/console

Install gem locally

bundle exec rake install

Release a new version

We use the rubygems/release-gem@v1 action, which creates the tags and pushes the .gem file to rubygems.org for us.

What we need to do then is:

  1. Update version number in version.rb
  2. Run bundle install to update Gemfile.lock with the new gem version
  3. Add and commit changes and create a Pull Request

The GitHub Action then should ideally take care of the rest.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/trypeach-io/peach-ruby.