Class: Foobara::Agent::NotifyUserThatCurrentGoalHasBeenAccomplished
- Inherits:
-
Command
- Object
- Command
- Foobara::Agent::NotifyUserThatCurrentGoalHasBeenAccomplished
- Extended by:
- Concerns::SubclassCacheable
- Defined in:
- foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb
Constant Summary
Constants included from TruncatedInspect
Class Attribute Summary collapse
-
.command_class ⇒ Object
Returns the value of attribute command_class.
Attributes included from CommandPatternImplementation::Concerns::Subcommands
Attributes included from CommandPatternImplementation::Concerns::Runtime
#exception, #outcome, #raw_result
Attributes included from CommandPatternImplementation::Concerns::Errors
Attributes included from CommandPatternImplementation::Concerns::Inputs
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Concerns::SubclassCacheable
cached_subclass, clear_subclass_cache, subclass_cache
Methods inherited from Command
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from CommandPatternImplementation::Concerns::Reflection
Methods included from CommandPatternImplementation::Concerns::DomainMappers
#domain_map, #domain_map!, #run_mapped_subcommand!
Methods included from CommandPatternImplementation::Concerns::Subcommands
#run_subcommand!, #subcommand?
Methods included from CommandPatternImplementation::Concerns::Entities
Methods included from CommandPatternImplementation::Concerns::Transactions
Methods included from NestedTransactionable
#auto_detect_current_transactions, #commit_transaction, #commit_transaction_if_open, #open_transaction, #opened_transactions, #relevant_entity_classes, relevant_entity_classes_for_type, #relevant_entity_classes_for_type, #rollback_transaction, #transactions, #use_transaction, with_needed_transactions_for_type
Methods included from CommandPatternImplementation::Concerns::StateMachine
Methods included from CommandPatternImplementation::Concerns::Runtime
#halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records
Methods included from CommandPatternImplementation::Concerns::Errors
Methods included from CommandPatternImplementation::Concerns::Inputs
#cast_and_validate_inputs, #initialize, #method_missing, #respond_to_missing?, #respond_to_missing_for_inputs?
Methods included from TruncatedInspect
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs
Class Attribute Details
.command_class ⇒ Object
Returns the value of attribute command_class.
7 8 9 |
# File 'foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb', line 7 def command_class @command_class end |
Class Method Details
.for(result_type:, agent_id:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 |
# File 'foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb', line 9 def for(result_type:, agent_id:) cached_subclass([result_type, agent_id]) do command_name = "Foobara::Agent::#{agent_id}::NotifyUserThatCurrentGoalHasBeenAccomplished" klass = Util.make_class_p(command_name, self) klass.description "Notifies the user that the current goal has been accomplished and returns a final " \ "result formatted according to the " \ "result schema and an optional message to the user. " \ "The user might issue a new goal." inputs do command_connector CommandConnector, :required, "Connector to notify user through" :string, "Optional message to the user" end if result_type add_inputs do result_data result_type end klass.result do :string result_data result_type end klass.description "Notifies the user that the current goal has been accomplished and returns a final " \ "result formatted according to the " \ "result schema if relevant and an optional message to the user. " \ "The user might issue a new goal." else # TODO: test this code path # :nocov: klass.description "Notifies the user that the current goal has been accomplished and, if relevant, " \ "returns a final " \ "result formatted according to the " \ "result schema and an optional message to the user. " \ "The user might issue a new goal." # :nocov: end klass end end |
Instance Method Details
#execute ⇒ Object
64 65 66 67 68 |
# File 'foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb', line 64 def execute mark_mission_accomplished parsed_result end |
#mark_mission_accomplished ⇒ Object
70 71 72 73 74 75 76 |
# File 'foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb', line 70 def mark_mission_accomplished data = if result_type inputs[:result_data] end command_connector.mark_mission_accomplished(data, ) end |
#parsed_result ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'foobara-agent-0.0.5/src/foobara/agent/notify_user_that_current_goal_has_been_accomplished.rb', line 78 def parsed_result h = { message_to_user: } if inputs[:result_data] && result_type h[:result_data] = result_data end h end |