The Sheriff Domain

This part of the documentation covers all interfaces on thesheriff.domain package.

Gang

class thesheriff.domain.gang.gang.Gang(owner_id: int, name: str, gang_id: Optional[int] = None)

Class Gang, the Gang domain entity class.

Parameters
  • owner_id (Integer) – Outlaw’s Id, owner of the new Gang.

  • name (String) – Given name of the Gang.

  • gang_id (Integer) – Optional, Gang Id.

add_members(members: list) → NoReturn

Method add_members.

Parameters

members (List) – List of Outlaws on the Gang.

Returns

No value returned.

Return type

NoReturn

members() → list

Method members.

Returns

The list of Outlaws, members of the Gang.

Return type

list

score()
class thesheriff.domain.gang.gang_factory.GangFactory(owner_id: int, name: str, gang_id: Optional[int] = None)

Class GangFactory produces Gangs.

static create(owner_id: int, name: str, gang_id: Optional[int] = None) → thesheriff.domain.gang.gang.Gang

Method create, produces a Gang instance.

Parameters
  • owner_id (Integer) – Outlaw’s Id, who is creating the Gang.

  • name (String) – Given name of the Gang.

  • gang_id (Integer) – Optional, Gang’s Id.

Returns

The created Gang.

Return type

Gang

static create_with_id(gang_id: int) → thesheriff.domain.gang.gang.Gang

Method create, produces a Gang instance with just its Id.

Parameters

gang_id (Integer) – Gang’s Id.

Returns

The created Gang.

Return type

Gang

class thesheriff.domain.gang.repository.gang_repository.GangRepository

Interface GangRepository, defines how all gang repository implementations will behave.

abstract add(new_gang: thesheriff.domain.gang.gang.Gang) → thesheriff.domain.gang.gang.Gang
abstract all() → List[thesheriff.domain.gang.gang.Gang]
abstract of_id(gang_id: int) → thesheriff.domain.gang.gang.Gang
abstract remove(gang_id: int) → NoReturn
abstract update(mod_gang: thesheriff.domain.gang.gang.Gang) → NoReturn

Outlaw

class thesheriff.domain.outlaw.outlaw.Outlaw(name: str, email: str, outlaw_id: Optional[int] = None)

Class Outlaw represents the Outlaw domain entity.

Parameters
  • name (String) – Outlaw’s given name.

  • email (String) – Outlaw’s email address.

  • outlaw_id (Integer) – Optional, Outlaw Id.

get_email() → str

Method get_email, returns Outlaw’s email address.

Returns

The email address.

Return type

String

join_gang(gang: thesheriff.domain.gang.gang.Gang) → NoReturn

Method join_banda

Parameters

gang (Gang) – The Gang instance to which to join

Returns

No returned value.

Return type

NoReturn

class thesheriff.domain.outlaw.sheriff.Sheriff(name: str, email: str, outlaw_id: Optional[int] = None)
get_score() → float

Method get_score access to the current Sheriff’s score.

Returns

The current score.

Return type

Float

update_score(score: float) → NoReturn

Method update_score updates the Sheriff’s score.

Parameters

score (Float) – New score to be added up.

Returns

No returned value.

Return type

NoReturn.

class thesheriff.domain.outlaw.score.Score(food_quantity: float, food_quality: float, service_quality: float, price: float)

Score implements the score type for Raids.

Parameters
  • food_quantity (float.) – score for the amount of food

  • food_quality (float.) – score for the quality of food

  • service_quality (float.) – score for the service

  • price (float.) – score for the price

value() → float

value calculates the average score for a Raid.

Returns

The actual score.

Return type

Float

class thesheriff.domain.outlaw.outlaw_factory.OutlawFactory(name: str, email: str, outlaw_id: Optional[int] = None)

Class OutlawFactory produces Outlaws.

static create(name: str, email: str, outlaw_id: Optional[int] = None) → thesheriff.domain.outlaw.outlaw.Outlaw

Method create, produces an Outlaw instance.

Parameters
  • name (String) – Outlaw’s given name.

  • email (String) – Outlaw’s email.

  • outlaw_id (Integer) – Optional, Outlaw’s Id.

Returns

The produced Outlaw.

Return type

Outlaw

static create_with_id(outlaw_id: int) → thesheriff.domain.outlaw.outlaw.Outlaw

Method create, produces a Outlaw instance with just its Id.

Parameters

