Book Image

Twilio Best Practices

Book Image

Twilio Best Practices

Overview of this book

Table of Contents (15 chapters)
Twilio Best Practices
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Ruby


We can install the twilio-ruby library using the ubiquitous RubyGems software. Much like Composer in the PHP world, it's a package manager that makes it easy to install and manage dependencies.

We can install the gem on its own by running gem install twilio-ruby from a terminal/Command Prompt. This will make the gem available in Interactive Ruby Shell (IRB).

However, in the context of a Ruby project, we usually manage our gem dependencies through a Gemfile. This file specifies a source for downloading gems, usually https://rubygems.org, and then lists gems to be installed. You also have the ability to specify the version you want to use and can install different sets of gems for different environments (for instance, you might have different gems for production use and running tests).

A basic Gemfile using the Twilio library would look like this:

source "https://rubygems.org" gem 'twilio-ruby', '~> 3.12'

Once we've added the gem to our dependencies, we can install the library with Bundler...