lib/Finance/Robinhood/Forex/Account.pm

filter: Statementstmt 68.9% 20 / 29 Branchbran n/a Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 72.7% 8 / 11 Podpod 100% 2 / 2 totaltotal 61.1% 33 / 54 CC 4 SCAR 6.0
CC
4
Cov
66%
_test_stringify
2.5
_test_created_at
2.5
_test_updated_at
2.5
CRAP 1.8
« lib/Finance/Robinhood/Forex/Activation.pm ↑ Summary lib/Finance/Robinhood/Forex/Portfolio.pm »
1 package Finance::Robinhood::Forex::Account;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Forex::Account - Represents a Single Forex/Crypto Trade
10 Account
11  
12 =head1 SYNOPSIS
13  
14 use Finance::Robinhood;
15 my $rh = Finance::Robinhood->new;
16  
17 # TODO
18  
19 =cut
20  
21 1 our $VERSION = '0.92_003';
22 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Time::Moment;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=3.5
27 1 my $rh = t::Utility::rh_instance(1);
28 0 my $acct = $rh->forex_accounts->current;
29 0 isa_ok($acct, __PACKAGE__);
30 0 t::Utility::stash('ACCOUNT', $acct); # Store it for later
31 }
32 0 ▶use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
33  
34 1 ▶sub _test_stringify {
Subroutine _test_stringify: called CC=2 SCAR=9.2
35 1 ▶ t::Utility::stash('ACCOUNT') // skip_all();
Condition50%1/2
t::Utility::stash("ACCOUNT") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACCOUNT") // skip_all()
t::Utility::stash("ACCOUNT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACCOUNT")B= skip_all()
ABresult
1X1
011
000
36 0 like(+t::Utility::stash('ACCOUNT'),
37 qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i
38 );
39 }
40 #
41 1 has _rh => undef => weak => 1;
42  
43 =head1 METHODS
44  
45 =head2 C<created_at( )>
46  
47 Returns a Time::Moment object.
48  
49 =head2 C<id( )>
50  
51 Returns a UUID.
52  
53 =head2 C<status( )>
54  
55  
56  
57 =head2 C<status_reason_code( )>
58  
59 One of the following: C<outage>, C<scheduled_maintenance>, or C<other>.
60  
61 =head2 C<updated_at( )>
62  
63 Returns a Time::Moment object.
64  
65 =head2 C<user_id( )>
66  
67 Returns a UUID.
68  
69 =cut
70  
71 1 has ['id', 'status', 'status_reason_code', 'user_id'];
72  
73 0 ▶sub created_at ($s) {
Subroutine created_at: not called CC=1 SCAR=6.9
Pod documented
74 0 Time::Moment->from_string($s->{created_at});
75 }
76  
77 1 ▶sub _test_created_at {
Subroutine _test_created_at: called CC=2 SCAR=9.2
78 1 ▶ t::Utility::stash('ACCOUNT') // skip_all();
Condition50%1/2
t::Utility::stash("ACCOUNT") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACCOUNT") // skip_all()
t::Utility::stash("ACCOUNT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACCOUNT")B= skip_all()
ABresult
1X1
011
000
79 0 isa_ok(t::Utility::stash('ACCOUNT')->created_at, 'Time::Moment');
80 }
81  
82 0 ▶sub updated_at ($s) {
Subroutine updated_at: not called CC=1 SCAR=6.9
Pod documented
83 0 Time::Moment->from_string($s->{updated_at});
84 }
85  
86 1 ▶sub _test_updated_at {
Subroutine _test_updated_at: called CC=2 SCAR=9.2
87 1 ▶ t::Utility::stash('ACCOUNT') // skip_all();
Condition50%1/2
t::Utility::stash("ACCOUNT") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACCOUNT") // skip_all()
t::Utility::stash("ACCOUNT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACCOUNT")B= skip_all()
ABresult
1X1
011
000
88 0 isa_ok(t::Utility::stash('ACCOUNT')->updated_at, 'Time::Moment');
89 }
90  
91 =head1 LEGAL
92  
93 This is a simple wrapper around the API used in the official apps. The author
94 provides no investment, legal, or tax advice and is not responsible for any
95 damages incurred while using this software. This software is not affiliated
96 with Robinhood Financial LLC in any way.
97  
98 For Robinhood's terms and disclosures, please see their website at
99 https://robinhood.com/legal/
100  
101 =head1 LICENSE
102  
103 Copyright (C) Sanko Robinson.
104  
105 This library is free software; you can redistribute it and/or modify it under
106 the terms found in the Artistic License 2. Other copyrights, terms, and
107 conditions may apply to data transmitted through this module. Please refer to
108 the L<LEGAL> section.
109  
110 =head1 AUTHOR
111  
112 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
113  
114 =cut
115  
116 1 1;
« lib/Finance/Robinhood/Forex/Activation.pm ↑ Summary lib/Finance/Robinhood/Forex/Portfolio.pm »