Skip to content

Commit

Permalink
Renames everything to something distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
paceaux committed Aug 3, 2021
1 parent 9e67976 commit db09e0d
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 61 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const BibleApi = require('./src/index');
const Berea = require('./src/index');

module.exports = BibleApi;
module.exports = Berea;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "bibleapi",
"name": "berea",
"version": "1.0.0",
"description": "A promise-wrapped library and ORM for using https://scripture.api.bible",
"main": "build/index.js",
Expand All @@ -15,7 +15,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/paceaux/BibleApi"
"url": "https://github.com/paceaux/Berea"
},
"keywords": [
"Scripture",
Expand All @@ -39,7 +39,7 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/paceaux/BibleApi/issues"
"url": "https://github.com/paceaux/Berea/issues"
},
"dependencies": {
"axios": "^0.21.1",
Expand Down
48 changes: 24 additions & 24 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BibleApi
# Berea
A Promised-wrapped Node library and ORM for [https://scripture.api.bible/](API.Bible).

This includes a `bibleService` which is a promised-wrapped library for the API with some convenience methods.
Expand All @@ -17,7 +17,7 @@ But it **also** includes an ORM that turns data into `Bible`, `Book`, `Chapter`
5. After it's created you will need the credentials

# Usage
This is thoroughly documented via JSDoc and a [Github Wiki](https://github.com/paceaux/BibleApi/wiki)
This is thoroughly documented via JSDoc and a [Github Wiki](https://github.com/paceaux/Berea/wiki)

Using the API and this library amounts to three steps:

Expand All @@ -34,7 +34,7 @@ You may want multiple services if you plan on using different versions of the ap

### Basic Example
```
const {BibleService} = require('bibleapi');
const {BibleService} = require('berea');
const service = new BibleService('someLongToken');
```
Expand All @@ -43,7 +43,7 @@ const service = new BibleService('someLongToken');
As the API itself is version controlled, the library is too. This is an optional second parameter:

```
const {BibleService} = require('bibleapi');
const {BibleService} = require('berea');
const service = new BibleService('someLongToken', 1);
```
Expand All @@ -53,13 +53,13 @@ const service = new BibleService('someLongToken', 1);
The Bible API itself offers text and audio. As you may want one over the other, this is an optional third parameter. The options are `text` or `audio`.

```
const {BibleService} = require('bibleapi');
const {BibleService} = require('berea');
const service = new BibleService('someLongToken', 1, 'audio');
```

## Setting options in requests
All of the [request options are documented](https://github.com/paceaux/BibleApi/wiki/Request-Parameters). One notable difference between how this library works is that _options can be camelCased_.
All of the [request options are documented](https://github.com/paceaux/Berea/wiki/Request-Parameters). One notable difference between how this library works is that _options can be camelCased_.

While the [API](https://scripture.api.bible/livedocs#/) will require `content-type` if you want to set options, you can send `contentType`.

Expand All @@ -69,7 +69,7 @@ Look in `src/constants/requestParameters.js` for all of the aliases. `RequestPar
Before getting verses, chapters, or passages, you need a `bibleId`. The only way to know _that_ is to look at all of the Bibles, first.

### Get all Bibles
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#BiblesRequestParam) ( an array)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#BiblesRequestParam) ( an array)

```
async function doThings() {
Expand All @@ -79,7 +79,7 @@ async function doThings() {
```

### Get Bibles with options
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#BibleResponse) (an array)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#BibleResponse) (an array)

```
async function doThings() {
Expand All @@ -91,7 +91,7 @@ async function doThings() {
```

### Get One Bible
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#BibleResponse)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#BibleResponse)
* Request: only a string

Once you've found a `bibleId`, you can get some information on it.
Expand All @@ -113,8 +113,8 @@ e.g.


### Get all books from a Bible (no options)
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#booksrequestparam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#bookresponse) (an array)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#booksrequestparam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#bookresponse) (an array)
* A Single parameter can be passed, an object, containing `id` for `bibleId` with additional options.
Here, all that's passed is the `bibleId` as a string.
```
Expand All @@ -125,8 +125,8 @@ async function doThings() {
```

### Get all books from a Bible (with options)
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#booksrequestparam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#bookresponse) (an array)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#booksrequestparam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#bookresponse) (an array)
* A Single parameter can be passed, an object, containing `id` for `bibleId` with additional options.
`includeChapters` is an option that's passed in.

Expand Down Expand Up @@ -154,8 +154,8 @@ e.g.


### Get all chapters from a book
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#chaptersrequestparam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#ChapterSummaryResponse) (an array)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#chaptersrequestparam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#ChapterSummaryResponse) (an array)
* A Single parameter can be passed, an object, containing `id` for `bibleId` and `bookId` with additional options.


Expand All @@ -167,8 +167,8 @@ async function doThings() {


### Get one chapter
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#chaptersrequestparam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#ChapterResponse)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#chaptersrequestparam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#ChapterResponse)
* A Single parameter can be passed, an object, containing `id` for `bibleId` and `chapterId` with additional options.


Expand All @@ -190,7 +190,7 @@ e.g.
* Mark 8:8 => <samp>MAR.8.8</samp>

### Get all verses from a chapter
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#versesummaryresponse) (as array)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#versesummaryresponse) (as array)

Note that **this will not give you the content of the verses**. It may be useful, however, in getting `verseId`s

Expand All @@ -201,8 +201,8 @@ async function doThings(){
```

### Get one verse
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#VerseRequestParam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#verseresponse)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#VerseRequestParam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#verseresponse)
* A Single parameter can be passed, an object, containing `id` for `bibleId` and `verseId` with additional options.


Expand All @@ -214,8 +214,8 @@ async function doThings(){
```

### Get Range of verses
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#PassageRequestParam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#passageresponse)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#PassageRequestParam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#passageresponse)

Note: This is an alias for `getPassage()`

Expand All @@ -239,8 +239,8 @@ e.g.


### Get one passage
* [Request Options](https://github.com/paceaux/BibleApi/wiki/Request-Parameters#PassageRequestParam)
* [Response](https://github.com/paceaux/BibleApi/wiki/Response-Types#passageresponse)
* [Request Options](https://github.com/paceaux/Berea/wiki/Request-Parameters#PassageRequestParam)
* [Response](https://github.com/paceaux/Berea/wiki/Response-Types#passageresponse)
* A Single parameter can be passed, an object, containing `id` for `bibleId` and `passageId` with additional options.


Expand Down
30 changes: 15 additions & 15 deletions test/service/constructor.test.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('prototype', () => {
it('has BibleTypes', () => {
expect(BibleApi).toHaveProperty('BibleTypes');
expect(Berea).toHaveProperty('BibleTypes');
});
it('has RequestParameters', () => {
expect(BibleApi).toHaveProperty('RequestParameters');
expect(Berea).toHaveProperty('RequestParameters');
});
});
describe('constructor', () => {
it('applies an api key', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5');
const api = new Berea('5ae573a324440896fabd2942943728a5');
expect(api).toHaveProperty('apikey', '5ae573a324440896fabd2942943728a5');
});
describe('bibleType', () => {
it('has a default of text', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);
expect(api).toHaveProperty('medium', 'text');
});

it('can be set to audio', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1, 'audio');
const api = new Berea('5ae573a324440896fabd2942943728a5', 1, 'audio');
expect(api).toHaveProperty('medium', 'audio');
});
});
describe('bibleType', () => {
it('when the type is text, the bibleType is bibles', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);
expect(api).toHaveProperty('medium', 'text');
expect(api).toHaveProperty('bibleType', 'bibles');
});

it('when the type is audio, the bibleType is audio-bibles', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1, 'audio');
const api = new Berea('5ae573a324440896fabd2942943728a5', 1, 'audio');
expect(api).toHaveProperty('medium', 'audio');
expect(api).toHaveProperty('bibleType', 'audio-bibles');
});
});

describe('has a version', () => {
it('has a default version', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5');
const api = new Berea('5ae573a324440896fabd2942943728a5');
expect(api).toHaveProperty('version', 1);
});
it('has can set a version', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 2);
const api = new Berea('5ae573a324440896fabd2942943728a5', 2);
expect(api).toHaveProperty('version', 2);
});
});
describe('has dependencies', () => {
it('has default dependencies', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 2);
const api = new Berea('5ae573a324440896fabd2942943728a5', 2);
expect(api).toHaveProperty('dependencies');
expect(api.dependencies).toBeInstanceOf(Object);
});
it('has axios in dependencies by default', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 2);
const api = new Berea('5ae573a324440896fabd2942943728a5', 2);
expect(api.dependencies).toHaveProperty('Axios');
expect(api.dependencies.Axios).toBeInstanceOf(Object);
});
});
describe('has an axios object', () => {
it('it has an axios object', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);
expect(api).toHaveProperty('axios');
expect(api.axios).toBeInstanceOf(Object);
expect(api.axios.defaults.headers).toHaveProperty('api-key', '5ae573a324440896fabd2942943728a5');
Expand All @@ -73,7 +73,7 @@ describe('constructor', () => {
describe('static methods', () => {
describe('hyphenate parameters', () => {
it('will hyphenate allowed parameters', () => {
const result = BibleApi.hyphenateParameters(
const result = Berea.hyphenateParameters(
{
includeTitles: true,
contentType: 'html',
Expand All @@ -83,7 +83,7 @@ describe('static methods', () => {
expect(result).toHaveProperty('content-type', 'html');
});
it('leaves alone pre-hyphenated params', () => {
const result = BibleApi.hyphenateParameters(
const result = Berea.hyphenateParameters(
{
'include-titles': true,
'content-type': 'html',
Expand Down
8 changes: 4 additions & 4 deletions test/service/getBibles.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('getBibles', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

it('it gets a hugeass list of bibles', async () => {
const result = await api.getBibles();
Expand Down Expand Up @@ -30,7 +30,7 @@ describe('getBibles', () => {
});
});
describe('getBibleById', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

it('can get by an Id', async () => {
const result = await api.getBible('06125adad2d5898a-01');
Expand All @@ -47,7 +47,7 @@ describe('getBibleById', () => {
});
});
describe('getBibleAudio', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1, 'audio');
const api = new Berea('5ae573a324440896fabd2942943728a5', 1, 'audio');

it('it gets a list of audio bibles', async () => {
const result = await api.getBibles();
Expand Down
6 changes: 3 additions & 3 deletions test/service/getBooks.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('getBooks', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

it('can get books if the id is a string', async () => {
const result = await api.getBooks('06125adad2d5898a-01');
Expand All @@ -18,7 +18,7 @@ describe('getBooks', () => {
});

describe('getBook', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

it('gets a book when sent a single object', async () => {
const result = await api.getBook({ id: '06125adad2d5898a-01', bookId: 'EXO' });
Expand Down
4 changes: 2 additions & 2 deletions test/service/getChapters.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('getChapters', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

describe('getChaptersFromBook', () => {
it('gets chapters when sent two strings', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/service/getPassages.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('getPassage', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

describe('getPassage', () => {
it('gets passages when sent two strings', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/service/getVerses.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('getVerses', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

describe('getVersesFromChapter', () => {
it('gets chapters when sent two strings', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/service/search.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BibleApi = require('../../src/bibleService');
const Berea = require('../../src/bibleService');

describe('search', () => {
const api = new BibleApi('5ae573a324440896fabd2942943728a5', 1);
const api = new Berea('5ae573a324440896fabd2942943728a5', 1);

describe('basic search', () => {
it('gets a verse when sent two strings', async () => {
Expand Down

0 comments on commit db09e0d

Please sign in to comment.