Module: ConvenientService::Service::Plugins::HasJSendResult Private

Defined in:
lib/convenient_service/service/plugins/has_j_send_result.rb,
lib/convenient_service/service/plugins/has_j_send_result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/constants.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result.rb,
lib/convenient_service/service/plugins/has_j_send_result/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/aliases.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_called/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_strict/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_step/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_called/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_negated_result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_fallback/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_exception/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_stubbed_result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_parent_result/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_parent_result/constants.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_amazing_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_pattern_matching_support/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_unhandled_exception/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/middleware.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_amazing_print_inspect/commands/generate_inspect_output.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/commands/generate_inspect_output.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/structs/j_send_attributes.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects/exceptions.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/entities/key_modes.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/entities/key_modes/one.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/entities/key_modes/base.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/entities/key_modes/many.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_used_in_service_aware_enumerables/entities/key_modes/none.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/cast_j_send_attributes.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/class_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/helps_to_learn_similarities_with_common_objects/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/middleware.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_method_readers/middleware.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_amazing_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_amazing_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_awesome_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_amazing_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_amazing_print_inspect/concern.rb,
lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_awesome_print_inspect/concern.rb

Overview

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

Since:

  • 1.0.0

Defined Under Namespace

Modules: Concern, Constants, Entities

Class Method Summary collapse

Class Method Details

.default_error_codeSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



97
98
99
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 97

def default_error_code
  Constants::DEFAULT_ERROR_CODE
end

.default_error_dataHash{Symbol => Object}

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:

  • (Hash{Symbol => Object})

Since:

  • 1.0.0



55
56
57
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 55

def default_error_data
  Constants::DEFAULT_ERROR_DATA
end

.default_error_messageString

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:

  • (String)

Since:

  • 1.0.0



76
77
78
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 76

def default_error_message
  Constants::DEFAULT_ERROR_MESSAGE
end

.default_failure_codeSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



90
91
92
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 90

def default_failure_code
  Constants::DEFAULT_FAILURE_CODE
end

.default_failure_dataHash{Symbol => Object}

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:

  • (Hash{Symbol => Object})

Since:

  • 1.0.0



48
49
50
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 48

def default_failure_data
  Constants::DEFAULT_FAILURE_DATA
end

.default_failure_messageString

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:

  • (String)

Since:

  • 1.0.0



69
70
71
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 69

def default_failure_message
  Constants::DEFAULT_FAILURE_MESSAGE
end

.default_success_codeSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



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

def default_success_code
  Constants::DEFAULT_SUCCESS_CODE
end

.default_success_dataHash{Symbol => Object}

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:

  • (Hash{Symbol => Object})

Since:

  • 1.0.0



41
42
43
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 41

def default_success_data
  Constants::DEFAULT_SUCCESS_DATA
end

.default_success_messageString

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:

  • (String)

Since:

  • 1.0.0



62
63
64
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 62

def default_success_message
  Constants::DEFAULT_SUCCESS_MESSAGE
end

.error_statusSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



34
35
36
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 34

def error_status
  Constants::ERROR_STATUS
end

.failure_statusSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



27
28
29
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 27

def failure_status
  Constants::FAILURE_STATUS
end

.result?(result) ⇒ Boolean

Checks whether an object is a result instance.

Examples:

Simple usage.

class Service
  include ConvenientService::Standard::Config

  def result
    success
  end
end

result = Service.result

ConvenientService::Plugins::Service::HasJSendResult.result?(result)
# => true

ConvenientService::Plugins::Service::HasJSendResult.result?(result.class)
# => false

ConvenientService::Plugins::Service::HasJSendResult.result?(42)
# => false

Parameters:

  • result (Object)

    Can be any type.

Returns:

  • (Boolean)

Since:

  • 1.0.0



163
164
165
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 163

def result?(result)
  result_class?(result.class)
end

.result_class?(result_class) ⇒ Boolean

Checks whether an object is a result class.

Examples:

Simple usage.

class Service
  include ConvenientService::Standard::Config

  def result
    success
  end
end

result = Service.result

ConvenientService::Plugins::Service::HasJSendResult.result_class?(result.class)
# => true

ConvenientService::Plugins::Service::HasJSendResult.result_class?(result)
# => false

ConvenientService::Plugins::Service::HasJSendResult.result_class?(42)
# => false

Parameters:

  • result_class (Object)

    Can be any type.

Returns:

  • (Boolean)

Since:

  • 1.0.0



129
130
131
132
133
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 129

def result_class?(result_class)
  return false unless result_class.instance_of?(::Class)

  result_class.include?(Entities::Result::Concern)
end

.success_statusSymbol

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:

  • (Symbol)

Since:

  • 1.0.0



20
21
22
# File 'lib/convenient_service/service/plugins/has_j_send_result.rb', line 20

def success_status
  Constants::SUCCESS_STATUS
end