net-bitbucket /lib/Net/Bitbucket.pm

Language Perl Lines 48
MD5 Hash 39181caea734f69d5a64d99e557856a1 Estimated Cost $752 (why?)
Repository https://bitbucket.org/alanhaggai/net-bitbucket View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ABSTRACT: Interface to Bitbucket's API

use strict;
use warnings;

package Net::Bitbucket;

use base qw(
    Net::Bitbucket::Internal
    Net::Bitbucket::Changeset
    Net::Bitbucket::Email
    Net::Bitbucket::Event
    Net::Bitbucket::Follower
    Net::Bitbucket::Group
    Net::Bitbucket::Invite
);

use LWP::UserAgent;

sub new {
    my ( $self, $args ) = @_;

    $self = {};

    my $api_version = '1.0';
    my $api_url     = "https://api.bitbucket.org/$api_version";

    my $ua = LWP::UserAgent->new();
    $ua->agent( __PACKAGE__ . '/' . __PACKAGE__->VERSION );

    if ( exists $args->{'username'} && exists $args->{'password' } ) {
        $self->{'username'} = $args->{'username'};
        $self->{'password'} = $args->{'password'};
    }

    $self->{'api_url'} = $api_url;
    $self->{'ua'}       = $ua;

    return bless $self, __PACKAGE__;
}

sub http_status {
    my $self = shift;
    return $self->{'_http_status'};
}

1;
Back to Top