Bb-Collaborate-V3

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.10 9th December 2015
     - Fixed readback check for Bb::Collaborate::V3::Session::Telephony->update(...)

0.09 3rd December 2015
     [distribution]
     - Bump minimum Elive version to 1.37

0.08 3rd December 2015
     Bb::Collaborate::V3::_Content work arounds (Presentation and Multimedia)
     - The upload calls are only suceeding when arguments are given in
       a particular order, with size following encoded content.

0.07 1st December 2015
     - Fixed Recording Deletion
     - Allow general class level updates, e.g.:
          my $obj = Bb::Collaborate::V3::Session->update(SessionId => 123456, startTime => '1448922188000', ... )
       Note: primary key and all mandatory fields must be supplied.

     - Also, class level deletes:
         Bb::Collaborate::V3::Session->delete(SessionId => 123456);

lib/Bb/Collaborate/V3/Multimedia.pm  view on Meta::CPAN

use Mouse;

extends 'Bb::Collaborate::V3::_Content';

=head1 NAME

Bb::Collaborate::V3::Multimedia - Multimedia entity class

=head1 DESCRIPTION

This command uploads supported multimedia files into your ELM repository for use by your Collaborate sessions.

Once uploaded, you will need to "attach" the file to one or more Collaborate
sessions using the L<Bb::Collaborate::V3::Session> C<set_multimedia()>
method.

=cut

__PACKAGE__->entity_name('Multimedia');

=head1 PROPERTIES

=head2 multimediaId (Int)

lib/Bb/Collaborate/V3/Multimedia.pm  view on Meta::CPAN

=head2 description (Str)

A description of the multimedia content.

=cut

has 'description' => (is => 'rw', isa => 'Str');

=head2 size (Int)

The size of the multimedia file (bytes), once uploaded to the ELM repository.

=cut

has 'size' => (is => 'rw', isa => 'Int');

=head2 creatorId (Str)

The identifier of the owner of the multimedia file.

=cut

lib/Bb/Collaborate/V3/Multimedia.pm  view on Meta::CPAN

=back

The filename must be less than 64 characters (including any file extensions).

=cut

=head1 METHODS

=cut

=head2 upload

Uploads content and creates a new multimedia resource.

You can either upload a file:

    # 1. upload a local file
    my $multimedia1 = Bb::Collaborate::V3::Multimedia->upload('c:\\Documents\intro.wav');

or source binary content:

    # 2. source our own binary content
    open (my $fh, '<', $multimedia_path)
        or die "unable to open $multimedia_path: $!";
    $fh->binmode;

    my $content = do {local $/ = undef; <$fh>};
    die "no multimedia data: $multimedia_path"
        unless ($content);

    my $multimedia2 = Bb::Collaborate::V3::Multimedia->upload(
             {
                    filename => 'whoops.wav',
                    creatorId =>  'alice',
                    content => $content,
                    description => 'Caravan destroys service station',
	     },
         );

You can assign multiple multimedia items to a session:

lib/Bb/Collaborate/V3/Presentation.pm  view on Meta::CPAN

use Mouse;

extends 'Bb::Collaborate::V3::_Content';

=head1 NAME

Bb::Collaborate::V3::Presentation - Presentation entity class

=head1 DESCRIPTION

This command uploads presentation files, such as Collaborate whiteboard files or I<Plan!> files for use by your Collaborate sessions.

Once uploaded, you will need to "attach" the file to one or more Collaborate
sessions using the L<Bb::Collaborate::V3::Session> C<set_presentation()> method.

=cut

__PACKAGE__->entity_name('Presentation');

=head1 PROPERTIES

=head2 presentationId (Int)

lib/Bb/Collaborate/V3/Presentation.pm  view on Meta::CPAN

=head2 description (Str)

A description of the presentation content.

=cut

has 'description' => (is => 'rw', isa => 'Str');

=head2 size (Int)

The size of the presentation file (bytes), once uploaded to the ELM repository.

=cut

has 'size' => (is => 'rw', isa => 'Int');

=head2 creatorId (Str)

The identifier of the owner of the presentation file.

=cut

lib/Bb/Collaborate/V3/Presentation.pm  view on Meta::CPAN

=back

Note: The filename must be less than 64 characters (including any file extensions)

=cut

=head1 METHODS

=cut

=head2 upload

Uploads content and creates a new presentation resource.

You can either upload a file:

    # 1. upload a local file
    my $presentation = Bb::Collaborate::V3::Presentation->upload('c:\\Documents\intro.wbd');
    $some_session->set_presentation( $presentation );

or source binary data for the presentation.

    # 2. source our own binary content
    open (my $fh, '<', $presentation_path)
        or die "unable to open $presentation_path: $!";
    $fh->binmode;

    my $content = do {local $/ = undef; <$fh>};
    die "no presentation data: $presentation_path"
        unless ($content);

    my $presentation = Bb::Collaborate::V3::Presentation->upload(
             {
                    filename => 'myplan.elpx',
                    creatorId =>  'bob',
                    content => $content,
	     },
         );

    $some_session->set_presentation( $presentation );

