Class: Hypertube::Core::Handler::ProjectResultAsDtoHandler
- Inherits:
-
AbstractHandler
- Object
- AbstractHandler
- Hypertube::Core::Handler::ProjectResultAsDtoHandler
- Defined in:
- lib/hypertube-ruby-sdk/core/handler/project_result_as_dto_handler.rb
Instance Method Summary collapse
-
#initialize ⇒ ProjectResultAsDtoHandler
constructor
A new instance of ProjectResultAsDtoHandler.
- #process(command) ⇒ Object
Methods inherited from AbstractHandler
Constructor Details
#initialize ⇒ ProjectResultAsDtoHandler
Returns a new instance of ProjectResultAsDtoHandler.
12 13 14 |
# File 'lib/hypertube-ruby-sdk/core/handler/project_result_as_dto_handler.rb', line 12 def initialize @required_parameters_count = 1 end |
Instance Method Details
#process(command) ⇒ Object
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 |
# File 'lib/hypertube-ruby-sdk/core/handler/project_result_as_dto_handler.rb', line 16 def process(command) validate(command, @required_parameters_count, self.class.name) instance = command.payload[0] response_array = [] response_array[0] = instance type_name = instance.nil? ? '' : instance.class.name response_array[1] = Hypertube::Utils::Command.new(command.runtime_name, Hypertube::Utils::CommandType::GET_TYPE, type_name) get_instance_field_handler = Hypertube::Core::Handler::GetInstanceFieldHandler.new (1...command.payload.length).each do |i| property_name = command.payload[i] property_value = get_instance_field_handler.process( Hypertube::Utils::Command.new(command.runtime_name, Hypertube::Utils::CommandType::GET_INSTANCE_FIELD, instance, property_name) ) response_array[i + 1] = Hypertube::Utils::Command.new( command.runtime_name, Hypertube::Utils::CommandType::DTO_PROPERTY, property_name, property_value ) end response_array end |