outlaw_id (Integer) – Outlaw’s Id.

Returns

The created Outlaw.

Return type

Outlaw

class thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository

Interface OutlawRepository, defines how all outlaw repository implementations will behave.

abstract add(new_outlaw: thesheriff.domain.outlaw.outlaw.Outlaw) → thesheriff.domain.outlaw.outlaw.Outlaw
abstract all() → List[thesheriff.domain.outlaw.outlaw.Outlaw]
abstract get_friends(outlaw_id: int) → List[thesheriff.domain.outlaw.outlaw.Outlaw]
abstract of_id(outlaw_id: int) → thesheriff.domain.outlaw.outlaw.Outlaw
abstract remove(outlaw_id: int) → NoReturn
abstract update(mod_outlaw: thesheriff.domain.outlaw.outlaw.Outlaw) → NoReturn

Raid

class thesheriff.domain.raid.raid.Raid(name: str, members: List[thesheriff.domain.outlaw.outlaw.Outlaw], sheriff: thesheriff.domain.outlaw.sheriff.Sheriff, gang: thesheriff.domain.gang.gang.Gang, location: str, date: str, raid_id: Optional[int] = None, rates: Optional[List[float]] = [])

Class Raid represents the Raid entity.

Parameters
  • name (String) – The Raid given name.

  • members (List[Outlaw]) – List of Outlaws invited to the Raid.

  • sheriff (Sheriff) – The Raid organizer.

  • gang (Gang) – Gang where the raid is organized.

  • location (String) – Restaurant location.

  • date (String) – Date and time when the raid happens.

  • raid_id (Integer) – Optional, Raid Id.

  • rates – Optional, list with assigned rates.

Type

rates: List[float]

DEFAULT_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
add_rate(rate: float) → NoReturn

Method add_rate, adds a new rate for the Raid.

Parameters

rate (Float) – The rate to be added.

Returns

No value returned.

Return type

NoReturn

could_finish() → bool

Method could_finish.

Returns

Whether each member has rated the Raid.

Return type

Bool

join(outlaw: thesheriff.domain.outlaw.outlaw.Outlaw) → NoReturn

Method join, joins an Outlaw into a Raid.

Parameters

outlaw (Outlaw) – The Outlaw joining this Raid.

Returns

No value returned.

Return type

NoReturn

class thesheriff.domain.raid.raid_factory.RaidFactory(name: str, members: List[thesheriff.domain.outlaw.outlaw.Outlaw], sheriff: thesheriff.domain.outlaw.sheriff.Sheriff, gang: thesheriff.domain.gang.gang.Gang, location: str, date: str, raid_id: Optional[int] = None, rates: Optional[List[float]] = [])

Class RaidFactory produces Raids.

static create(name: str, members: List[thesheriff.domain.outlaw.outlaw.Outlaw], sheriff: thesheriff.domain.outlaw.sheriff.Sheriff, gang: thesheriff.domain.gang.gang.Gang, location: str, date: str, raid_id: Optional[int] = None, rates: Optional[List[float]] = []) → thesheriff.domain.raid.raid.Raid

Method create, produces a Raid instance.

Parameters
  • name (String) – Outlaw’s given name.

  • members (List[Outlaw]) – Outlaws invited to raid.

  • sheriff (Sheriff) – The Outlaw organizing the Raid.

  • gang (Gang) – Gang this Raid is organized for.

  • location (String) – Location of the raid.

  • date (String) – Raid’s date and time.

  • raid_id (Integer) – Optional, Raid’s Id.

  • rates – Optional, list with assigned rates.

Type

rates: List[float]

Returns

The produced Raid.

Return type

Raid

class thesheriff.domain.raid.repository.raid_repository.RaidRepository

Interface RaidRepository, defines how all raid repository implementations will behave.

abstract add(new_raid: thesheriff.domain.raid.raid.Raid) → thesheriff.domain.raid.raid.Raid
abstract of_id(raid_id: int) → thesheriff.domain.raid.raid.Raid
abstract update(mod_raid: thesheriff.domain.raid.raid.Raid) → NoReturn
abstract update_rates(Raid) → NoReturn

Mail

class thesheriff.domain.mail.mail.Mail(sender: str, receiver: str, content: str)
class thesheriff.domain.mail.notifier.mail_notifier.MailNotifier

Interface MailNotifier, defines how all mail notifier implementations will behave.

abstract send(mail: thesheriff.domain.mail.mail.Mail)