fellowshipone
Advanced tools
Comparing version 0.0.2 to 0.1.0
'use strict'; | ||
// var util = require('util') | ||
var util = require('util') | ||
var _ = require('lodash') | ||
var request = require('request') | ||
var async = require('async') | ||
var F1Resource = require('./f1resource') | ||
function People(f1) { | ||
this.f1 = f1 | ||
F1Resource.call(this, f1, { | ||
mediaType: 'application/vnd.fellowshiponeapi.com.people.people.v2+json', | ||
resourceName: 'person', | ||
resourceNamePlural: 'people', | ||
searchParams: { | ||
include: 'addresses,communications,attributes,requirements' | ||
} | ||
}) | ||
} | ||
util.inherits(People, F1Resource) | ||
/** | ||
* See http://developer.fellowshipone.com/docs/v1/People.help#search | ||
* See http://developer.fellowshipone.com/docs/v1/People.help#list | ||
* | ||
* @param params - | ||
* searchFor = Name of the person you are searching for | ||
* address = all address values | ||
* communication = all communication values | ||
* dob = Date of birth for the person your searching for (format: yyyy-mm-dd)* | ||
* status = status id | ||
* subStatus = sub status id | ||
* attribute = attribute id | ||
* checkinTagCode = checkinTagCode* | ||
* memberEnvNo = memberEnvNo* | ||
* barCode = barCode* | ||
* id = id* | ||
* hsdid = hsdid* | ||
* includeInactive = include in active people | ||
* includeDeceased = include deceased people | ||
* lastUpdatedDate = The date of the last time the person's information was updated (format: yyyy-mm-dd)** | ||
* createdDate = The date when the person's information was created / inserted into the system (format: yyyy-mm-dd)* | ||
* recordsPerPage = number of records to return for each query (default is 20) | ||
* page = page number for the given result set | ||
* Lists all the people in a given household. Note - unlike the API, this yields | ||
* the actual array of Person objects. | ||
* | ||
* @param {Number} householdID - the ID of the Household to list the people for. | ||
*/ | ||
People.prototype.search = function(params, callback) { | ||
var config = this.f1.config | ||
var query = _.clone(params) | ||
query.include = 'addresses,communications,attributes,requirements' | ||
request.get(config.apiURL + '/People/Search', { | ||
oauth: config.oauth_credentials, | ||
headers: { | ||
accept: 'application/vnd.fellowshiponeapi.com.people.people.v2+json', | ||
'content-type': 'application/vnd.fellowshiponeapi.com.people.people.v2+json' | ||
}, | ||
json: true, | ||
qs: query | ||
}, function(err, res, body) { | ||
People.prototype.list = function(householdID, callback) { | ||
var path = '/Household/' + householdID + '/People' | ||
this._get(path, function(err, body, headers) { | ||
if (err) return callback(err) | ||
if (res.statusCode > 399) { | ||
if (body.people && body.people.person) | ||
callback(null, body.people.person) | ||
else { | ||
return callback({ | ||
statusCode: res.statusCode, | ||
headers: res.headers, | ||
statusCode: 502, | ||
headers: headers, | ||
message: body | ||
}) | ||
} | ||
// this probably won't (and shouldn't) return the raw response forever... | ||
callback(null, body) | ||
}.bind(this)) | ||
@@ -61,0 +45,0 @@ } |
{ | ||
"name": "fellowshipone", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Fellowship One (F1) API wrapper for Node.js", | ||
@@ -14,3 +14,13 @@ "main": "index.js", | ||
], | ||
"author": "Dave Henderson", | ||
"author": { | ||
"name": "Dave Henderson", | ||
"url": "https://github.com/hairyhenderson" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hairyhenderson/node-fellowshipone.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/hairyhenderson/node-fellowshipone/issues" | ||
}, | ||
"license": "MIT", | ||
@@ -20,13 +30,13 @@ "dependencies": { | ||
"jjv": "~1.0.2", | ||
"lodash": "~2.4.1", | ||
"request": "~2.49.0" | ||
"lodash": "~3.0.0", | ||
"request": "~2.51.0" | ||
}, | ||
"devDependencies": { | ||
"codeclimate-test-reporter": "~0.0.4", | ||
"istanbul": "~0.3.2", | ||
"jshint": "~2.5.10", | ||
"mocha": "~2.0.1", | ||
"should": "~4.3.0", | ||
"sinon": "~1.12.1" | ||
"istanbul": "~0.3.5", | ||
"jshint": "~2.6.0", | ||
"mocha": "~2.1.0", | ||
"should": "~4.6.2", | ||
"sinon": "~1.12.2" | ||
} | ||
} |
@@ -1,6 +0,12 @@ | ||
[](http://travis-ci.org/hairyhenderson/node-fellowshipone)[](https://codeclimate.com/github/hairyhenderson/node-fellowshipone)[](https://codeclimate.com/github/hairyhenderson/node-fellowshipone)[](https://gemnasium.com/hairyhenderson/node-fellowshipone)[](https://www.npmjs.org/package/fellowshipone) | ||
[![Build Status][travis-image]][travis-url] | ||
[![Code Coverage][coverage-image]][coverage-url] | ||
[![Code Climate][climate-image]][climate-url] | ||
[![Dependency Status][gemnasium-image]][gemnasium-url] | ||
[![Current Version][npm-image]][npm-url] | ||
node-fellowshipone | ||
================== | ||
[![Stories in Ready][waffle-ready-image]][waffle-url] | ||
[![Stories In Progress][waffle-progress-image]][waffle-url] | ||
# node-fellowshipone | ||
A [Fellowship One](http://developer.fellowshipone.org) API wrapper for Node.js | ||
@@ -17,4 +23,3 @@ | ||
Install | ||
------- | ||
## Install | ||
@@ -25,4 +30,3 @@ ``` | ||
Usage | ||
----- | ||
## Usage | ||
@@ -69,4 +73,3 @@ ### Getting a token | ||
Tests | ||
----- | ||
## Tests | ||
@@ -78,7 +81,25 @@ ``` | ||
License | ||
------- | ||
## License | ||
[The MIT License](http://opensource.org/licenses/MIT) | ||
Copyright (c) 2014 Dave Henderson | ||
Copyright (c) 2014-2015 Dave Henderson | ||
[travis-image]: https://img.shields.io/travis/hairyhenderson/node-fellowshipone.svg?style=flat | ||
[travis-url]: https://travis-ci.org/hairyhenderson/node-fellowshipone | ||
[coverage-image]: https://img.shields.io/codeclimate/coverage/github/hairyhenderson/node-fellowshipone.svg?style=flat | ||
[coverage-url]: https://codeclimate.com/github/hairyhenderson/node-fellowshipone | ||
[climate-image]: https://img.shields.io/codeclimate/github/hairyhenderson/node-fellowshipone.svg?style=flat | ||
[climate-url]: https://codeclimate.com/github/hairyhenderson/node-fellowshipone | ||
[gemnasium-image]: https://img.shields.io/gemnasium/hairyhenderson/node-fellowshipone.svg?style=flat | ||
[gemnasium-url]: https://gemnasium.com/hairyhenderson/node-fellowshipone | ||
[npm-image]: https://img.shields.io/npm/v/fellowshipone.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/fellowshipone | ||
[waffle-ready-image]: https://badge.waffle.io/hairyhenderson/node-fellowshipone.svg?label=ready&title=Ready | ||
[waffle-progress-image]: https://badge.waffle.io/hairyhenderson/node-fellowshipone.svg?label=in+progress&title=In+Progress | ||
[waffle-url]: https://waffle.io/hairyhenderson/node-fellowshipone |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
203231
26
429
1
102
0
+ Addedform-data@0.2.0(transitive)
+ Addedlodash@3.0.1(transitive)
+ Addedmime-db@1.12.0(transitive)
+ Addedmime-types@2.0.14(transitive)
+ Addedrequest@2.51.0(transitive)
- Removedform-data@0.1.4(transitive)
- Removedlodash@2.4.2(transitive)
- Removedmime@1.2.11(transitive)
- Removedrequest@2.49.0(transitive)
Updatedlodash@~3.0.0
Updatedrequest@~2.51.0