Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
fix(#82): repository -> notifier (#84)
Browse files Browse the repository at this point in the history
* Change name repository by notifier
* Fix imports
* Add documentation
  • Loading branch information
tripledes committed Dec 23, 2019
1 parent d07e724 commit 0449fe7
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 11 deletions.
Binary file modified doc/build/doctrees/application.doctree
Binary file not shown.
Binary file modified doc/build/doctrees/environment.pickle
Binary file not shown.
7 changes: 6 additions & 1 deletion doc/build/html/_sources/application.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ Outlaw
.. module:: thesheriff.application.outlaw.rate_raid
.. autoclass:: RateRaid
:members:
.. _invite_friend:
.. module:: thesheriff.application.outlaw.invite_friend
.. autoclass:: InviteFriend
:members:
.. _create_outlaw_request:
.. module:: thesheriff.application.outlaw.request.create_outlaw_request
.. autoclass:: CreateOutlawRequest
:members:


Raid
----

Expand All @@ -57,4 +62,4 @@ Raid
.. _grade_raid:
.. module:: thesheriff.application.raid.grade_raid
.. autoclass:: GradeRaid
:members:
:members:
28 changes: 28 additions & 0 deletions doc/build/html/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,34 @@ <h2>Outlaw<a class="headerlink" href="#outlaw" title="Permalink to this headline

</dd></dl>

<span class="target" id="module-thesheriff.application.outlaw.invite_friend"><span id="invite-friend"></span></span><dl class="class">
<dt id="thesheriff.application.outlaw.invite_friend.InviteFriend">
<em class="property">class </em><code class="sig-prename descclassname">thesheriff.application.outlaw.invite_friend.</code><code class="sig-name descname">InviteFriend</code><span class="sig-paren">(</span><em class="sig-param">mail_notifier: thesheriff.domain.mail.notifier.mail_notifier.MailNotifier</em><span class="sig-paren">)</span><a class="headerlink" href="#thesheriff.application.outlaw.invite_friend.InviteFriend" title="Permalink to this definition"></a></dt>
<dd><p>Class InviteFriend implements the invite a friend use case.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>mail_notifier</strong> (<em>MailNotifier</em>) – Repository managing the Gang domain entities.</p>
</dd>
</dl>
<dl class="method">
<dt id="thesheriff.application.outlaw.invite_friend.InviteFriend.execute">
<code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">receiver_mail_address</em><span class="sig-paren">)</span><a class="headerlink" href="#thesheriff.application.outlaw.invite_friend.InviteFriend.execute" title="Permalink to this definition"></a></dt>
<dd><p>execute is the actual action of the Invite Friend use case.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_mail_address</strong> (<em>String</em>) – The address to write on the TO field.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>No value returned.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>NoReturn</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<span class="target" id="module-thesheriff.application.outlaw.request.create_outlaw_request"><span id="create-outlaw-request"></span></span><dl class="class">
<dt id="thesheriff.application.outlaw.request.create_outlaw_request.CreateOutlawRequest">
<em class="property">class </em><code class="sig-prename descclassname">thesheriff.application.outlaw.request.create_outlaw_request.</code><code class="sig-name descname">CreateOutlawRequest</code><span class="sig-paren">(</span><em class="sig-param">name: str</em>, <em class="sig-param">email: str</em><span class="sig-paren">)</span><a class="headerlink" href="#thesheriff.application.outlaw.request.create_outlaw_request.CreateOutlawRequest" title="Permalink to this definition"></a></dt>
Expand Down
17 changes: 15 additions & 2 deletions doc/build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h1 id="index">Index</h1>
| <a href="#C"><strong>C</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#J"><strong>J</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
Expand Down Expand Up @@ -103,6 +104,8 @@ <h2 id="E">E</h2>

<ul>
<li><a href="application.html#thesheriff.application.outlaw.create_outlaw.CreateOutlaw.execute">(thesheriff.application.outlaw.create_outlaw.CreateOutlaw method)</a>
</li>
<li><a href="application.html#thesheriff.application.outlaw.invite_friend.InviteFriend.execute">(thesheriff.application.outlaw.invite_friend.InviteFriend method)</a>
</li>
<li><a href="application.html#thesheriff.application.outlaw.join_gang.JoinGang.execute">(thesheriff.application.outlaw.join_gang.JoinGang method)</a>
</li>
Expand Down Expand Up @@ -140,6 +143,14 @@ <h2 id="G">G</h2>
</ul></td>
</tr></table>

<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="application.html#thesheriff.application.outlaw.invite_friend.InviteFriend">InviteFriend (class in thesheriff.application.outlaw.invite_friend)</a>
</li>
</ul></td>
</tr></table>

<h2 id="J">J</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down Expand Up @@ -242,6 +253,8 @@ <h2 id="T">T</h2>
<li><a href="application.html#module-thesheriff.application.outlaw.create_gang">thesheriff.application.outlaw.create_gang (module)</a>
</li>
<li><a href="application.html#module-thesheriff.application.outlaw.create_outlaw">thesheriff.application.outlaw.create_outlaw (module)</a>
</li>
<li><a href="application.html#module-thesheriff.application.outlaw.invite_friend">thesheriff.application.outlaw.invite_friend (module)</a>
</li>
<li><a href="application.html#module-thesheriff.application.outlaw.join_gang">thesheriff.application.outlaw.join_gang (module)</a>
</li>
Expand All @@ -260,11 +273,11 @@ <h2 id="T">T</h2>
<li><a href="domain.html#module-thesheriff.domain">thesheriff.domain (module)</a>
</li>
<li><a href="domain.html#module-thesheriff.domain.gang.gang">thesheriff.domain.gang.gang (module)</a>
</li>
<li><a href="domain.html#module-thesheriff.domain.gang.gang_factory">thesheriff.domain.gang.gang_factory (module)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="domain.html#module-thesheriff.domain.gang.gang_factory">thesheriff.domain.gang.gang_factory (module)</a>
</li>
<li><a href="domain.html#module-thesheriff.domain.gang.repository.gang_repository">thesheriff.domain.gang.repository.gang_repository (module)</a>
</li>
<li><a href="domain.html#module-thesheriff.domain.outlaw.outlaw">thesheriff.domain.outlaw.outlaw (module)</a>
Expand Down
Binary file modified doc/build/html/objects.inv
Binary file not shown.
5 changes: 5 additions & 0 deletions doc/build/html/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ <h1>Python Module Index</h1>
<td>&#160;&#160;&#160;
<a href="application.html#module-thesheriff.application.outlaw.create_outlaw"><code class="xref">thesheriff.application.outlaw.create_outlaw</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="application.html#module-thesheriff.application.outlaw.invite_friend"><code class="xref">thesheriff.application.outlaw.invite_friend</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
Expand Down
2 changes: 1 addition & 1 deletion doc/build/html/searchindex.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion doc/source/application.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ Outlaw
.. module:: thesheriff.application.outlaw.rate_raid
.. autoclass:: RateRaid
:members:
.. _invite_friend:
.. module:: thesheriff.application.outlaw.invite_friend
.. autoclass:: InviteFriend
:members:
.. _create_outlaw_request:
.. module:: thesheriff.application.outlaw.request.create_outlaw_request
.. autoclass:: CreateOutlawRequest
:members:


Raid
----

Expand All @@ -57,4 +62,4 @@ Raid
.. _grade_raid:
.. module:: thesheriff.application.raid.grade_raid
.. autoclass:: GradeRaid
:members:
:members:
22 changes: 17 additions & 5 deletions thesheriff/application/outlaw/invite_friend.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import inject
from thesheriff.domain.mail.mail import Mail
from thesheriff.domain.mail.repository.mail_notification \
import MailNotification
from thesheriff.domain.mail.notifier.mail_notifier import MailNotifier
from thesheriff.domain.outlaw.outlaw import Outlaw
from typing import NoReturn


class InviteFriend:
"""Class InviteFriend implements the invite a friend use case.
:param mail_notifier: Repository managing the Gang domain entities.
:type mail_notifier: MailNotifier
"""

@inject.autoparams()
def __init__(self, mail_repository: MailNotification):
self.mail_repository = mail_repository
def __init__(self, mail_notifier: MailNotifier):
self.__mail_notifier = mail_notifier

def execute(self, receiver_mail_address):
"""execute is the actual action of the Invite Friend use case.
:param receiver_mail_address: The address to write on the TO field.
:type receiver_mail_address: String
:return: No value returned.
:rtype: NoReturn
"""
sender = Outlaw.get_email()
receiver = receiver_mail_address
mail = Mail.mail_invite_friend(sender, receiver)
self.mail_repository.send(mail)
self.__mail_notifier.send(mail)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from thesheriff.domain.mail.mail import Mail


class MailNotification(abc.ABC):
class MailNotifier(abc.ABC):

@abc.abstractmethod
def send(self, mail: Mail):
Expand Down

0 comments on commit 0449fe7

Please sign in to comment.