Skip to content

Instantly share code, notes, and snippets.

View moklett's full-sized avatar

Michael Klett moklett

  • Chargify.com
  • Cary, NC
View GitHub Profile
@moklett
moklett / chargify_api_steps.rb
Created September 9, 2010 20:13
A sample of the step definitions used in the Chargify API documentation (i.e. http://docs.chargify.com/api-subscriptions)
Given /^I (?:send and )?accept (.*?)(?: responses)?$/ do |format|
@format = format.downcase.to_sym
header('Content-Type', content_type_for(@format))
http_accept(@format)
end
Given /^the requester accepts (.*) responses$/ do |format|
Given "I accept #{format} responses"
end
require 'rubygems'
require 'chargify_api_ares'
require 'cgi'
Chargify.configure do |c|
c.subdomain = 'acme'
c.api_key = 'x'
end
email = "foo+bar@gmail.com"
curl -u <api_key>:x -H Accept:application/json -H Content-Type:application/json https://acme.chargify.com/subscriptions.json