coinbase

#balance

should return account balance
coinbase.account.balance(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('amount');
  data.should.have.property('currency', 'BTC');
  done();
});

#receiveAddress

should return the user's current bitcoin receive address
coinbase.account.receiveAddress(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('success', true);
  data.should.have.property('address');
  data.should.have.property('callback_url');
  done();
});

#generateReceiveAddress

should generate a new receive address
coinbase.account.generateReceiveAddress(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('success', true);
  data.should.have.property('address');
  data.should.have.property('callback_url');
  done();
});
should generate a new receive address with callback
coinbase.account.generateReceiveAddress('https://www.example.com/callback', function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('success', true);
  data.should.have.property('address');
  data.should.have.property('callback_url'); // TODO: enforce callback value ***api is currently not passing this back. may be a bug in the api
  done();
});

#button

should generate a new button
var param = {
              "button": {
                "name": 'test',
                "price_string": '1.23',
                "price_currency_iso": 'USD',
                "custom": 'Order123',
                "description": 'Sample description',
                "type": 'buy_now',
                "style": 'custom_large'
              }
            };
coinbase.buttons.create(param, function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('success', true);
  data.should.have.property('button');
  data.button.should.have.property('code');
  data.button.should.have.property('type');
  data.button.should.have.property('style');
  data.button.should.have.property('text');
  data.button.should.have.property('name');
  data.button.should.have.property('description');
  data.button.should.have.property('custom');
  data.button.should.have.property('price');
  done();
});

#buys

#contacts

should return the user's previously emailed contacts
coinbase.contacts(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('contacts');
  data.should.have.property('total_count');
  data.should.have.property('num_pages');
  data.should.have.property('current_page');
  done();
});

currencies

#list

should return list of supported currencies
coinbase.currencies.list(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.length.should.be.above(0);
  done();
});

#exchangeRates

should return current currency exchange rates
coinbase.currencies.exchangeRates(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('btc_to_usd');
  data.should.have.property('usd_to_btc');
  done();
});

orders

#list

should return list of supported orders
coinbase.orders.list(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('orders');
  data.should.have.property('total_count');
  data.should.have.property('num_pages');
  data.should.have.property('current_page');
  done();
});

#get

prices

#buy

should return the total buy price for some bitcoin amount
coinbase.prices.buy(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('amount');
  data.should.have.property('currency');
  done();
});

#sell

should return the total sell price for some bitcoin amount
coinbase.prices.sell(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('amount');
  data.should.have.property('currency');
  done();
});

transactions

#list

should return the user's most recent transactions
coinbase.transactions.list(function (err, data) {
  if (err) throw err;
  log('data: ' + util.inspect(data));
  data.should.have.property('current_user');
  data.should.have.property('balance');
  data.should.have.property('total_count');
  data.should.have.property('transactions');
  done();
});

#get