This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input = "SOME INPUT FORM WHATEVER" | |
| Notifier.build(input).call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Notifier | |
| class << self | |
| def build(input) | |
| new( | |
| input, | |
| Parser.new, | |
| Gateway.new | |
| ) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parser = Parser.new | |
| gateway = Gateway.new | |
| input = "SOME INPUT FORM WHATEVER" | |
| Notifier.new(input, parser, gateway).call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Notifier | |
| def initialize(input, parser, gateway) | |
| @input = input | |
| @parser = parser | |
| @gateway = gateway | |
| end | |
| def call | |
| parsed_input = parser.parse(input) | |
| gateway.call(parsed_input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Notifier | |
| def initialize(input, parser, gateway) | |
| @input = input | |
| @parser = parser | |
| @gateway = gateway | |
| end | |
| def call | |
| parsed_input = parser.parse(input) | |
| gateway.call(parsed_input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SendDayResults | |
| ELIGIBLE_ROLES = {regular: 1, vip: 2} | |
| attr_reader :user | |
| def initialize(user) | |
| @user = user | |
| end | |
| def call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= current_user(@conn) %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def current_user(conn) do | |
| conn.assigns[:current_user] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plug ElixirStream.Plugs.CheckAuthentication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ElixirStream.Plugs.CheckAuthentication do | |
| import Plug.Conn | |
| import Plug.Session | |
| def init(options) do | |
| options | |
| end | |
| def call(conn, _) do | |
| user_id = get_session(conn, :user_id) |