File Coverage

blib/lib/Echo/StreamServer/Account.pm
Criterion Covered Total %
statement 18 21 85.7
branch 1 2 50.0
condition n/a
subroutine 5 6 83.3
pod 0 2 0.0
total 24 31 77.4


line stmt bran cond sub pod time code
1             package Echo::StreamServer::Account;
2              
3 1     1   16 use 5.008008;
  1         4  
  1         42  
4 1     1   6 use strict;
  1         1  
  1         26  
5 1     1   5 use warnings;
  1         2  
  1         30  
6              
7 1     1   539 use Echo::StreamServer::Settings;
  1         2  
  1         309  
8              
9             our $VERSION = '0.01';
10              
11             sub new {
12             # TODO: Add auth-type: Basic vs. OAUth2
13 1     1 0 16 my ($package, $appkey, $secret) = @_;
14 1         3 my %hash;
15              
16             # Choose the account parameters, or the default account in Settings.
17 1 50       3 if ($appkey) {
18 1         6 %hash = ( 'appkey' => $appkey, 'secret' => $secret);
19             }
20             else {
21 0         0 %hash = ( 'appkey' => $ECHO_API_KEY, 'secret' => $ECHO_API_SECRET );
22             }
23              
24 1         4 my $obj = bless \%hash => $package;
25 1         4 return $obj;
26             }
27              
28             sub name {
29 0     0 0   my $self = shift;
30 0           return "(StreamServer Account: appkey=" . $self->{'appkey'} . ")";
31             }
32              
33             1;
34             __END__