Class: EtFakeCcd::EcmService
- Inherits:
-
Object
- Object
- EtFakeCcd::EcmService
- Defined in:
- lib/et_fake_ccd/ecm_service.rb
Overview
noinspection RubyStringKeysInHashInspection
Defined Under Namespace
Classes: InMemoryAdapter, Response
Constant Summary collapse
- OFFICE_CODE_LOOKUP =
{ 'Manchester' => '24', 'Glasgow' => '41', 'Test1' => '60', 'Test2' => '61', 'Test3' => '62', 'Test4' => '63', 'Test5' => '64', 'Test6' => '65', 'Test7' => '66', 'Test8' => '67', 'Test9' => '68', 'Test10' => '69' }
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(command) ⇒ EcmService
constructor
A new instance of EcmService.
Constructor Details
#initialize(command) ⇒ EcmService
Returns a new instance of EcmService.
26 27 28 |
# File 'lib/et_fake_ccd/ecm_service.rb', line 26 def initialize(command) @command = command end |
Class Method Details
.start_multiple(command) ⇒ EtFakeCcd::EcmService::Response
Returns The response.
21 22 23 |
# File 'lib/et_fake_ccd/ecm_service.rb', line 21 def self.start_multiple(command) new(command).call end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 |
# File 'lib/et_fake_ccd/ecm_service.rb', line 30 def call start_reference = adapter.reserve_reference_numbers_for(command.case_type_id, quantity: command.case_ref_number_count) formatted_ref = "#{office_code_for(command.case_type_id)}#{start_reference.to_s.rjust(5, '0')}/#{Time.now.year}" formatted_multiple = "#{office_code_for(command.case_type_id)}#{adapter.build_multiple_reference(command.case_type_id).to_s.rjust(5, '0')}/#{Time.now.year}" Response.new(command.case_ref_number_count, formatted_ref, formatted_multiple).freeze end |