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.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 65

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.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 43

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)


88
89
90
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 88

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.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb', line 21

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