=cut

lib/Bb/Collaborate/V3/_Content.pm  view on Meta::CPAN


sub BUILDARGS {
    my $class = shift;
    my $spec = shift;

    my %args;

    if (defined $spec && ! ref($spec) ) {
	#
	# Assume a single string arguments represents the local path of a file
	# to be uploaded.
	#
	my $content_path = $spec;

	open ( my $fh, '<', $content_path)
	    or die "unable to open content file $content_path";

	binmode $fh;
	my $content = do {local $/; <$fh>};

	close $fh;

lib/Bb/Collaborate/V3/_Content.pm  view on Meta::CPAN

	# (a bit of layer bleed here...). Do we need a separate data type
	# for base 64 encoded data?
	#
	require SOAP::Lite;
	$db_data->{content} = SOAP::Data->type('xs:base64Binary' => MIME::Base64::encode_base64($content,'') );
    }

    return $db_data;
}

sub upload {
    my ($class, $spec, %opt) = @_;

    my $command = (delete($opt{command})
		   || 'UploadRepository' . $class->entity_name);

    my %upload_data = %{ $class->BUILDARGS( $spec ) };

    my $connection = delete $opt{connection} || $class->connection
	or die "not connected";

    $upload_data{creatorId} ||= $connection->user;

    my %params = %{delete $opt{param} || {}};

    my %data_params = %{ $class->_freeze({%upload_data, %params}) };

    #
    # work around SAS bug. upload commands apear to be order sensitive
    #
    my @args;
    for (qw<creatorId filename description content size>) {
	push @args, $_ => delete $data_params{$_}
	    if exists $data_params{$_};
    }

    # mop up
    push @args, $_ => $data_params{$_}
        for keys %data_params;

    $connection->check_command($command => 'c');
    my $som = $connection->call($command, @args);
    my @rows = $class->_readback($som, \%upload_data, $connection, %opt);

    my @objs = (map {$class->construct( $_, connection => $connection )}
		@rows);
    #
    # possibly return a list of recurring meetings.
    #
    return wantarray? @objs : $objs[0];
}

sub list {

t/pod-coverage.t  view on Meta::CPAN

plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
    if $@;

# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
    if $@;

all_pod_coverage_ok({also_private => [qr/^(BUILDARGS|insert|upload|list|delete)$/]});

t/soap-connect-lwp.t  view on Meta::CPAN

    my $pass = $connection->pass;
    $message =~ s/\$\{user\}/$user/g;
    $message =~ s/\$\{pass\}\E/$pass/g;

    is ( exception {
	$response = $userAgent
	    ->request(HTTP::Request::Common::POST( $connection->url,
		      Authorization => $connection->_authoriz,
		      Content_Type => 'text/xml;charset=UTF-8',
		      Content => $message))
		  } => undef, "uploadMultimediaContent request post - lives"); 

    ok($response->is_success, 'response is succcess');

    my $response_string = $response->as_string;
    note "==== RESPONSE ====\n".$response_string;

    ok( $response !~ m{error}i, 'Response is not an error');

    $connection->disconnect;
}

t/soap-multimedia.t  view on Meta::CPAN

	unless $auth;

    my $connection_class = $result{class};
    my $connection = $connection_class->connect(@$auth);
    Bb::Collaborate::V3->connection($connection);

    my $multimedia;

  do {
      is( exception {
	  $multimedia = Bb::Collaborate::V3::Multimedia->upload(
	      {
		filename => 'elive-standardv3-soap-session-multimedia-t.mpeg',
		content => $data,
                description => 'created by standard v3 t/soap-multimedia.t',
		creatorId => 'elive-standardv3-tester',
	      })
	       } => undef,
	       'insert multimedia - lives'
	  );
  };

    die 'unable to continue without an multimedia upload object'
	unless $multimedia;

    isa_ok($multimedia, $class, 'multimedia object');

    my $multimedia_id = $multimedia->multimediaId;
    ok($multimedia_id, 'got multimedia id');

    my $multimedia_list;

    # you need to supply a creatator id

t/soap-presentation.t  view on Meta::CPAN

    my $connection_class = $result{class};
    my $connection = $connection_class->connect(@$auth);
    Bb::Collaborate::V3->connection($connection);

    my $presentation;

  TODO : {
      local($TODO) = 'UploadRespositoryPresentation - mixed up filename and description in response?'
          if $connection->scheduling_manager->manager eq 'ELM';
      is( exception {
	  $presentation = Bb::Collaborate::V3::Presentation->upload(
	      {
		filename => 'elive-standardv3-soap-session-presentation-t.wbd',
		content => $data,
                description => 'created by standard v3 t/soap-presentation.t',
		creatorId => 'elive-standardv3-tester',
	      })
	       } => undef,
	       'insert presentation - lives'
	  );
  };



( run in 2.688 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )