Arango-Tango

 view release on metacpan or  search on metacpan

lib/Arango/Tango/Collection.pm  view on Meta::CPAN

        },

        truncate => {
            rest => [ put => '{{database}}_api/collection/{name}/truncate' ],
            inject_properties => [ 'database', 'name' ]
        },

        revision => {
            rest => [ get => '{{database}}_api/collection/{name}/revision' ],
            inject_properties => [ 'database', 'name' ],
        },

        info => {
            rest => [ get => '{{database}}_api/collection/{name}' ],
            inject_properties => [ 'database', 'name' ],
        },

        recalculate_count => {
            rest => [ put => '{{database}}_api/collection/{name}/recalculateCount' ],
            inject_properties => [ 'database', 'name' ],
        },

        rotate => {
            rest => [ put => '{{database}}_api/collection/{name}/rotate' ],
            inject_properties => [ 'database', 'name' ],
        },


        figures => {
            rest => [ get => '{{database}}_api/collection/{name}/figures' ],
            schema => { withRevisions => { type => 'boolean' }, withData => {type=>'boolean' }},
            inject_properties => [ 'database', 'name' ],
        },

        count => {
            rest => [ get => '{{database}}_api/collection/{name}/count' ],
            schema => { withRevisions => { type => 'boolean' }, withData => {type=>'boolean' }},
            inject_properties => [ 'database', 'name' ],
        },


        checksum => {
            rest => [ get => '{{database}}_api/collection/{name}/checksum' ],
            schema => { withRevisions => { type => 'boolean' }, withData => {type=>'boolean' }},
            inject_properties => [ 'database', 'name' ],
        },

        set_properties => {
            rest => [ put => '{{database}}_api/collection/{name}/properties'],
            schema => {  waitForSync => { type => 'boolean' }, journalSize => { type => 'integer' }},
            inject_properties => [ 'database', 'name' ],
        },

    };
}



sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;
}

sub document_paths {
    my ($self) = @_;
    return $self->{arango}->_api( all_keys => { database => $self->{database}, collection => $self->{name}, type => "path"})->{result}
}

sub create_document {
    my ($self, $body) = @_;
    die "Arango::Tango | Refusing to store undefined body" unless defined($body);
    return $self->{arango}->_api( create_document => { database => $self->{database}, collection => $self->{name}, body => $body})
}

sub get_access_level {
    my ($self, $username) = @_;
    return $self->{arango}->get_access_level( $username, $self->{database}, $self->{name} );
}

sub clear_access_level {
    my ($self, $username) = @_;
    return $self->{arango}->clear_access_level( $username , $self->{database}, $self->{name} );
}

sub set_access_level {
    my ($self, $username, $grant) = @_;
    return $self->{arango}->set_access_level($username, $grant, $self->{database}, $self->{name});
}


1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Arango::Tango::Collection - ArangoDB Collection object

=head1 VERSION

version 0.013

=head1 USAGE

This class should not be created directly. The L<Arango::Tango> module is responsible for
creating instances of this object.

C<Arango::Tango::Collection> answers to the following methods:

=head2 C<load>

   $ans = $collection->load();
   $ans = $collection->load( count => 0 );

Loads a collection into memory.

=head2 C<load_indexes>

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.995 second using v1.00-cache-1.14-grep-28634ff-cpan-ac32402124b )