=pod

=encoding UTF-8

=head1 NAME

Broadworks::OCIP - API for communication with Broadworks OCI-P Interface

=head1 VERSION

version 0.08

=for test_synopsis 1;
__END__

=for stopwords NIGELM

=for Pod::Coverage mvp_multivalue_args

=head1 SYNOPSIS

  use Broadworks::OCIP;

  my $ocip = Broadworks::OCIP->new(params);
  my $res = $ocip->SystemSoftwareVersionGetRequest();

=head1 DESCRIPTION

Broadworks::OCIP is a perl interface to the Broadworks OCI-P Provisioning
interface.  The functions provided reflect the AS OCI-P. The methods supported
are documented in the L<Broadworks::OCIP::Methods> module, which is
autogenerated from the Broadworks schemas.

=head2 Required Parameters

=head3 host

The host that is being connected to - either a host name or an IP address.

=head3 username

The username to authenticate with on the remote system.

=head3 authhash

An authentication hash to use for authenticating the username.  Alternatively
the password attribute can be set and this is transformed into an appropriate
authhash (and the password deleted).

=head2 Other attributes

=head3 version

Broadworks version - currently defaults to C<17sp4>.

=head3 character_set

The character set to use - currently defaults to C<ISO-8859-1>.

=head3 encoder

A character set encoder - uses an instance of L<Encode> returned by
L<Encode/find_encoding>.

=head3 protocol

The protocol to implement - always C<OCI>.

=head3 port

The port number to connect to - default C<2208>.

=head3 target

The target to connect to - consists of the host and port linked by a colon.

=head3 timeout

The timeout within the connection in seconds - defaults to C<8> can be changed
during the session.

=head3 socket

The connection socket - automatically set.

=head3 select

A select object on the connection socket.

=head3 session

The session identifier for the session - defaults to a L<Data::UUID> string.

=head3 is_authenticated

Are we authenticated.  Checking this forces authentication.  If authentication
fails then we throw an exception.

=head3 last_sent

The last sent XML document.

=head3 trace

Are we tracing.  If this is true then we output sent and received data to
STDERR.

=head1 METHODS

=head3 BUILDARGS

Standard L<Moose> C<BUILDARGS> function.  If a single argument is passed this
is treated as a config filename (opened with L<Config::Any>) if it is a scalar,
or assumed to be a hash reference, which is expanded up.

If a config filename is passed this is opened, and any C<Broadworks::OCIP> is
taken as the overall config.

Any C<password> attribute is removed from the config and an L<authhash> is put
in its place.  This means dumping the object will not reveal the password.

=head3 send

Sends an XML document to the Broadworks remote over the socket. Convert the
passed string to the correct character set.

=head3 send_command_xml

Builds an XML command document from the command passed and the parameters
(which are passed as an array ref of pairs).

When the document has been created it is send using the L<send> method.

=head3 send_query

Sends an XML command to the Broadworks remote over the socket, and receives and
passes back the expected response document.  Throws an exception if the reply
type is returned.

=head3 send_command

Sends an XML command to the Broadworks remote over the socket, and receives and
passes back the expected C<SuccessResponse> document.   An exception is not
thrown if the wrong reply type is returned, however the C<status_ok> attribute
should be checked for this.

=head3 DEMOLISH

On object destruction, if the system has authenticated, sends a
C<LogoutRequest> command and then tears down the socket connection.

=head1 AUTHOR

Nigel Metheringham <Nigel.Metheringham@redcentricplc.com>

=head1 COPYRIGHT

Copyright 2014 Recentric Solutions Limited. All rights reserved.

=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan

=head1 SUPPORT

=head2 Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker
at L<http://rt.cpan.org/Public/Dist/Display.html?Name=Broadworks-OCIP>.
You will be notified automatically of any progress on your issue.

=head2 Source Code

This is open source software.  The code repository is available for
public review and contribution under the terms of the license.

L<https://gitlab.dev.localnet/broadworks-api/broadworks-ocip>

  git clone https://gitlab.dev.localnet/broadworks-api/broadworks-ocip.git

=head1 AUTHOR

Nigel Metheringham <nigelm@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Nigel Metheringham.

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

=cut
