Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Commit c9022ca

Browse files
author
Jason Snow
authored
Merge pull request #8 from jyksnw/development
Merge for release of version 0.1.1
2 parents e718a50 + f1e26a0 commit c9022ca

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import setup
44

5-
VERSION = '0.1.0'
5+
VERSION = '0.1.1'
66

77

88
def read(file_name):

tests/test_youversion.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,14 @@ def test_get_verse_of_the_day_contains_image(self):
241241
raise AssertionError()
242242
if votd.image._url is None or votd.image._url == '':
243243
raise AssertionError()
244+
245+
def test_get_all_verse_of_the_days(self):
246+
more_data, size, votds = self.client.get_all_verse_of_the_days()
247+
if more_data:
248+
# Should have received all data
249+
raise AssertionError()
250+
if size < 365 or size > 366:
251+
# Should be 365 or 366 responses
252+
raise AssertionError()
253+
if votds is None or len(votds) != size:
254+
raise AssertionError()

youversion/youversion.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, TypeVar, Optional
1+
from typing import Dict, TypeVar, Optional, List, Tuple
22
from datetime import datetime
33
from os import path, getcwd
44
from shutil import copyfileobj
@@ -407,3 +407,24 @@ def get_verse_of_the_day(self, day: int = current_day_of_year()) -> VerseOfTheDa
407407
}
408408
)
409409
)
410+
411+
def get_all_verse_of_the_days(self, limit: int = 366, page: int = 1) -> Tuple[bool, int, Optional[List[VerseOfTheDay]]]:
412+
"""
413+
Gets multiple verse of the day objects
414+
415+
:param limit: Currently not used (see issue: https://github.com/lifechurch/youversion-public-api-docs/issues/7)
416+
:param page: Currently not used (see issue: https://github.com/lifechurch/youversion-public-api-docs/issues/7)
417+
:return: tuple[bool, int, list of VerseOfTheDay].
418+
bool indicates if another page is available, if results are paginated
419+
int the number of VerseOfTheDay objects contained in the response
420+
list of VerseOfTheDay objects
421+
"""
422+
json = self._get('verse_of_the_day', params={'version_id': self.bible_version.id})
423+
if not json or 'data' not in json:
424+
return False, 0, None
425+
426+
votds = [VerseOfTheDay(bible_version=self.bible_version, json=data) for data in json.get('data', [])]
427+
next_page = json.get('next_page', False)
428+
page_size = json.get('page_size', len(votds))
429+
430+
return next_page, page_size, votds

0 commit comments

Comments
 (0)