blib/lib/Finance/Robinhood/ACH.pm

filter: Statementstmt 66.6% 14 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 50.0% 1 / 2 totaltotal 56.2% 18 / 32 CC 2 SCAR 9.2
CC
2
Cov
61%
schedule_deposit
6.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.5
« blib/lib/Finance/Robinhood/Equity/Instrument.pm ↑ Summary blib/lib/Finance/Robinhood/Options/Order.pm »
1 package Finance::Robinhood::ACH;
2 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use DateTime::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Finance::Robinhood::Utils::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 has 'client' => (
6 is => 'rw',
7 0 ▶ default => sub { Finance::Robinhood::Utils::Client->instance },
Subroutine __ANON__: not called CC=1 SCAR=6.9
8 3 handles => [qw[post]]
9 );
10 3 has [
11 qw[account
12 bank_account_holder_name bank_account_nickname bank_account_number bank_account_type bank_routing_number
13 id initial_deposit
14 verification_method verified verify_micro_deposits
15 withdrawl_limit
16 url
17 ]
18 ] => ( is => 'ro' );
19 has [ 'created_at', 'updated_at' ] => (
20 is => 'ro',
21 coerce => sub {
22 0 ▶ $_[0] =~ s'Z$'';
Subroutine __ANON__: not called CC=1 SCAR=6.9
23  
24 # BUG: DateTime::Tiny cannot handle sub-second values.
25 0 $_[0] =~ s'\..+$'';
26 0 DateTime::Tiny->from_string( $_[0] );
27 }
28 3 );
29 3 has "_unlink" => ( is => 'ro', init_arg => 'unlink' );
30  
31 ▶sub unlink {
Subroutine unlink: not called CC=1 SCAR=0.0
Pod undocumented
32  
33 # TODO
34 }
35  
36 =head2 C<schedule_deposit( ... )>
37  
38 my $ok = $ach->schedule_deposit( 500, 'weekly' );
39  
40 Create a scheduled ACH deposit. This is returned as a C<Finance::Robinhood::ACH::ScheduledDeposit> object.
41  
42 Expected arguments are:
43  
44 =over
45  
46 =item * amount to transfer
47  
48 =item * frequency
49  
50 Options for frequency include:
51  
52 =over
53  
54 =item * C<once> - The deposit will be initiated immediately.
55  
56 =item * C<weekly> - The deposit will be initiated every Monday.
57  
58 =item * C<biweekly> - The deposit will be initiated on the 1st and 15th of every month.
59  
60 =item * C<monthly> - The deposit will be initiated on the 1st of every month.
61  
62 =item * C<quarterly> - The deposit will be initiated on the 1st of January, April, July, and October.
63  
64 =back
65  
66 =back
67  
68 To cancel the deposit, use the object's C<cancel()> method.
69  
70 =cut
71  
72 sub schedule_deposit {
73 0 ▶ my ( $s, $amount, $frequency ) = @_;
Subroutine schedule_deposit: not called CC=2 SCAR=17.9
Pod documented
74 0 my ( $status, $data ) = $s->post( $Finance::Robinhood::Endpoints{'ach/deposit_schedules'},
75 { ach_relationship => $s->url, amount => $amount, frequency => $frequency } );
76 0 ▶ $status == 201 ? Finance::Robinhood::ACH::ScheduledDeposit->new($data) : ();
Branch: 1 branch
BranchTrueFalseTotal
$status == 201 ? : 0 0 0
77 }
78 3 1;
« blib/lib/Finance/Robinhood/Equity/Instrument.pm ↑ Summary blib/lib/Finance/Robinhood/Options/Order.pm »