Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A client for our billing service

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .env
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 william-client.gemspec
Readme.md

William-client

William-client acts as an interface between William and your Ruby application. It will ideally only be a thin HyperClient wrapper, but could evolve to incorporate more of William's business logic.

Main goals

  • High-level
  • Clean interface
  • No bullshit

Usage

# Authentication
william = William::Client.new(api_key)

# Get all the subscriptions
william.subscriptions

# Create a new subscription
william.create_subscription({name: 'Blah'})

# List all the invoices for a subscription
william.subscriptions.first.invoices

Idea: Rack callbacks

In order to receive callbacks from william, william-client could be mounted as a rack application:

# in routes.rb
mount William::Client::RackApp, to: '/william'

Then, you could subscribe to them:

William::Client.callbacks.on_failed_payment do |invoice, subscription|
  # Shut off the service
end
Something went wrong with that request. Please try again.