donation¶
A class to hold the Donation attributes and methods.
-
class
eldonationtracker.donation.
Donation
(name, message, amount, donor_id, avatar_url, donation_date, donation_id)¶ Bases:
object
Donation Attributes.
- Class exists to provide attributes for a donation based on what comes in from the JSON so that it doesn’t have to be
traversed each time a donor action needs to be taken.
- Parameters
name (str) – the name of the donor for this donation. If the donor wished to stay anonymous, the variable is set to/ “Anonymous”
message (str) – the message associated with the donation.
amount (int) – the amount of the donation. If they blocked it from showing it is set to 0.
-
get_amount
()¶
-
eldonationtracker.donation.
format_donation_information_for_output
(donation_list: list, currency_symbol: str, donors_to_display: str, team: bool) → dict¶ Format the donation attributes for the output files.
-
eldonationtracker.donation.
get_donations
(donations: list, donation_url: str) → list¶ Get the donations from the JSON and create the donation objects.
If the API can’t be reached, the same list is returned. Only new donations are added to the list at the end.
- Parameters
donations – A list consisting of donor.Donation objects.
donation_url – The URL to go to for donations.
- Returns
A list of donor.Donation objects.