NAME

Net::API::REST::RC - Return Code Object for Net::APi::REST

SYNOPSIS

my $rc = Net::API::REST::RC->new(
    code => 401,
    message => 'Your token has expired',
);

In your api, you can return a Return Code object, which provides both the return code and some descriptive message.

Th object stringifies to the "code" set.

The purpose of this module is to have an object that contains not only the return code, but also some message for the end user.

METHODS

as_string

my $rc = Net::API::REST::RC->new(
    code => 401,
    message => 'Your token has expired',
);
print( "$rc\n" ); # 401

Returns the value for "code"

code

Sets or gets the http return code, such as 200, or 401. See the Net::API::REST::Status module for all possible return code.

message

A descriptive message that can be passed along to the end user.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Net::API::REST, Net::API::REST::Request, Net::API::REST::Response, Net::API::REST::Query

COPYRIGHT & LICENSE

Copyright (c) 2018-2021 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.