This repository has been archived by the owner on Nov 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Bookgroup.php
executable file
·85 lines (79 loc) · 2.16 KB
/
Bookgroup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* @version $Id$
* @author Brian Smith <[email protected]>
* @package ABS
*/
/*
* Include the ABS Api, core classes.
*/
require_once 'Api.php';
/*
* Include the ABS Base object class, core classes.
*/
require_once 'Base.php';
class ABS_Bookgroup extends ABS_Base {
/**
* The name of the XML element in the response that defines the object.
*
* @var string
*/
const XML_RESPONSE_ELEMENT = 'bookgroup';
/**
* A group ID defining a specific book group
*
* @var string
*/
private $_group_id;
function __construct(ABS_Api $api) {
parent::__construct($api, self::XML_RESPONSE_ELEMENT);
}
/*
* Method to return the appropriate URL ending based on the method being executed
*
* @param string $method
* @return string
* @throws ABS_Exception
*/
protected function getUrl($method) {
switch($method) {
case 'list':
return 'bookgroups/' . $this->_group_id . '/books.xml';
break;
case 'allbookgroups':
return 'bookgroups.xml';
break;
case 'showbookgroup':
return 'bookgroups/' . $this->_group_id . '.xml';
break;
default:
throw new ABS_Exception('Invalid method ' . $method);
}
}
/*
* Method to list all books in a specific version of the Bible, specific book group
*
* @param string $group_id
* @return xml SimpleXML object
*/
public function show($group_id) {
$this->setGroup($group_id);
return $this->requestXml('list');
}
/*
* Method to list all book groups
*
* @return xml SimpleXML object
*/
public function listBookGroups() {
return $this->requestXml('allbookgroups');
}
/*
* Method to set the group id being processed
*
* @param string $version_id
*/
public function setGroup($group_id) {
$this->_group_id = $group_id;
}
}