PaperTiger.Router (PaperTiger v0.9.20)

View Source

HTTP router for PaperTiger Stripe mock server.

Handles all Stripe API endpoints with DRY macro-based routing.

Plugs

Endpoints

Stripe API (v1)

  • /v1/customers - Customer management
  • /v1/subscriptions - Subscription management
  • /v1/invoices - Invoice management
  • etc. (28 total resource types)

Config API (testing)

  • POST /_config/webhooks - Register webhook endpoint
  • DELETE /_config/data - Flush all data
  • POST /_config/time/advance - Advance time (manual mode)

Resource Macro

The stripe_resource/3 macro generates standard CRUD routes:

stripe_resource "customers", PaperTiger.Resources.Customer

Generates:

  • POST /v1/customers -> Customer.create/1
  • GET /v1/customers/:id -> Customer.retrieve/2
  • POST /v1/customers/:id -> Customer.update/2
  • DELETE /v1/customers/:id -> Customer.delete/2
  • GET /v1/customers -> Customer.list/1

With :only / :except support:

stripe_resource "tokens", PaperTiger.Resources.Token, only: [:create, :retrieve]
stripe_resource "events", PaperTiger.Resources.Event, except: [:delete]

Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Functions

call(conn, opts)

Callback implementation for Plug.call/2.

init(opts)

Callback implementation for Plug.init/1.