Sha256: 35a7b44481edfce281ef4edebc959ecdb7b7b05a4d986b3621df90e3d9830a10

Contents?: true

Size: 1.4 KB

Versions: 43

Compression:

Stored size: 1.4 KB

Contents

package Javonet::Core::Handler::CommandHandler::AbstractCommandHandler;
use strict;
use warnings FATAL => 'all';
use Moose;
use Scalar::Util qw( blessed );
use Attribute::Abstract;


sub new {
    my $class = shift;
    my $self = {
        required_parameters_count  => 0
    };
    return bless $self, $class;
}


sub handle_command {
    my ($self, $command) = @_;
    iterate($command);
    return $self->process($command);
}

sub iterate {
    my $command = shift;
    my $payload_ref = $command->{payload};
    my @payload_array = @$payload_ref;
    my $length = @payload_array;
    for (my $i=0; $i< $length; $i++){
        my $payload_item = $command->{payload}[$i];
        if(blessed($payload_item) and $payload_item->isa('Javonet::Sdk::Core::PerlCommand')
            and !($payload_item->{command_type} eq Javonet::Sdk::Core::PerlCommandType::get_command_type('Value'))) {
            $command->{payload}[$i] = Javonet::Core::Handler::HandlerDictionary::get_handler(
                $command->{payload}[$i]->{command_type})->handle_command($command->{payload}[$i]
            );
        }
        if(blessed($payload_item) and $payload_item->isa('Javonet::Sdk::Core::PerlCommand')
            and $payload_item->{command_type} eq Javonet::Sdk::Core::PerlCommandType::get_command_type('Value')) {
            $command->{payload}[$i] = $payload_item->{payload}[0];
        }
    }
}

sub process : Abstract;


no Moose;
1;

Version data entries

43 entries across 26 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.5 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.4 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.4 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.3.0 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.3.0 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.2.0 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.2.0 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.14 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.14 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.13 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.13 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.12 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.12 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.11 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.11 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/lib/Javonet/Core/Handler/CommandHandler/AbstractCommandHandler.pm