File Coverage

lib/Finance/Robinhood/User/AdditionalInfo.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 4 0.0
condition 2 4 50.0
subroutine 6 8 75.0
pod 2 2 100.0
total 22 48 45.8


line stmt bran cond sub pod time code
1             package Finance::Robinhood::User::AdditionalInfo;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::User::AdditionalInfo - Access Additional Data About the
10             Current User
11              
12             =head1 SYNOPSIS
13              
14             use Finance::Robinhood;
15             my $rh = Finance::Robinhood->new;
16            
17             my $user = $rh->user;
18             my $info = $user->additional_info;
19              
20             CORE::say $user->first_name . ' has ' . $info->stock_loan_consent_status . ' to lending shares';
21              
22             =cut
23              
24             our $VERSION = '0.92_003';
25              
26             sub _test__init {
27 1     1   12228 my $rh = t::Utility::rh_instance(1);
28 0         0 my $user = $rh->user;
29 0         0 isa_ok($user, 'Finance::Robinhood::User');
30 0         0 t::Utility::stash('USER', $user); # Store it for later
31 0         0 my $add_info = $user->additional_info();
32 0         0 isa_ok($add_info, __PACKAGE__);
33 0         0 t::Utility::stash('USER_ADD_INFO', $add_info);
34             }
35 1     1   8 use Mojo::Base-base, -signatures;
  1         2  
  1         7  
36 1     1   190 use Mojo::URL;
  1         4  
  1         6  
37             #
38 1     1   29 use Time::Moment;
  1         2  
  1         346  
39             #
40             has _rh => undef => weak => 1;
41              
42             =head1 METHODS
43              
44             =head2 C
45              
46             Returns true if the user has accepted the Robinhood Securities agreement and
47             the account has been converted away from Apex.
48              
49             =head2 C
50              
51             Returns true if the user has accepted the Robinhood Securities margin agreement
52             and the Instant or Gold account has been converted away from Apex.
53              
54             =head2 C
55              
56             Returns true if they user has a designated control person who can take control
57             of the account.
58              
59             =head2 C
60              
61             Private data required to release the account to the control person.
62              
63             =head2 C
64              
65             Returns true if the user objected to the Robinhood user data disclosure
66             agreement.
67              
68             =head2 C
69              
70             Returns the address if the user is a direct employee of a securities related
71             company.
72              
73             =head2 C
74              
75             Returns true if the user is a direct employee of a securities related company.
76              
77             =head2 C
78              
79             Returns the name of the firm the user is employed by.
80              
81             =head2 C
82              
83             Returns the type of relationship the user has to the securities related firm.
84              
85             =head2 C
86              
87             Returns the name of the person directly related to a securities related
88             company.
89              
90             =head2 C
91              
92             If the user has consented to lending shares they own out, this contains the
93             string C.
94              
95             =head2 C
96              
97             Returns true if the user has agreed to allow funds to be moved back and forth
98             from Robinhood Financial and Robinhood Crypto with sweep.
99              
100             =cut
101              
102             has ['agreed_to_rhs',
103             'agreed_to_rhs_margin',
104             'control_person',
105             'control_person_security_symbol',
106             'object_to_disclosure',
107             'security_affiliated_address',
108             'security_affiliated_employee',
109             'security_affiliated_firm_name',
110             'security_affiliated_firm_relationship',
111             'security_affiliated_person_name',
112             'stock_loan_consent_status',
113             'sweep_consent'
114             ];
115              
116             =head2 C
117              
118             $user->updated_at();
119              
120             Returns a Time::Moment object.
121              
122             =cut
123              
124 0     0 1 0 sub updated_at ($s) {
  0         0  
  0         0  
125 0         0 Time::Moment->from_string($s->{updated_at});
126             }
127              
128             sub _test_updated_at {
129 1   50 1   1958 t::Utility::stash('USER_ADD_INFO') // skip_all();
130 0         0 isa_ok(t::Utility::stash('USER_ADD_INFO')->updated_at(), 'Time::Moment');
131             }
132              
133             =head2 C
134              
135             $order->user();
136              
137             Reloads the data for this order from the API server.
138              
139             Use this if you think the status or some other info might have changed.
140              
141             =cut
142              
143 0     0 1 0 sub user($s) {
  0         0  
  0         0  
144 0         0 my $res = $s->_rh->_get($s->{user});
145             $_[0]
146             = $res->is_success
147 0 0       0 ? Finance::Robinhood::User->new(_rh => $s->_rh, %{$res->json})
  0 0       0  
148             : Finance::Robinhood::Error->new(
149             $res->is_server_error ? (details => $res->message) : $res->json);
150             }
151              
152             sub _test_user {
153 1   50 1   1901 t::Utility::stash('USER_ADD_INFO')
154             // skip_all('No additional user data object in stash');
155 0           isa_ok(t::Utility::stash('USER_ADD_INFO')->user(),
156             'Finance::Robinhood::User');
157             }
158              
159             =head1 LEGAL
160              
161             This is a simple wrapper around the API used in the official apps. The author
162             provides no investment, legal, or tax advice and is not responsible for any
163             damages incurred while using this software. This software is not affiliated
164             with Robinhood Financial LLC in any way.
165              
166             For Robinhood's terms and disclosures, please see their website at
167             https://robinhood.com/legal/
168              
169             =head1 LICENSE
170              
171             Copyright (C) Sanko Robinson.
172              
173             This library is free software; you can redistribute it and/or modify it under
174             the terms found in the Artistic License 2. Other copyrights, terms, and
175             conditions may apply to data transmitted through this module. Please refer to
176             the L section.
177              
178             =head1 AUTHOR
179              
180             Sanko Robinson Esanko@cpan.orgE
181              
182             =cut
183              
184             1;