NAME

WebService::Freshservice::User - Freshservice User

VERSION

version 0.004

SYNOPSIS

use WebService::Freshservice::User;

my $request = WebService::Freshservice::User->new( api => $api, id => '1234567890' );

Requires an 'WebService::Freshservice::API' object and user id.

DESCRIPTION

Provides a Freshservice user object. Though users are referred to as 'Requesters' and 'Agents', agents are a super set of a user.

METHODS

delete_requester

$requester->delete_requester;

Returns 1 on success. Croaks on failure.

update_requester

$requester->update_requester;

The following attributes can be updated and 'PUT' against the API:

address description email external_id language 
location_name job_title mobile name phone time_zone

Optionally takes named attributes of 'attr' and 'value' if only updating a single attribute.

$requester->update_requester( attr => 'address', value => 'Some new address' );

API returns 200 OK and no content regardless if the put resulted in a successful change. Returns 1, croaks on failure.

custom_fields

$requester->custom_fields;

Will return a hash of WebService::Freshservice::User::CustomField objects. Returns an empty object if your Freshservice instance doesn't have any custom fields configured.

set_custom_field

$requester->set_custom_field(
  field => 'cf_field_name',
  value => 'field value',
);

Set a custom field value. Takes an optional attribute of 'update' which can be set to '0' and it will not 'PUT' the changes (handy if you are trying to limit API calls and want are calling '$requester->update_requester' later);

get_custom_field

say $updated->get_custom_field('cf_field_name')->value;

or

$custom_field = $updated->get_custom_field('cf_field_name');

Returns a WebService::Freshservice::User::CustomField object of the named Custom Field. Croaks if the field doesn't exist in Freshservice.

AUTHOR

Leon Wright <techman@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Leon Wright.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.