Catmandu-MediaHaven

 view release on metacpan or  search on metacpan

lib/Catmandu/Importer/MediaHaven.pm  view on Meta::CPAN

        $index++;

        if (@$results > 0) {
            return shift @$results;
        }
        elsif ($index < $total) {
            my $res = $self->mediahaven->search(
                            undef,
                            start => $index+1,
                            sort  => $self->search_sort,
                            num   => $self->search_limit
                    );
            $results = $res->{mediaDataList};
            $index++;
            return shift @$results;
        }
        return undef;
    };
}

1;

__END__

=pod

=head1 NAME

Catmandu::Importer::MediaHaven - a importer that extracts Zeticon MediaHaven records

=head1 SYNOPSIS

    # From the commandline
    $ cat catmandu.yml
    ---
    importer:
         mh:
             package: MediaHaven
             options:
                 url: https://archief.viaa.be/mediahaven-rest-api/resources/media
                 username: ...
                 password: ...
                 fix:  |
                    ...
                    <fixes required to translate MediaHaven records to metadata>
                    ...

    $ catmandu convert YAML to mh < records.yml

=head1 METHODS

=head2 new(%connection_parameters)

Create a new Catmandu::Store::File::MediaHaven with the following connection
parameters:

=over

=item url

Required. The URL to the MediaHaven REST endpoint.

=item username

Required. Username used to connect to MediaHaven.

=item password

Required. Password used to connect to MediaHaven.

=item search_sort

Optional. The sorting field used in imports.

=item search_limit

Optional. The maximum number of records to be return in each MediaHaven sort.

=back

=head1 INHERITED METHODS

This Catmandu::Exporter::MediaHaven implements

=over 3

=item L<Catmandu::Importer>

=item L<Catmandu::Logger>

=item L<Catmandu::Iterable>

=item L<Catmandu::Fixable>

=item L<Catmandu::Serializer>

=back

=head1 SEE ALSO

L<Catmandu::Exporter::MediaHaven>

=cut



( run in 0.849 second using v1.01-cache-2.11-cpan-8dfa8b56332 )