Backblaze-B2

 view release on metacpan or  search on metacpan

lib/Backblaze/B2.pm  view on Meta::CPAN

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    };
     
    if( $options{ api }->isAsync ) {
        $options{ bucket_class } ||= 'Backblaze::B2::v1::Bucket';
        $options{ file_class } ||= 'Backblaze::B2::v1::File';
    } else {
        $options{ bucket_class } ||= 'Backblaze::B2::v1::Bucket::Synchronized';
        $options{ file_class } ||= 'Backblaze::B2::v1::File::Synchronized';
    };
     
    bless \%options => $class
}
 
sub read_credentials {
    my( $self, @args ) = @_;
    $self->api->read_credentials(@args)
}
 
sub authorize_account {
    my( $self, @args ) = @_;
    $self->api->authorize_account(@args)

lib/Backblaze/B2.pm  view on Meta::CPAN

268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
use Scalar::Util 'weaken';
 
sub new {
    my( $class, %options ) = @_;
    weaken $options{ parent };
     
    # Whoa! We assume that the async version has the same class name
    # as the synchronous version and just strip it off.
    $options{ file_class } =~ s!::Synchronized$!!;
     
    bless \%options => $class,
}
 
sub name { $_[0]->{bucketName} }
#sub api { $_[0]->{api} }
sub downloadUrl { join "/", $_[0]->api->downloadUrl, $_[0]->name }
sub id { $_[0]->{bucketId} }
sub type { $_[0]->{bucketType} }
sub account { $_[0]->{parent} }
 
sub _new_file {

lib/Backblaze/B2.pm  view on Meta::CPAN

500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
};
 
sub new {
    my( $class, %options ) = @_;
     
    my $self = {
        impl => Backblaze::B2::v1::Bucket->new(%options),
        file_class => $options{ file_class },
    };
     
    bless $self => $class,
}
 
sub impl { $_[0]->{impl} }
 
sub _new_file {
    my( $self, %options ) = @_;
 
    $self->{file_class}->new(
        %options,
        api => $self->api,

lib/Backblaze/B2.pm  view on Meta::CPAN

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
use strict;
#use Scalar::Util 'weaken'; # do we really want to weaken our link?!
# The bucket doesn't hold a ref to us, so we don't want to weaken it
 
sub new {
    my( $class, %options ) = @_;
    #weaken $options{ bucket };
    #warn "$class: " . join ",", sort keys %options;
     
    bless \%options => $class,
}
 
sub name { $_[0]->{fileName} }
sub id { $_[0]->{fileId} }
sub action { $_[0]->{action} }
sub bucket { $_[0]->{bucket} }
sub size { $_[0]->{size} }
sub downloadUrl { join "/", $_[0]->bucket->downloadUrl, $_[0]->name }
 

lib/Backblaze/B2.pm  view on Meta::CPAN

658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
use Carp qw(croak);
#use Scalar::Util 'weaken'; # do we really want to weaken our link?!
# The bucket doesn't hold a ref to us, so we don't want to weaken it
 
sub new {
    my( $class, %options ) = @_;
    #weaken $options{ bucket };
    #warn "$class: " . join ",", sort keys %options;
    croak "Need impl" unless $options{ impl };
     
    bless \%options => $class,
}
 
sub name { $_[0]->{impl}->name }
sub id { $_[0]->{impl}->id }
sub action { $_[0]->{impl}->action }
sub bucket { $_[0]->{impl}->bucket }
sub size { $_[0]->{impl}->size }
sub downloadUrl { $_[0]->{impl}->downloadUrl }

lib/Backblaze/B2/v1/AnyEvent.pm  view on Meta::CPAN

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    my( $class, %options ) = @_;
 
    require Backblaze::B2;
     
    $options{ api_base } //= $Backblaze::B2::v1::API_BASE
                           = $Backblaze::B2::v1::API_BASE;
 
    croak "Need an API base"
        unless $options{ api_base };
     
    bless \%options => $class;
}
 
sub log_message {
    my( $self ) = shift;
    if( $self->{log_message}) {
        goto &{ $self->{log_message}};
    };
}
 
sub read_credentials {

lib/Backblaze/B2/v1/Synchronous.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                           = $Backblaze::B2::v1::API_BASE;
     
    $options{ api } ||= do {
        require Backblaze::B2::v1::AnyEvent;
        Backblaze::B2::v1::AnyEvent->new(
            api_base => $Backblaze::B2::v1::API_BASE,
            %options
        );
    };
     
    bless \%options => $class;
}
 
sub read_credentials {
    my( $self, @args ) = @_;
    $self->api->read_credentials(@args)
}
 
sub downloadUrl { $_[0]->api->downloadUrl };
sub apiUrl { $_[0]->api->apiUrl };



( run in 0.288 second using v1.01-cache-2.11-cpan-bb97c1e446a )