Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku. This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding and removing collaborators


When a new employee starts at our company, wouldn't it be great if we could quickly grant them access to all of our Heroku applications? We can write programs using the API to do this using the collaborator endpoint. In this recipe, we'll learn how to add and remove collaborators from our applications.

Note

Make sure you complete reading the Getting Started with the Platform API gem recipe before attempting this recipe.

How to do it…

To start, let's open a terminal and go to our heroku-api-examples directory. Then, we can perform the following steps:

  1. Let's start up a console by running console.rb:

    $ ruby console.rb
    
  2. With the collaborator's endpoint, we can list, create, or delete collaborators for any of our applications. Let's use the list command to see the current collaborators on one of our applications:

    $ heroku_api.collaborator.list('app-name')
    
    => [{"created_at"=>"2014-04-20T22:32:57Z",
      "id"=>"059e7a76-ce3a-4e54-b655-54e3e8e2f253",
      "updated_at...