AsposeCellsCloud-CellsApi

 view release on metacpan or  search on metacpan

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

            $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
        }
    }
    return $_data;
}

# from Perl hashref
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 => '',
                                  class => 'RenderingWatermark',
                                  required => [], # TODO
}                                 );


__PACKAGE__->method_documentation({
     'rotation' => {
     	datatype => 'double',
     	base_name => 'Rotation',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'scale_to_page_percent' => {
     	datatype => 'int',
     	base_name => 'ScaleToPagePercent',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'opacity' => {
     	datatype => 'double',
     	base_name => 'Opacity',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'is_background' => {
     	datatype => 'boolean',
     	base_name => 'IsBackground',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'text' => {
     	datatype => 'string',
     	base_name => 'Text',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'font' => {
     	datatype => 'RenderingFont',
     	base_name => 'Font',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'image' => {
     	datatype => 'ARRAY[byte?]',
     	base_name => 'Image',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'h_alignment' => {
     	datatype => 'string',
     	base_name => 'HAlignment',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'v_alignment' => {
     	datatype => 'string',
     	base_name => 'VAlignment',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'offset_x' => {
     	datatype => 'double',
     	base_name => 'OffsetX',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'offset_y' => {
     	datatype => 'double',
     	base_name => 'OffsetY',
     	description => '',
     	format => '',
     	read_only => '',
     		},    
});

__PACKAGE__->swagger_types( {
    'rotation' => 'double',
    'scale_to_page_percent' => 'int',
    'opacity' => 'double',
    'is_background' => 'boolean',
    'text' => 'string',
    'font' => 'RenderingFont',
    'image' => 'ARRAY[byte?]',
    'h_alignment' => 'string',
    'v_alignment' => 'string',
    'offset_x' => 'double',
    'offset_y' => 'double' 
} );

__PACKAGE__->attribute_map( {
    'rotation' => 'Rotation',
    'scale_to_page_percent' => 'ScaleToPagePercent',
    'opacity' => 'Opacity',
    'is_background' => 'IsBackground',
    'text' => 'Text',
    'font' => 'Font',
    'image' => 'Image',
    'h_alignment' => 'HAlignment',
    'v_alignment' => 'VAlignment',
    'offset_x' => 'OffsetX',
    'offset_y' => 'OffsetY' 
} );

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


1;



( run in 4.370 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )