Module: ConvenientService::Service::Plugins::HasJSendResult::Concern::ClassMethods

Defined in:
lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#error(service: new_without_initialize, data: Constants::DEFAULT_ERROR_DATA, message: Constants::DEFAULT_ERROR_MESSAGE, code: Constants::DEFAULT_ERROR_CODE) ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 60

def error(
  service: new_without_initialize,
  data: Constants::DEFAULT_ERROR_DATA,
  message: Constants::DEFAULT_ERROR_MESSAGE,
  code: Constants::DEFAULT_ERROR_CODE
)
  result_class.new(
    service: service,
    status: Constants::ERROR_STATUS,
    data: data,
    message: message,
    code: code
  )
end

#failure(service: new_without_initialize, data: Constants::DEFAULT_FAILURE_DATA, message: Constants::DEFAULT_FAILURE_MESSAGE, code: Constants::DEFAULT_FAILURE_CODE) ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 38

def failure(
  service: new_without_initialize,
  data: Constants::DEFAULT_FAILURE_DATA,
  message: Constants::DEFAULT_FAILURE_MESSAGE,
  code: Constants::DEFAULT_FAILURE_CODE
)
  result_class.new(
    service: service,
    status: Constants::FAILURE_STATUS,
    data: data,
    message: message,
    code: code
  )
end

#result_classClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Class)


83
84
85
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 83

def result_class
  @result_class ||= Commands::CreateResultClass.call(service_class: self)
end

#success(service: new_without_initialize, data: Constants::DEFAULT_SUCCESS_DATA, message: Constants::DEFAULT_SUCCESS_MESSAGE, code: Constants::DEFAULT_SUCCESS_CODE) ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 16

def success(
  service: new_without_initialize,
  data: Constants::DEFAULT_SUCCESS_DATA,
  message: Constants::DEFAULT_SUCCESS_MESSAGE,
  code: Constants::DEFAULT_SUCCESS_CODE
)
  result_class.new(
    service: service,
    status: Constants::SUCCESS_STATUS,
    data: data,
    message: message,
    code: code
  )
end