AsposeCellsCloud-CellsApi

 view release on metacpan or  search on metacpan

lib/AsposeCellsCloud/Object/Top10Filter.pm  view on Meta::CPAN

sub from_hash {
    my ($self, $hash) = @_;

    # loop through attributes and use swagger_types to deserialize the data
    while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
    	my $_json_attribute = $self->attribute_map->{$_key}; 
        if ($_type =~ /^array\[/i) { # array
            my $_subclass = substr($_type, 6, -1);
            my @_array = ();
            foreach my $_element (@{$hash->{$_json_attribute}}) {
                push @_array, $self->_deserialize($_subclass, $_element);
            }
            $self->{$_key} = \@_array;
        } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
            $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
        } else {
        	$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
        }
    }

    return $self;
}

# deserialize non-array data
sub _deserialize {
    my ($self, $type, $data) = @_;
    $log->debugf("deserializing %s with %s",Dumper($data), $type);

    if ($type eq 'DateTime') {
        return DateTime->from_epoch(epoch => str2time($data));
    } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
        return $data;
    } else { # hash(model)
        my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
        return $_instance->from_hash($data);
    }
}


__PACKAGE__->class_documentation({description => '           Represents the top 10 filter.           ',
                                  class => 'Top10Filter',
                                  required => [], # TODO
}                                 );


__PACKAGE__->method_documentation({
     'field_index' => {
     	datatype => 'int',
     	base_name => 'FieldIndex',
     	description => 'An integer property named FieldIndex that can be accessed and modified.            ',
     	format => '',
     	read_only => '',
     		},
     'criteria' => {
     	datatype => 'string',
     	base_name => 'Criteria',
     	description => ' ',
     	format => '',
     	read_only => '',
     		},
     'is_percent' => {
     	datatype => 'boolean',
     	base_name => 'IsPercent',
     	description => 'Indicates whether the items is percent. ',
     	format => '',
     	read_only => '',
     		},
     'is_top' => {
     	datatype => 'boolean',
     	base_name => 'IsTop',
     	description => 'Indicates whether it`s top filter. ',
     	format => '',
     	read_only => '',
     		},
     'items' => {
     	datatype => 'int',
     	base_name => 'Items',
     	description => 'Gets and sets the items of the filter. ',
     	format => '',
     	read_only => '',
     		},    
});

__PACKAGE__->swagger_types( {
    'field_index' => 'int',
    'criteria' => 'string',
    'is_percent' => 'boolean',
    'is_top' => 'boolean',
    'items' => 'int' 
} );

__PACKAGE__->attribute_map( {
    'field_index' => 'FieldIndex',
    'criteria' => 'Criteria',
    'is_percent' => 'IsPercent',
    'is_top' => 'IsTop',
    'items' => 'Items' 
} );

__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});


1;



( run in 0.878 second using v1.01-cache-2.11-cpan-39bf76dae61 )