lib/Finance/Robinhood/Forex/Activation.pm

filter: Statementstmt 65.3% 17 / 26 Branchbran n/a Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 70.0% 7 / 10 Podpod 100% 2 / 2 totaltotal 58.0% 29 / 50 CC 4 SCAR 6.3
CC
4
Cov
62%
_test_stringify
2.5
_test_created_at
2.5
_test_updated_at
2.5
CRAP 1.9
« lib/Finance/Robinhood/Forex/Currency.pm ↑ Summary lib/Finance/Robinhood/Forex/Account.pm »
1 package Finance::Robinhood::Forex::Activation;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Forex::Activation - Represents a Single Forex Account
10 Application
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  
25 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=3.5
26 1 my $rh = t::Utility::rh_instance(1);
27 0 my $act = $rh->forex_activations->current;
28 0 isa_ok($act, __PACKAGE__);
29 0 t::Utility::stash('ACTIVATION', $act); # Store it for later
30 }
31 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
32  
33 1 ▶sub _test_stringify {
Subroutine _test_stringify: called CC=2 SCAR=9.2
34 1 ▶ t::Utility::stash('ACTIVATION') // skip_all();
Condition50%1/2
t::Utility::stash("ACTIVATION") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACTIVATION") // skip_all()
t::Utility::stash("ACTIVATION") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACTIVATION")B= skip_all()
ABresult
1X1
011
000
35 0 like(+t::Utility::stash('ACTIVATION'),
36 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
37 );
38 }
39 #
40 1 has _rh => undef => weak => 1;
41  
42 =head1 METHODS
43
44 =head2 C<created_at( )>
45  
46 Returns a Time::Moment object.
47  
48 =head2 C<email( )>
49  
50 The email address used to apply for a forex account.
51  
52 =head2 C<external_rejection_code( )>
53  
54 Reason why the account may have been (or should be) rejected. Will return one
55 of the following, if applicable:
56  
57 =over
58  
59 =item C<equities_account_deactivated>
60  
61 =item C<ineligible_jurisdiction>
62  
63 =item C<ineligible_jurisdiction2>
64  
65 =item C<ineligible_jurisdiction3>
66  
67 =item C<user_information_mismatch>
68  
69 =item C<no_equities_account>
70  
71 =item C<other>
72  
73 =item C<unsuitable>
74  
75 =back
76  
77 =head2 C<external_rejection_reason( )>
78  
79 If given, this is a string with a specific reason why the application to
80 activate an account was rejected.
81  
82 =head2 C<external_status_code( )>
83  
84 Same options as C<external_rejection_code( )>.
85  
86 =head2 C<first_name( )>
87  
88 The first name of the account holder.
89  
90 =head2 C<id( )>
91  
92 UUID of the activation attempt.
93  
94 =head2 C<last_name( )>
95  
96 The last name of the account holder.
97  
98 =head2 C<speculative( )>
99  
100 Boolean value.
101  
102 =head2 C<state( )>
103  
104 One of the following:
105  
106 =over
107  
108 =item C<approved>
109  
110 =item C<rejected>
111  
112 =item C<in_review>
113  
114 =back
115  
116 =head2 C<type( )>
117  
118 The type of account being applied for. May be one of the following:
119  
120 =over
121  
122 =item C<new_account>
123  
124 =item C<reactivation>
125  
126 =back
127  
128 =head2 C<user_id( )>
129  
130 Returns a UUID.
131  
132 =cut
133  
134 1 has ['email', 'external_rejection_code',
135 'external_rejection_reason', 'external_status_code',
136 'first_name', 'id',
137 'last_name', 'speculative',
138 'state', 'type',
139 'user_id'
140 ];
141  
142 =head2 C<created_at( )>
143  
144 Returns a Time::Moment object.
145  
146 =cut
147  
148 0 ▶sub created_at ($s) {
Subroutine created_at: not called CC=1 SCAR=6.9
Pod documented
149 0 Time::Moment->from_string($s->{created_at});
150 }
151  
152 1 ▶sub _test_created_at {
Subroutine _test_created_at: called CC=2 SCAR=9.2
153 1 ▶ t::Utility::stash('ACTIVATION') // skip_all();
Condition50%1/2
t::Utility::stash("ACTIVATION") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACTIVATION") // skip_all()
t::Utility::stash("ACTIVATION") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACTIVATION")B= skip_all()
ABresult
1X1
011
000
154 0 isa_ok(t::Utility::stash('ACTIVATION')->created_at, 'Time::Moment');
155 }
156  
157 =head2 C<updated_at( )>
158  
159 Returns a Time::Moment object.
160  
161 =cut
162  
163 0 ▶sub updated_at ($s) {
Subroutine updated_at: not called CC=1 SCAR=6.9
Pod documented
164 0 Time::Moment->from_string($s->{updated_at});
165 }
166  
167 1 ▶sub _test_updated_at {
Subroutine _test_updated_at: called CC=2 SCAR=9.2
168 1 ▶ t::Utility::stash('ACTIVATION') // skip_all();
Condition50%1/2
t::Utility::stash("ACTIVATION") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("ACTIVATION") // skip_all()
t::Utility::stash("ACTIVATION") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("ACTIVATION")B= skip_all()
ABresult
1X1
011
000
169 0 isa_ok(t::Utility::stash('ACTIVATION')->updated_at, 'Time::Moment');
170 }
171  
172 =head1 LEGAL
173  
174 This is a simple wrapper around the API used in the official apps. The author
175 provides no investment, legal, or tax advice and is not responsible for any
176 damages incurred while using this software. This software is not affiliated
177 with Robinhood Financial LLC in any way.
178  
179 For Robinhood's terms and disclosures, please see their website at
180 https://robinhood.com/legal/
181  
182 =head1 LICENSE
183  
184 Copyright (C) Sanko Robinson.
185  
186 This library is free software; you can redistribute it and/or modify it under
187 the terms found in the Artistic License 2. Other copyrights, terms, and
188 conditions may apply to data transmitted through this module. Please refer to
189 the L<LEGAL> section.
190  
191 =head1 AUTHOR
192  
193 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
194  
195 =cut
196  
197 1 1;
« lib/Finance/Robinhood/Forex/Currency.pm ↑ Summary lib/Finance/Robinhood/Forex/Account.pm »