I hereby claim:
- I am moklett on github.
- I am moklett (https://keybase.io/moklett) on keybase.
- I have a public key whose fingerprint is 365F 3A48 6DAA 9246 139F B2E5 3DE2 CF72 91C8 AE79
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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" |
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 |
Scenario: Clear site data for a test site | |
Given my site is in test mode | |
And I have 2 products | |
And I have 4 subscriptions | |
When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json | |
Then the response status should be "200 OK" | |
And I should have 0 products | |
And I should have 0 subscriptions | |
Scenario: Attempt to clear site data for a production site |
describe Address do | |
permute "validations" do | |
cases [ | |
[:address, :address_2, :city, :state, :zip, :country, :valid, :errors_on], | |
[ nil, nil, nil, nil, nil, nil, false, ['address', 'city', 'state', 'zip', 'country']], | |
['123 Main St', 'Apt 100', 'Pleasantville', 'NC', '12345', 'US', true, []], | |
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' nil, false ['country']] | |
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' 'U', false ['country']] | |
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' 'USA', false ['country']] | |
] |
require 'sinatra' | |
require 'openssl' | |
require 'json' | |
post '/' do | |
body = request.body.read | |
puts "Time : #{Time.now}" | |
puts "Actual Signature : #{request.env['HTTP_X_CHARGIFY_WEBHOOK_SIGNATURE_HMAC_SHA_256']}" | |
puts "Computed Signature: #{signature(body)}" |
curl -u <api_key>:x -H Accept:application/json -H Content-Type:application/json https://acme.chargify.com/subscriptions.json |
a = { a: "a" } | |
b = { b: "b" } | |
{ **a, **b } | |
#=> {:a=>"a", :b=>"b"} | |
{ z: "z", **a, **b } | |
#=> {:z=>"z", :a=>"a", :b=>"b"} | |
{ a: "AAA", **a, **b } |