The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::IdoitAPI::Object - handle i-doit objects

VERSION

version 0.4.0

SYNOPSIS

    use WebService::IdoitAPI::Object;

    $api = WebService::IdoitAPI->new( $config );
    $object = WebService::IdoitAPI::Object->new($api, $id)

    $info = $object->get_information();

DESCRIPTION

INTERFACE

new

    $api = WebService::IdoitAPI->new( $config );

    $object = WebService::IdoitAPI::Object->new($api, $id)

Create a new object and provide it with an WebService::IdoitAPI object that is used for communication with i-doit and optionally with an object ID.

The API object should be configured and ready to use.

get_data

    $data = $object->get_data();

or

    $data = $object->get_data($id);

This function returns a subset of the data retrieved by get_information() in a form that is more suitable to be copied to other objects.

The basic data structure returned by this function is the same as by get_information().

Data from C__CATG__LOGBOOK is left out and the attributes in the other categories are changed to values that can be used with the JSON-RPC-API call cmdb.category.save.

One use case for this function is to amend an object with data from a template.

get_information

    $info = $object->get_information();

or

    $info = $object->get_information($id);

This function collects all information about an object from i-doit and returns it in a hash with the following structure:

    $info = {
        catg => {
            # ...
        },
        cats => {
            # ...
        },
        obj => {
            'cmdb_status' => $cmdb_status,
            'id' => $id,
            'objecttype' => $type,
            'status' => $status,
            'sysid' => $sysid,
            'title' => $title,
            'type_icon' => $path_to_file,
            'type_title' => $type_title,
        },
    }

The values at the catg and cats keys are themselves hashes with the categories of the object as keys. Which categories are actually there depends on the objecttype, which is accessible at $info->{'obj'}->{'objtype'}

When this function is called with a value for $id, it returns the information for the object with that ID.

Is the function is called without $id, the ID that was used when creating the object with new() is used.

If the option $id is provided and is equal to the ID assigned to the object when created with new(), the retrieved information is cached with the object. Further calls with the same ID or without $id get the cached information.

If the option $id is provided and differs from the internal ID of the object, the information is always retrieved from i-doit.

CONFIGURATION AND ENVIRONMENT

WebService::IdoitAPI::Object requires no configuration files or environment variables but it depends on an already initialized WebService::IdoitAPI object.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-app-new@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Mathias Weidner <mamawe@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2023, Mathias Weidner <mamawe@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.