1.0.0 • Published 11 years ago
gyft v1.0.0
gyft
Client for accessing the Gyft API
Install
$ npm install --save gyftTest
$ npm testExample
var Gyft = require('gyft')
var gyft = Gyft({
apiKey: 'blah'
, secret: 'blah'
})
gyft.listCards(function(err, cards) {
if (err) throw err // error should be handled, not thrown
console.log(cards)
// => [ { id: <card id>
// => , merchant_id: <merchant id>
// => , merchant_name: <merchant name>
// => , card_currency_code: 'USD'
// => , opening_balance: 100
// => , merchant_icon_image_url_hd: 'http://...'
// => , cover_image_url_hd: 'http://...'
// => } ]
})Usage
Gyft(opts)
opts must contain both an apiKey and secret property. It may also
contain a url property. The url will be the API url to use to access
the Gyft API.
Gyft.prototype.listCards(Object:opts, cb)
opts can contain a format property that will format the results into an object.
cb will be called with function(err, results)
Gyft.prototype.account(cb)
Returns the account info
Gyft.prototype.purchaseCard(Object:card, cb)
Acceptable Parameters:
shop_card_idThe unique id of the shop card (required)to_emailThe user email address (required)reseller_referenceReseller reference codereturn_direct_linkReturn a direct link to the gift cardfirst_nameThe user first name (recommended)last_nameThe user last namebirthdayThe user's birthday
Gyft.prototype.allTransactions(cb)
Returns all transactions
Gyft.prototype.lastTransactions(count, cb)
Returns the last count transactions
Gyft.prototype.firstTransactions(count, cb)
Returns the first count transactions
Author
Evan Lucas
License
MIT (See LICENSE for more info)