Class: Belpost::Models::BatchStatus
- Inherits:
-
Object
- Object
- Belpost::Models::BatchStatus
- Defined in:
- lib/belpost/models/batch_status.rb
Overview
Helper class for batch status translations and utilities
Constant Summary collapse
- TRANSLATIONS =
Mapping of status codes to their Russian translations
{ "uncommitted" => "В обработке", "committed" => "Сформирована" }.freeze
Class Method Summary collapse
-
.all ⇒ Array<String>
Get all possible statuses.
-
.translate(status) ⇒ String
Get the Russian translation for a status.
-
.valid?(status) ⇒ Boolean
Check if a status is valid.
Class Method Details
.all ⇒ Array<String>
Get all possible statuses
24 25 26 |
# File 'lib/belpost/models/batch_status.rb', line 24 def self.all %w[uncommitted committed] end |
.translate(status) ⇒ String
Get the Russian translation for a status
17 18 19 |
# File 'lib/belpost/models/batch_status.rb', line 17 def self.translate(status) TRANSLATIONS[status] || status end |
.valid?(status) ⇒ Boolean
Check if a status is valid
32 33 34 |
# File 'lib/belpost/models/batch_status.rb', line 32 def self.valid?(status) all.include?(status) end |