Libgourou

Libgourou Git Source Tree

Root/include/fulfillment_item.h

1/*
2 Copyright 2021 Grégory Soutadé
3
4 This file is part of libgourou.
5
6 libgourou is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 libgourou is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with libgourou. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef _FULFILLMENT_ITEM_H_
21#define _FULFILLMENT_ITEM_H_
22
23#include "loan_token.h"
24
25#include <pugixml.hpp>
26
27namespace gourou
28{
29 class User;
30
31 /**
32 * @brief This class is a container for a fulfillment object
33 */
34 class FulfillmentItem
35 {
36 public:
37/**
38 * @brief Main constructor. Not to be called by user
39 *
40 * @param doc Fulfill reply
41 * @param user User pointer
42 */
43FulfillmentItem(pugi::xml_document& doc, User* user);
44
45~FulfillmentItem();
46
47/**
48 * @brief Return metadata value from ACSM metadata section
49 *
50 * @param name Name of key to return
51 */
52std::string getMetadata(std::string name);
53
54/**
55 * @brief Return rights generated by ACS server (XML format)
56 */
57std::string getRights();
58
59/**
60 * @brief Return epub download URL
61 */
62std::string getDownloadURL();
63
64/**
65 * @brief Return resource value
66 */
67std::string getResource();
68
69/**
70 * @brief Return loan token if there is one
71 */
72LoanToken* getLoanToken();
73
74 private:
75pugi::xml_document fulfillDoc;
76pugi::xml_node metadatas;
77pugi::xml_document rights;
78std::string downloadURL;
79std::string resource;
80LoanToken* loanToken;
81
82void buildRights(const pugi::xml_node& licenseToken, User* user);
83 };
84}
85
86#endif

Archive Download this file