AsposeCellsCloud-CellsApi

 view release on metacpan or  search on metacpan

lib/AsposeCellsCloud/Object/Font.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 => '           Encapsulates the font object used in a spreadsheet.           ',
                                  class => 'Font',
                                  required => [], # TODO
}                                 );


__PACKAGE__->method_documentation({
     'color' => {
     	datatype => 'Color',
     	base_name => 'Color',
     	description => 'Gets or sets the  of the font. ',
     	format => '',
     	read_only => '',
     		},
     'double_size' => {
     	datatype => 'double',
     	base_name => 'DoubleSize',
     	description => 'Gets and sets the double size of the font. ',
     	format => '',
     	read_only => '',
     		},
     'is_bold' => {
     	datatype => 'boolean',
     	base_name => 'IsBold',
     	description => 'Gets or sets a value indicating whether the font is bold. ',
     	format => '',
     	read_only => '',
     		},
     'is_italic' => {
     	datatype => 'boolean',
     	base_name => 'IsItalic',
     	description => 'Gets or sets a value indicating whether the font is italic. ',
     	format => '',
     	read_only => '',
     		},
     'is_strikeout' => {
     	datatype => 'boolean',
     	base_name => 'IsStrikeout',
     	description => 'Gets or sets a value indicating whether the font is single strikeout. ',
     	format => '',
     	read_only => '',
     		},
     'is_subscript' => {
     	datatype => 'boolean',
     	base_name => 'IsSubscript',
     	description => 'Gets or sets a value indicating whether the font is subscript. ',
     	format => '',
     	read_only => '',
     		},
     'is_superscript' => {
     	datatype => 'boolean',
     	base_name => 'IsSuperscript',
     	description => 'Gets or sets a value indicating whether the font is super script. ',
     	format => '',
     	read_only => '',
     		},
     'name' => {
     	datatype => 'string',
     	base_name => 'Name',
     	description => 'Gets  or sets the name of the . ',
     	format => '',
     	read_only => '',
     		},
     'size' => {
     	datatype => 'int',
     	base_name => 'Size',
     	description => 'Gets or sets the size of the font. ',
     	format => '',
     	read_only => '',
     		},
     'underline' => {
     	datatype => 'string',
     	base_name => 'Underline',
     	description => 'Gets or sets the font underline type. ',
     	format => '',
     	read_only => '',
     		},    
});

__PACKAGE__->swagger_types( {
    'color' => 'Color',
    'double_size' => 'double',
    'is_bold' => 'boolean',
    'is_italic' => 'boolean',
    'is_strikeout' => 'boolean',
    'is_subscript' => 'boolean',
    'is_superscript' => 'boolean',
    'name' => 'string',
    'size' => 'int',
    'underline' => 'string' 
} );

__PACKAGE__->attribute_map( {
    'color' => 'Color',
    'double_size' => 'DoubleSize',
    'is_bold' => 'IsBold',
    'is_italic' => 'IsItalic',
    'is_strikeout' => 'IsStrikeout',
    'is_subscript' => 'IsSubscript',
    'is_superscript' => 'IsSuperscript',
    'name' => 'Name',
    'size' => 'Size',
    'underline' => 'Underline' 
} );

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


1;



( run in 0.396 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )