API-Assembla

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

API has LOTS of stuff that this module does not yet contain.  These features
will be added as needed by the author or as gifted by thoughtful folks who
write patches! ;)

# SYNOPSIS

    use API::Assembla;

    my $api = API::Asembla->new(
        username => $username,
        password => $password
    );

    my $href_of_spaces = $api->get_spaces;
    # Got an href of API::Assembla::Space objects keyed by space id
    my $space = $api->get_space($space_id);
    # Got an API::Assembla::Space object

    my $href_of_tickets = $api->get_tickets;
    # Got an href of API::Assembla::Space objects keyed by ticket id
    my $ticket = $api->get_ticket($space_id, $ticket_number);
    # Got an API::Assembla::Ticket object

# DESCRIPTION

API::Assembla is a Perl interface to [Assembla](http://www.assembla.com/), a
ticketing, code hosting collaboration tool.

# ATTRIBUTES

## password

The password to use when logging in.

## url

The URL to use when working with the api.  Defaults to

  http://www.assembla.com

## username

The username to use when logging in.

lib/API/Assembla.pm  view on Meta::CPAN

    is => 'ro',
    isa => 'LWP::UserAgent',
    lazy => 1,
    default => sub {
        my $self = shift;
        return LWP::UserAgent->new;
    }
);


has 'password' => (
    is => 'ro',
    isa => 'Str',
    required => 1
);


has 'url' => (
    is => 'ro',
    isa => 'URI',
    lazy => 1,

lib/API/Assembla.pm  view on Meta::CPAN

    }

    return \%objects;
}

sub make_req {
    my ($self, $path) = @_;

    my $req = HTTP::Request->new(GET => $self->url.$path);
    $req->header(Accept => 'application/xml');
    $req->authorization_basic($self->username, $self->password);
    return $req;
}

__PACKAGE__->meta->make_immutable;

1;



=pod

lib/API/Assembla.pm  view on Meta::CPAN

API has LOTS of stuff that this module does not yet contain.  These features
will be added as needed by the author or as gifted by thoughtful folks who
write patches! ;)

=head1 SYNOPSIS

    use API::Assembla;

    my $api = API::Asembla->new(
        username => $username,
        password => $password
    );

    my $href_of_spaces = $api->get_spaces;
    # Got an href of API::Assembla::Space objects keyed by space id
    my $space = $api->get_space($space_id);
    # Got an API::Assembla::Space object

    my $href_of_tickets = $api->get_tickets;
    # Got an href of API::Assembla::Space objects keyed by ticket id
    my $ticket = $api->get_ticket($space_id, $ticket_number);
    # Got an API::Assembla::Ticket object

=head1 DESCRIPTION

API::Assembla is a Perl interface to L<Assembla|http://www.assembla.com/>, a
ticketing, code hosting collaboration tool.

=head1 ATTRIBUTES

=head2 password

The password to use when logging in.

=head2 url

The URL to use when working with the api.  Defaults to

  http://www.assembla.com

=head2 username

The username to use when logging in.

t/spaces.t  view on Meta::CPAN

use strict;

if(!$ENV{'TEST_ASSEMBLA_PASS'}) {
    plan skip_all => 'This test is useless unless you are the author';
}

use API::Assembla;

my $api = API::Assembla->new(
    username => 'iirobot',
    password => $ENV{'TEST_ASSEMBLA_PASS'}
);

my $data = $api->get_spaces;
cmp_ok(scalar(keys($data)), '==', 2, '2 spaces');
ok(exists($data->{PRG}), 'PRG space');

{
    my $space = $data->{PRG};
    cmp_ok($space->name, 'eq', 'PRG', 'space name');
    cmp_ok($space->id, 'eq', 'dhHT8ENtKr4k_1eJe4gwI3', 'space id');

t/tickets.t  view on Meta::CPAN

use strict;

if(!$ENV{'TEST_ASSEMBLA_PASS'}) {
    plan skip_all => 'This test is useless unless you are the author';
}

use API::Assembla;

my $api = API::Assembla->new(
    username => 'iirobot',
    password => $ENV{'TEST_ASSEMBLA_PASS'}
);

my $tickets = $api->get_tickets('dhHT8ENtKr4k_1eJe4gwI3');
cmp_ok(scalar(keys($tickets)), '==', 3, '3 tickets');

{
    my $ticket = $tickets->{4317338};

    ok($ticket->description =~ /make it/, 'description');
    cmp_ok($ticket->number, '==', 3, 'number');



( run in 0.763 second using v1.01-cache-2.11-cpan-49f99fa48dc )