Skip to content

Commit

Permalink
Merge pull request #382 from clark800/notifications
Browse files Browse the repository at this point in the history
Merge notifications functionality into getAccountTransactions
  • Loading branch information
clark800 committed Jun 24, 2015
2 parents 77f1351 + 64e86f4 commit 81a9bc0
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 450 deletions.
3 changes: 0 additions & 3 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const balances = require('./ledger/balances');
const settings = require('./ledger/settings');
const transactions = require('./ledger/transactions');
const trustlines = require('./ledger/trustlines');
const notifications = require('./ledger/notifications');
const payments = require('./ledger/payments');
const orders = require('./ledger/orders');
const preparePayment = require('./transaction/payment');
Expand Down Expand Up @@ -41,8 +40,6 @@ RippleAPI.prototype = {
getSettings: settings.getSettings,
getTransaction: transactions.getTransaction,
getAccountTransactions: transactions.getAccountTransactions,
getNotification: notifications.getNotification,
getNotifications: notifications.getNotifications,

preparePayment: preparePayment,
prepareTrustline: prepareTrustline,
Expand Down
40 changes: 40 additions & 0 deletions src/api/common/schemas/acct-tx-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "acct-tx-options",
"description": "Options for getAccountTransactions",
"type": "object",
"properties": {
"start": {"$ref": "hash256"},
"limit": {
"type": "integer",
"minimum": 1
},
"minLedgerVersion": {"$ref": "ledgerVersion"},
"maxLedgerVersion": {"$ref": "ledgerVersion"},
"earliestFirst": {"type": "boolean"},
"excludeFailures": {"type": "boolean"},
"outgoing": {"type": "boolean"},
"incoming": {"type": "boolean"},
"types": {
"type": "array",
"items": {
"enum": [
"payment",
"trustline",
"order",
"orderCancellation",
"settings"
]
}
},
"binary": {"type": "boolean"}
},
"additionalProperties": false,
"not": {
"anyOf": [
{"required": ["incoming", "outgoing"]},
{"required": ["start", "minLedgerVersion"]},
{"required": ["start", "maxLedgerVersion"]}
]
}
}
7 changes: 4 additions & 3 deletions src/api/common/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function validateLedgerRange(options) {
}
}

function validateOptions(options) {
schemaValidate('options', options);
function validateOptions(schema, options) {
schemaValidate(schema, options);
validateLedgerRange(options);
}

Expand All @@ -52,6 +52,7 @@ module.exports = {
trustline: _.partial(schemaValidate, 'trustline'),
txJSON: _.partial(schemaValidate, 'tx'),
blob: _.partial(schemaValidate, 'blob'),
options: validateOptions,
getAccountTransactionsOptions: _.partial(validateOptions, 'acct-tx-options'),
options: _.partial(validateOptions, 'options'),
instructions: _.partial(schemaValidate, 'instructions')
};

0 comments on commit 81a9bc0

Please sign in to comment.