You are previewing RESTful Rails Development.
O'Reilly logo
RESTful Rails Development

Book Description

This book serves as a practical guide to developing RESTful applications, designing RESTful architectures, and deploying RESTful services using Ruby on Rails. By the end of each chapter, the reader will have key takeaways for how to build and extend a multi-service platform spanning different devices. The book explains the power of RESTful development with Rails, illustrating how to build an architecture composed of different services accessing shared resources through a set of collaborating APIs and applications.

Table of Contents

  1. Preface
    1. Why Rails and Not Node.js
    2. Why (I Think) You Should Read This Book
    3. What You Will Find in This Book
    4. What You Will Not Find in This Book (And Where You Can Go for Answers)
    5. Resources
    6. Coding Style
    7. Conventions Used in This Book
    8. Using Code Examples
    9. How to Contact Us
    10. Acknowledgments
  2. 1. From Hypertext to Hyperdata
    1. REST and HTTP
      1. Architectural Abstractions
      2. Introducing REST
    2. RESTful Programming and Hypermedia
      1. Design Concepts
      2. RESTful Architectures
      3. RESTful Interfaces: Hypermedia and Action Controls
    3. Wrapping Up
  3. 2. Getting Started with Ruby on Rails
    1. Getting to Know Ruby on Rails
    2. Setting Up Ruby and Rails
      1. RVM
      2. rbenv
      3. Using an Installer
    3. The Architecture of a Rails App
      1. Model-View-Controller
      2. Object-Relational Mapping
      3. Bundler
      4. Choosing an Editor
      5. Hello Rails
      6. Test-Driven Development
    4. Wrapping Up
  4. 3. First Adventures in API Design
    1. Application Programming Interfaces
    2. Dos of API Development
      1. Do KISS and DRY
        1. Do URI Design
    3. Why You Should Use Rails to Build APIs
    4. The WikiCat API
      1. Preparing the Database
      2. Scaffolding the Models
      3. Coding Controllers and Serializers
      4. Testing
    5. Wrapping Up
  5. 4. The REST of the World
    1. Life Is CRUD
    2. RESTful Rails
      1. Testing RESTful Routing in Rails
    3. HTTP Semantics
      1. GET
      2. HEAD
      3. POST
      4. PUT
      5. DELETE
    4. Wrapping Up
  6. 5. Designing APIs in RoR
    1. Hypermedia and Adaptable APIs
    2. REST Patterns
      1. Creating Hypermedia Interfaces
    3. Resource-Oriented Thinking
      1. Designing Explorable Resources
    4. HATEOAS
    5. The WikiCat Hypermedia API
    6. Wrapping Up
  7. 6. Asynchronous REST
    1. Asynchronous RESTful Operations
    2. Asynchronous REST in Rails
      1. Rails Workers and Background Jobs
      2. Creating an Application Skeleton in Three Easy Steps
      3. Uploading Images Through an API Call
      4. Creating Workers and a Jobs Queue
      5. Creating a Resource Queue
    3. Callbacks
    4. WebSockets
    5. Wrapping Up
  8. 7. Testing RESTful Services
    1. Testing in Rails
    2. Mocks, Stubs, Doubles, and Dummies
    3. Testing RESTful Services
    4. Wrapping Up
  9. 8. Microservices and Microapplications
    1. Basics of SOA and Distributed Systems Design
      1. Legacies
      2. Heterogeneity
      3. Complexity
      4. Redundancy
    2. Microservices Paradigms
    3. The Evolutionary Approach
    4. Thinking in Terms of Microapplications and Services
    5. The Thematic Walks API
      1. The Wikipin API
      2. The Citywalks API
      3. Discovering the /lib Directory
      4. Defining the Models
      5. Building the Controllers
    6. Wrapping Up
  10. 9. Mapping Data Streams onto an Application UI
    1. Wanderings in Frontend Land
    2. Rendering and Templating in Rails
    3. Ember.js: A Framework for Creating Ambitious Web Applications
      1. Designed for Application Development
      2. MVC Paradigm of Frontend
      3. Rails MVC Versus Ember.js MVC
    4. Planning the Application
      1. Getting Started with Ember.js
    5. Modeling Data
    6. Routing in Ember.js
    7. Defining the Templates
    8. Writing a Component
    9. Exploring Walks Through Categories
    10. Wrapping Up
  11. 10. Deploying an API
    1. How Is an API Deployed?
      1. API Management
      2. PaaS Solutions
    2. Deploying the Wikipin API on OpenShift
      1. Preliminary Steps
    3. Meet Jenkins
    4. Wrapping Up
  12. 11. Managing an App Ecosystem
    1. API Management
      1. APIs Are Not Consumer Products
    2. Managing Your Community’s Happiness
      1. Developer Programs
      2. App and API Quality
      3. User Happiness
    3. Data Management and Analytics
    4. Wrapping Up
  13. 12. Consuming Data Streams: Integrating External APIs in Your Application
    1. Creating a Weather Service
    2. If This Then Something
    3. Adhering to the Terms of Service
    4. Asynchronous REST
    5. Wrapping Up
  14. 13. Device-Independent Development
    1. Web Development Is a Broad Term
      1. Developing for Mobile
    2. Streaming Data into a Firefox OS App
    3. Developing an Internet of Things App
      1. Rails on the Raspberry Pi
      2. Creating the Raspboard App
    4. Wrapping Up
  15. 14. Data Analytics
    1. Data Comes from Everywhere
    2. Monolithic Versus Microapplication Architectures
    3. Monitor, Optimize, and Enhance
      1. Application Logs
      2. Monitor Request Response Times
      3. Monitor Processes
      4. Monitor Your Server Diagnostics
      5. Comprehensive Monitoring Solutions
    4. Actions and Events
      1. Plotting Data
    5. Wrapping Up
  16. 15. Scaling Gracefully
    1. Scaling Rails
    2. Creating a Middleware for Different APIs to Communicate
    3. Configuring a Reverse Proxy with Nginx
    4. Meet Lua
    5. Bundle Things Together
    6. Caching
    7. Scaling Is Not Necessarily Difficult and Painful
    8. Wrapping Up
  17. 16. Privacy and Security
    1. How to Protect User Privacy
      1. k-anonymity
      2. Differential Privacy
      3. Privacy-Enhancing Technologies
    2. Is My Data Safe?
      1. Common Sources of Insecurity
    3. Is Rails Secure?
      1. Sessions
      2. Cross-Site Request Forgery
      3. Redirection
      4. File Upload
      5. File Download
      6. Logs
    4. Conclusions
  18. A. HTTP Quick Reference
    1. Everything Started with Hypertext
    2. Creating an HTTP Server in Ruby, Quickly
    3. The HTTP Protocol
      1. Architecture
      2. Parameters
      3. Messages
      4. Connections
      5. Status Code Definitions
      6. Access Authentication
      7. Content Negotiation
      8. Caching
      9. Security Considerations
  19. Index