OFX/Response.pm

filter: Statementstmt 42.5% 17 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 45.4% 5 / 11 Podpod 83.3% 5 / 6 totaltotal 36.9% 27 / 73 CC 6 SCAR 16.2
CC
6
Cov
33%
from_http_response
12.0
new
6.0
ofx
6.0
CRAP 5.1
« OFX/UserAgent.pm ↑ Summary OFX/Tree.pm »
1 # Filename: Response.pm
2 #
3 # OFX response
4 # http://www.ofx.net/
5 #
6 # Created February 16, 2008 Brandon Fosdick <bfoz@bfoz.net>
7 #
8 # Copyright 2008 Brandon Fosdick <bfoz@bfoz.net> (BSD License)
9 #
10 # $Id: Response.pm,v 1.2 2008/03/04 04:22:27 bfoz Exp $
11  
12 package Finance::OFX::Response;
13  
14 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use base qw(HTTP::Response);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 our $VERSION = '2';
20  
21 2 ▶use Finance::OFX::Parse;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 sub new
24 0 ▶{
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
25 0 my ($this, %options) = @_;
26 0 ▶ my $class = ref($this) || $this;
Condition0%0/3
ref $this || $this
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table0%0/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
27 0 my $self = $class->SUPER::new(%options);
28 0 bless $self, $class;
29 0 return $self;
30 }
31  
32 # Create a new OFX::Response from an HTTP::Response object
33 # NOTE: Re-blesses the passed reference
34 sub from_http_response
35 0 ▶{
Subroutine from_http_response: not called CC=3 SCAR=24.8
Pod documented
36 0 my ($this, $self) = @_;
37 0 ▶ my $class = ref($this) || $this;
Condition0%0/3
ref $this || $this
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table0%0/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
38 0 bless $self, $class;
39  
40 0 ▶ return $self unless $self->is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_success 0 0 0
41  
42 # Parse the HTTP response into an OFX tree
43 0 $self->{tree} = Finance::OFX::Parse::parse($self->content);
44 0 $self->{ofx} = $self->{tree}{ofx};
45 0 $self->{ofxHeader} = $self->{tree}{header};
46  
47 0 return $self;
48 }
49  
50 sub ofx
51 0 ▶{
Subroutine ofx: not called CC=2 SCAR=17.9
Pod documented
52 0 my $s = shift;
53 0 ▶ $s->{ofx} = shift if scalar @_;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ 0 0 0
54 0 $s->{ofx};
55 }
56  
57 sub ofx_header
58 0 ▶{
Subroutine ofx_header: not called CC=2 SCAR=17.9
Pod documented
59 0 my $s = shift;
60 0 ▶ $s->{ofxHeader} = shift if scalar @_;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ 0 0 0
61 0 $s->{ofxHeader};
62 }
63  
64 sub signonInstitution
65 0 ▶{
Subroutine signonInstitution: not called CC=1 SCAR=6.9
Pod undocumented
66 0 my $s = shift;
67 0 return $s->{ofx}{signonmsgsrsv1}{sonrs}{fi};
68 }
69  
70 sub signon_status_code
71 0 ▶{
Subroutine signon_status_code: not called CC=1 SCAR=6.9
Pod documented
72 0 my $s = shift;
73 0 return $s->{ofx}{signonmsgsrsv1}{sonrs}{status}{code};
74 }
75  
76 2 1;
77  
78 __END__
« OFX/UserAgent.pm ↑ Summary OFX/Tree.pm »