Skip to content

Instantly share code, notes, and snippets.

@Swizec
Created February 12, 2013 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swizec/4772958 to your computer and use it in GitHub Desktop.
Save Swizec/4772958 to your computer and use it in GitHub Desktop.
# this is the reequest body as per dashboard
{
"card_uri": null,
"meta": null,
"email_address": "alvena@carternader.info",
"name": null
}
# ruby library uses this to make that request
def create_account options={}
email_address = options.fetch(:email_address) { nil }
name = options.fetch(:name) { nil }
meta = options.fetch(:meta) { nil }
account_attributes = {
:uri => self.accounts_uri,
:email_address => email_address,
:name => name,
:meta => meta
}
account = Account.new account_attributes
account.save
end
# my code runs it like so:
puts 'creating seller and setting token'
seller_account = Balanced::Marketplace.my_marketplace.create_account(:email_address => seller.email)
seller_merchant_uri = seller_account.uri
seller.customer_token = seller_merchant_uri
puts 'seller token'
seller.save!
puts seller.customer_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment