Sha256: 2b2e6c3fa86ccd2bd324a53e86c89b8fc560f0b18453312519cecb2828d5c101
Contents?: true
Size: 1.2 KB
Versions: 12
Compression:
Stored size: 1.2 KB
Contents
module ProconBypassMan class RemotePbmActionObject # valueobjectがvalidatorの責務も持っている. 今度分離する class ValidationError < StandardError; end class MustBeNotNilError < ValidationError; end class NonSupportAction < ValidationError; end attr_accessor :action, :status, :uuid, :created_at, :job_args # @param [String] action # @param [String] status # @param [String] #uuid # @param [Time] created_at # @return [Hash] job_args def initialize(action: , status:, uuid:, created_at:, job_args: ) self.action = action self.status = status self.uuid = uuid self.created_at = created_at self.job_args = job_args freeze end # @raise [MustBeNotNilError] # @raise [NonSupportAction] # @return [void] def validate! self.action or raise MustBeNotNilError, "actionは値が必須です" self.status or raise MustBeNotNilError, "statusは値が必須です" self.uuid or raise MustBeNotNilError, "uuidは値が必須です" unless ProconBypassMan::RemotePbmAction::ACTIONS.include?(action) raise NonSupportAction, "知らないアクションです" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems