Class: SealineInsurance::Operations::Base
- Inherits:
-
Object
- Object
- SealineInsurance::Operations::Base
- Defined in:
- lib/sealine_insurance/operations/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Промежуточный ответ сервера.
Instance Method Summary collapse
-
#call ⇒ Object
Запуск операции.
-
#fetch_status! ⇒ Object
Получение актуального статуса выполнения и результата.
-
#finished? ⇒ Boolean
Завершена ли операция (с успехом или ошибкой).
-
#initialize(config:) ⇒ Base
constructor
A new instance of Base.
-
#result ⇒ Object
Окончательный результат операции (успешный или нет).
-
#success? ⇒ Boolean
Завершена ли операция с успехом.
Constructor Details
#initialize(config:) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/sealine_insurance/operations/base.rb', line 13 def initialize(config:) @config = config end |
Instance Attribute Details
#response ⇒ Object (readonly)
Промежуточный ответ сервера
11 12 13 |
# File 'lib/sealine_insurance/operations/base.rb', line 11 def response @response end |
Instance Method Details
#call ⇒ Object
Запуск операции
18 19 20 |
# File 'lib/sealine_insurance/operations/base.rb', line 18 def call raise NotImplementedError end |
#fetch_status! ⇒ Object
Получение актуального статуса выполнения и результата
23 24 25 |
# File 'lib/sealine_insurance/operations/base.rb', line 23 def fetch_status! raise NotImplementedError end |
#finished? ⇒ Boolean
Завершена ли операция (с успехом или ошибкой)
28 29 30 |
# File 'lib/sealine_insurance/operations/base.rb', line 28 def finished? response.error? || finished_status_list.include?(response.status) end |
#result ⇒ Object
Окончательный результат операции (успешный или нет)
38 39 40 |
# File 'lib/sealine_insurance/operations/base.rb', line 38 def result response if finished? end |
#success? ⇒ Boolean
Завершена ли операция с успехом
33 34 35 |
# File 'lib/sealine_insurance/operations/base.rb', line 33 def success? response.success? && success_status_list.include?(response.status) end |