Class: Foobara::CommandRegistry::ExposedCommand
- Inherits:
-
Object
- Object
- Foobara::CommandRegistry::ExposedCommand
- Includes:
- IsManifestable, Scoped, TruncatedInspect
- Defined in:
- foobara-0.7.3/projects/command_connectors/src/command_registry/exposed_command.rb
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary collapse
-
#allowed_rule ⇒ Object
Returns the value of attribute allowed_rule.
-
#authentication_optional ⇒ Object
Returns the value of attribute authentication_optional.
-
#authenticator ⇒ Object
Returns the value of attribute authenticator.
-
#capture_unknown_error ⇒ Object
Returns the value of attribute capture_unknown_error.
-
#command_class ⇒ Object
Returns the value of attribute command_class.
-
#errors_transformers ⇒ Object
Returns the value of attribute errors_transformers.
-
#inputs_transformers ⇒ Object
Returns the value of attribute inputs_transformers.
-
#pre_commit_transformers ⇒ Object
Returns the value of attribute pre_commit_transformers.
-
#request_mutators ⇒ Object
Returns the value of attribute request_mutators.
-
#requires_authentication ⇒ Object
Returns the value of attribute requires_authentication.
-
#response_mutators ⇒ Object
Returns the value of attribute response_mutators.
-
#result_transformers ⇒ Object
Returns the value of attribute result_transformers.
-
#scoped_path ⇒ Object
Returns the value of attribute scoped_path.
-
#serializers ⇒ Object
Returns the value of attribute serializers.
Attributes included from Scoped
#foobara_manifest_reference, #scoped_namespace, #unregistered_foobara_manifest_reference
Instance Method Summary collapse
- #clear_caches ⇒ Object
- #command_name ⇒ Object
- #foobara_manifest ⇒ Object
- #full_command_name ⇒ Object
- #full_command_symbol ⇒ Object
-
#initialize(command_class, scoped_path: nil, suffix: nil, capture_unknown_error: nil, inputs_transformers: nil, result_transformers: nil, errors_transformers: nil, pre_commit_transformers: nil, response_mutators: nil, request_mutators: nil, serializers: nil, allowed_rule: nil, requires_authentication: nil, authentication_optional: nil, authenticator: nil) ⇒ ExposedCommand
constructor
A new instance of ExposedCommand.
- #transformed_command_class ⇒ Object
Methods included from TruncatedInspect
Methods included from IsManifestable
#foobara_domain, #foobara_organization, #scoped_clear_caches
Methods included from Scoped
#scoped_absolute_name, #scoped_category, #scoped_clear_caches, #scoped_full_name, #scoped_full_path, #scoped_ignore_module?, #scoped_ignore_modules=, #scoped_name, #scoped_name=, #scoped_path_autoset=, #scoped_path_autoset?, #scoped_path_set?, #scoped_prefix, #scoped_reregistering!, #scoped_short_name, #scoped_short_path, #scoped_unregistered!, #scoped_unregistered?
Constructor Details
#initialize(command_class, scoped_path: nil, suffix: nil, capture_unknown_error: nil, inputs_transformers: nil, result_transformers: nil, errors_transformers: nil, pre_commit_transformers: nil, response_mutators: nil, request_mutators: nil, serializers: nil, allowed_rule: nil, requires_authentication: nil, authentication_optional: nil, authenticator: nil) ⇒ ExposedCommand
Returns a new instance of ExposedCommand.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 25 def initialize( command_class, scoped_path: nil, suffix: nil, capture_unknown_error: nil, inputs_transformers: nil, result_transformers: nil, errors_transformers: nil, pre_commit_transformers: nil, response_mutators: nil, request_mutators: nil, serializers: nil, allowed_rule: nil, requires_authentication: nil, authentication_optional: nil, authenticator: nil ) if allowed_rule && authenticator && requires_authentication.nil? requires_authentication = true end if requires_authentication || allowed_rule errors_transformers = [ *errors_transformers, Foobara::CommandConnectors::Transformers::AuthErrorsTransformer ].uniq end scoped_path ||= if suffix *prefix, short = command_class.scoped_path [*prefix, "#{short}#{suffix}"] else command_class.scoped_path end self.command_class = command_class self.scoped_path = scoped_path self.capture_unknown_error = capture_unknown_error self.inputs_transformers = inputs_transformers self.result_transformers = result_transformers self.errors_transformers = errors_transformers self.pre_commit_transformers = pre_commit_transformers self.response_mutators = response_mutators self.request_mutators = request_mutators self.serializers = serializers self.allowed_rule = allowed_rule self.requires_authentication = requires_authentication self.authentication_optional = authentication_optional self.authenticator = authenticator Namespace.on_change(self, :clear_caches) end |
Instance Attribute Details
#allowed_rule ⇒ Object
Returns the value of attribute allowed_rule.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def allowed_rule @allowed_rule end |
#authentication_optional ⇒ Object
Returns the value of attribute authentication_optional.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def authentication_optional @authentication_optional end |
#authenticator ⇒ Object
Returns the value of attribute authenticator.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def authenticator @authenticator end |
#capture_unknown_error ⇒ Object
Returns the value of attribute capture_unknown_error.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def capture_unknown_error @capture_unknown_error end |
#command_class ⇒ Object
Returns the value of attribute command_class.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def command_class @command_class end |
#errors_transformers ⇒ Object
Returns the value of attribute errors_transformers.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def errors_transformers @errors_transformers end |
#inputs_transformers ⇒ Object
Returns the value of attribute inputs_transformers.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def inputs_transformers @inputs_transformers end |
#pre_commit_transformers ⇒ Object
Returns the value of attribute pre_commit_transformers.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def pre_commit_transformers @pre_commit_transformers end |
#request_mutators ⇒ Object
Returns the value of attribute request_mutators.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def request_mutators @request_mutators end |
#requires_authentication ⇒ Object
Returns the value of attribute requires_authentication.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def requires_authentication @requires_authentication end |
#response_mutators ⇒ Object
Returns the value of attribute response_mutators.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def response_mutators @response_mutators end |
#result_transformers ⇒ Object
Returns the value of attribute result_transformers.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def result_transformers @result_transformers end |
#scoped_path ⇒ Object
Returns the value of attribute scoped_path.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def scoped_path @scoped_path end |
#serializers ⇒ Object
Returns the value of attribute serializers.
8 9 10 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 8 def serializers @serializers end |
Instance Method Details
#clear_caches ⇒ Object
78 79 80 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 78 def clear_caches @transformed_command_class = nil end |
#command_name ⇒ Object
86 87 88 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 86 def command_name @command_name ||= Util.non_full_name(full_command_name) end |
#foobara_manifest ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 94 def transformed_command_class..merge(super).merge( Util.remove_blank( scoped_category: :command, domain: command_class.domain., organization: command_class.organization. ) ) end |
#full_command_name ⇒ Object
82 83 84 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 82 def full_command_name scoped_full_name end |
#full_command_symbol ⇒ Object
90 91 92 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 90 def full_command_symbol @full_command_symbol ||= Util.underscore_sym(full_command_name) end |
#transformed_command_class ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'projects/command_connectors/src/command_registry/exposed_command.rb', line 104 def transformed_command_class @transformed_command_class ||= if Util.all_blank_or_false?( [ capture_unknown_error, inputs_transformers, result_transformers, errors_transformers, pre_commit_transformers, response_mutators, request_mutators, serializers, allowed_rule, requires_authentication, authentication_optional, authenticator, result_has_sensitive_types? ] ) && scoped_path == command_class.scoped_path command_class else Foobara::TransformedCommand.subclass( command_class, scoped_namespace:, full_command_name:, command_name:, capture_unknown_error:, inputs_transformers:, result_transformers:, errors_transformers:, pre_commit_transformers:, response_mutators:, request_mutators:, serializers:, allowed_rule:, requires_authentication:, authentication_optional:, authenticator: ) end end |