| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Filename: Response.pm |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# OFX response |
|
4
|
|
|
|
|
|
|
# http://www.ofx.net/ |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Created February 16, 2008 Brandon Fosdick |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# Copyright 2008 Brandon Fosdick (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
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
15
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
16
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
55
|
|
|
17
|
1
|
|
|
1
|
|
6
|
use base qw(HTTP::Response); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1431
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '2'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
63734
|
use Finance::OFX::Parse; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
510
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
0
|
|
|
0
|
1
|
|
my ($this, %options) = @_; |
|
26
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
|
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
|
|
|
|
|
|
|
{ |
|
36
|
0
|
|
|
0
|
1
|
|
my ($this, $self) = @_; |
|
37
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
|
38
|
0
|
|
|
|
|
|
bless $self, $class; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
return $self unless $self->is_success; |
|
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
|
|
|
|
|
|
|
{ |
|
52
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
|
53
|
0
|
0
|
|
|
|
|
$s->{ofx} = shift if scalar @_; |
|
54
|
0
|
|
|
|
|
|
$s->{ofx}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub ofx_header |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
|
60
|
0
|
0
|
|
|
|
|
$s->{ofxHeader} = shift if scalar @_; |
|
61
|
0
|
|
|
|
|
|
$s->{ofxHeader}; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub signonInstitution |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
0
|
|
|
0
|
0
|
|
my $s = shift; |
|
67
|
0
|
|
|
|
|
|
return $s->{ofx}{signonmsgsrsv1}{sonrs}{fi}; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub signon_status_code |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
|
73
|
0
|
|
|
|
|
|
return $s->{ofx}{signonmsgsrsv1}{sonrs}{status}{code}; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |