Sha256: dfec788b136eb3e07dfacaa2076684522331bebaa6da80cf98dcbe895f1da4a4

Contents?: true

Size: 765 Bytes

Versions: 3

Compression:

Stored size: 765 Bytes

Contents

require "monban/core"
require "getto/initialize_with"

require "monban/use_case/auth/token/full"
require "monban/use_case/auth/token/authy"

module Monban
  module UseCase
    module Auth
      module Token
        class General
          include Getto::InitializeWith

          initialize_with(
            error: Monban::Core::ERRORS,
            login: Symbol,
            full:  Full,
            authy: Authy,
          )

          def create(account_id:)
            case login
            when :full  then full.create(account_id: account_id)
            when :authy then authy.create(account_id: account_id)
            else
              error.server_error! "invalid login: #{login}"
            end
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
monban-core-1.0.3 lib/monban/use_case/auth/token/general.rb
monban-core-1.0.2 lib/monban/use_case/auth/token/general.rb
monban-core-1.0.0 lib/monban/use_case/auth/token/general.rb