0.1.0 • Published 8 years ago
beyond-the-bell v0.1.0
Beyond The Bell
This library allows read access to all of the Organizations, Locations, Services, and Categories collected and maintanied by Beyond the Bell.
Install
npm install --save beyond-the-bellUsage
var BtB = require("beyond-the-bell");
// List all Organizations
BtB.Organizations.all().then(function(orgs) {
orgs.forEach(function(org) {
console.log(org.get("Name"));
})
})
// List all Locations
BtB.Locations.all().then(function(locations) {
locations.forEach(function(location) {
console.log(location.get("Name"), location.get("Address"));
})
})
// Search for a location
BtB.Locations.search("Library").then(function(results) {
results.forEach(function(result) {
console.log(result.location.get("Name"));
console.log(result.relevance);
})
})Models
Organization
Fields
NameMission StatementDescriptionAddressPhone NumberWebsitePhoto- An array of all photos provided by the OrganizationLocations- An array of ids pointing to valid Location objectsLogo- An array of provided logosOrganization nicknames- Other names the organization goes byCategories
Methods
get(id)- returns a promise which resolves to the organization with the provided string id, or null if there is no organization with that id.all()- returns a promise which resolves to an array of all of the organizations.search(query)- returns a promise which resolves to an array of results of the form{organization: OrganizationModel, relevance: float}whererelevanceis a decimal between0and1with1being the most relevant possible.refresh()- forces a reload of all of the organizations, since the library caches the list aggressively.
Locations
Fields
NameOrganization- An array of the organizations this location is associated with (realistically should be a single item)AddressPhone NumberPrimary Contact NamePrimary Contact Email AddressOperating HoursService 1 NameService 1 DescriptionService 1 FeeService 1 Registration- An array of strings representing the types of registration. Either"Drop in"or"Advance registration required"Service 1 Grade Levels Served- An array of strings showing the different age groups served.Service 1 CategoriesService 2 NameService 2 DescriptionService 2 FeeService 2 RegistrationService 2 Grade Levels ServedService 2 CategoriesService 3 NameService 3 DescriptionService 3 FeeService 3 RegistrationService 3 Grade Levels ServedService 3 CategoriesOther ServicesLatitudeLongitude
Methods
get(id)- returns a promise which resolves to the location with the provided string id, or null if there is no location with that id.all()- returns a promise which resolves to an array of all of the locations.search(query)- returns a promise which resolves to an array of results of the form{location: LocationModel, relevance: float}whererelevanceis a decimal between0and1with1being the most relevant possible.refresh()- forces a reload of all of the locations, since the library caches the list aggressively.
Categories
Fields
NameDisplay Name
Methods
all()- returns a promise which resolves to an array of all of the categories.
0.1.0
8 years ago