Class: Dor::StaticConfig::WorkflowConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/static_config/workflow_config.rb

Overview

Represents the configuration for the workflow service

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ WorkflowConfig

Returns a new instance of WorkflowConfig.



7
8
9
10
11
12
# File 'lib/dor/static_config/workflow_config.rb', line 7

def initialize(hash)
  @url = hash.fetch(:url)
  @timeout = hash.fetch(:timeout)
  @logfile = hash.fetch(:logfile)
  @shift_age = hash.fetch(:shift_age)
end

Instance Method Details

#clientObject



18
19
20
# File 'lib/dor/static_config/workflow_config.rb', line 18

def client
  @client ||= Dor::Workflow::Client.new(url: url, logger: client_logger, timeout: timeout)
end

#client_loggerObject



42
43
44
45
46
47
48
# File 'lib/dor/static_config/workflow_config.rb', line 42

def client_logger
  if logfile && shift_age
    Logger.new(logfile, shift_age)
  elsif logfile
    Logger.new(logfile)
  end
end

#configure(&block) ⇒ Object



14
15
16
# File 'lib/dor/static_config/workflow_config.rb', line 14

def configure(&block)
  instance_eval(&block)
end

#logfile(new_value = nil) ⇒ Object



32
33
34
35
# File 'lib/dor/static_config/workflow_config.rb', line 32

def logfile(new_value = nil)
  @logfile = new_value if new_value
  @logfile
end

#shift_age(new_value = nil) ⇒ Object



37
38
39
40
# File 'lib/dor/static_config/workflow_config.rb', line 37

def shift_age(new_value = nil)
  @shift_age = new_value if new_value
  @shift_age
end

#timeout(new_value = nil) ⇒ Object



27
28
29
30
# File 'lib/dor/static_config/workflow_config.rb', line 27

def timeout(new_value = nil)
  @timeout = new_value if new_value
  @timeout
end

#url(new_value = nil) ⇒ Object



22
23
24
25
# File 'lib/dor/static_config/workflow_config.rb', line 22

def url(new_value = nil)
  @url = new_value if new_value
  @url
end