Class: ProconBypassMan::RemotePbmJobObject

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb

Defined Under Namespace

Classes: MustBeNotNilError, NonSupportAction, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, status:, uuid:, created_at:, job_args:) ⇒ RemotePbmJobObject

Returns a new instance of RemotePbmJobObject.

Parameters:

  • action (String)
  • status (String)
  • #uuid (String)
  • created_at (Time)
  • job_args (Hash)


15
16
17
18
19
20
21
22
23
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 15

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

Instance Attribute Details

#actionObject

Returns the value of attribute action.



8
9
10
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 8

def action
  @action
end

#created_atObject

Returns the value of attribute created_at.



8
9
10
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 8

def created_at
  @created_at
end

#job_argsObject

Returns the value of attribute job_args.



8
9
10
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 8

def job_args
  @job_args
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 8

def status
  @status
end

#uuidObject

Returns the value of attribute uuid.



8
9
10
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 8

def uuid
  @uuid
end

Instance Method Details

#validate!void

This method returns an undefined value.



28
29
30
31
32
33
34
35
36
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/value_objects/remote_pbm_job_object.rb', line 28

def validate!
  self.action or raise MustBeNotNilError, "actionは値が必須です"
  self.status or raise MustBeNotNilError, "statusは値が必須です"
  self.uuid or raise MustBeNotNilError, "uuidは値が必須です"

  unless ProconBypassMan::RemoteAction::RemotePbmJob::ACTIONS.include?(action)
    raise NonSupportAction, "知らないアクションです"
  end
end