Sha256: 1091e46bd2dc34f1b9c903884c3108921365b4a17e560f9b898739e1c10c9775
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require "monban/core" require "monban/use_case/base" require "getto/params" module Monban module UseCase module Auth module Verify class Authy < Base initialize_with( error: Monban::Core::ERRORS, authy: [:verify], repository: [ :authy_id, ], ) def verify(params) Getto::Params.new.validate(params) do |v| v.hash( account_id: v.integer {|val| param_error!(account_id: val) }, authy_token: v.combine([v.string, v.not_empty]){|val| param_error!(authy_token: val) }, ) end or param_error!(params: params) authy_id = repository.authy_id( account_id: params[:account_id], ) or error.invalid_account! "account_id: #{params[:account_id]}" authy.verify( authy_id: authy_id, authy_token: params[:authy_token], ) or error.invalid_account! "authy_token unmatched" nil end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems