Repository: iiif-prezi/iiif-prezi3 (language: python)

Issue:
Add Range
<!-- Add a short name of the proposed helper method in the Title above -->

## Description
<!-- Provide a short description of the helper method -->
This helper adds an existing `Range` object to the `structures` key

## Function name / Parameters / Return
<!-- Suggest a name for the helper's function, the parameters it should accept, and what it should return (if anything) -->
Function name: `.add_range(range)`

Parameters: `range` - The `Range` object to be added

Returns: `None`

## Objects
<!-- Which objects should this helper apply to? -->
- [ ] Base Object (all Prezi3 Classes)
- [ ] Collection
- [x] Manifest
- [ ] Canvas
- [ ] Range
- [ ] AnnotationCollection
- [ ] AnnotationPage
- [ ] Annotation
- [ ] Content Resource - Image
- [ ] Content Resource - Video
- [ ] Content Resource - Text
- [ ] Service
- [ ] Provider
- [ ] Other - please list below
<!-- Add other Objects/Classes here -->

## Considerations
<!-- Any extra considerations for the behavior of this helper -->

Add Range
<!-- Add a short name of the proposed helper method in the Title above -->

## Description
<!-- Provide a short description of the helper method -->
This helper adds an existing `Range` object to the `structures` key

## Function name / Parameters / Return
<!-- Suggest a name for the helper's function, the parameters it should accept, and what it should return (if anything) -->
Function name: `.add_range(range)`

Parameters: `range` - The `Range` object to be added

Returns: `None`

## Objects
<!-- Which objects should this helper apply to? -->
- [ ] Base Object (all Prezi3 Classes)
- [ ] Collection
- [x] Manifest
- [ ] Canvas
- [ ] Range
- [ ] AnnotationCollection
- [ ] AnnotationPage
- [ ] Annotation
- [ ] Content Resource - Image
- [ ] Content Resource - Video
- [ ] Content Resource - Text
- [ ] Service
- [ ] Provider
- [ ] Other - please list below
<!-- Add other Objects/Classes here -->

## Considerations
<!-- Any extra considerations for the behavior of this helper -->



Discussion / hints:

Fix patch:
diff --git a/iiif_prezi3/helpers/__init__.py b/iiif_prezi3/helpers/__init__.py
index 46ada0d..50d9a8d 100644
--- a/iiif_prezi3/helpers/__init__.py
+++ b/iiif_prezi3/helpers/__init__.py
@@ -5,5 +5,6 @@
 from .auto_fields import *  # noqa: F401,F403
 from .canvas_helpers import AddImageToCanvas  # noqa: F401
 from .canvas_sizes import MaxHelper, MinHelper  # noqa: F401
+from .add_range import AddRange # noqa: F401
 from .set_hwd import SetHwd  # noqa: F401
 from .to_reference import ToReference  # noqa: F401
diff --git a/iiif_prezi3/helpers/add_range.py b/iiif_prezi3/helpers/add_range.py
new file mode 100644
index 0000000..ae76499
--- /dev/null
+++ b/iiif_prezi3/helpers/add_range.py
@@ -0,0 +1,12 @@
+from ..skeleton import Manifest, Range
+from ..loader import monkeypatch_schema
+
+
+class AddRange:
+    def add_range(self, range):
+        if not self.structures:
+            self.structures = []
+        self.structures.append(range)
+
+
+monkeypatch_schema(Manifest, AddRange)


Test patch:
diff --git a/tests/test_add_range.py b/tests/test_add_range.py
new file mode 100644
index 0000000..4d20063
--- /dev/null
+++ b/tests/test_add_range.py
@@ -0,0 +1,13 @@
+import unittest
+
+from iiif_prezi3 import Manifest, Range
+
+class AddRangeTest(unittest.TestCase):
+    def setUp(self):
+        self.manifest = Manifest(label="manifest")
+        self.range = Range(type="Range")
+
+    def test_add_range(self):
+        self.manifest.add_range(self.range)
+        assert isinstance(self.manifest.structures, list)
+        assert self.manifest.structures[-1] == self.range