forked from rootsdev/gensearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AmericanAncestors.org; closes rootsdev#11
- Loading branch information
Justin York
committed
Mar 4, 2015
1 parent
0b782a3
commit aa7edf6
Showing
7 changed files
with
151 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var utils = require('../utils.js'); | ||
|
||
module.exports = function(config, data){ | ||
|
||
var url = 'http://www.americanancestors.org/search/database-search?'; | ||
var params = {}; | ||
|
||
if(data.givenName){ | ||
params.firstname = data.givenName; | ||
} | ||
|
||
if(data.familyName){ | ||
params.lastname = data.familyName; | ||
} | ||
|
||
if(data.birthDate){ | ||
params.fromyear = utils.getYear(data.birthDate); | ||
} | ||
|
||
if(data.deathDate){ | ||
params.toyear = utils.getYear(data.deathDate); | ||
} | ||
|
||
if(data.birthPlace){ | ||
params.location = data.birthPlace; | ||
} else if(data.deathPlace){ | ||
params.location = data.deathPlace; | ||
} | ||
|
||
return url + utils.queryString(params); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var test = require('../tester.js')('americanancestors'), | ||
utils = require(require('path').join(__dirname, '..', '..', 'src', 'utils.js')); | ||
|
||
describe('americanancestors', function(){ | ||
|
||
it('1', function(){ | ||
test(test.data[0], 'http://www.americanancestors.org/search/database-search?firstname=Joe%20William&lastname=Clark'); | ||
}); | ||
|
||
it('2', function(){ | ||
test(test.data[1], 'http://www.americanancestors.org/search/database-search?firstname=Joe%20William&lastname=Clark&fromyear=1835&toyear=1889&location=Texas'); | ||
}); | ||
|
||
it('use death place when birth place is not available', function(){ | ||
var data = utils.extend({}, test.data[1]); | ||
delete data.birthPlace; | ||
test(data, 'http://www.americanancestors.org/search/database-search?firstname=Joe%20William&lastname=Clark&fromyear=1835&toyear=1889&location=Springfield%2C%20Illinois'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters