line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::User::IDInfo; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::User::IDInfo - Access Really Basic Data About the Current |
10
|
|
|
|
|
|
|
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->id_info; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
CORE::say 'User: ' . $info->username; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _test__init { |
27
|
1
|
|
|
1
|
|
11406
|
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 $id_info = $user->id_info(); |
32
|
0
|
|
|
|
|
0
|
isa_ok($id_info, __PACKAGE__); |
33
|
0
|
|
|
|
|
0
|
t::Utility::stash('USER_ID_INFO', $id_info); |
34
|
|
|
|
|
|
|
} |
35
|
1
|
|
|
1
|
|
10
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
36
|
1
|
|
|
1
|
|
192
|
use Mojo::URL; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
37
|
|
|
|
|
|
|
# |
38
|
1
|
|
|
1
|
|
28
|
use Time::Moment; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
241
|
|
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 C |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
UUID representing this particular user. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 C |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Current user's login name. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has ['id', 'username']; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$order->user(); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Reloads the data for this order from the API server. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Use this if you think the status or some other info might have changed. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
0
|
sub user($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
67
|
|
|
|
|
|
|
my $res = $s->_rh->_get($s->{url}) |
68
|
0
|
|
|
|
|
0
|
; # Yes, this is correct rather than 'user'. IDK why. |
69
|
|
|
|
|
|
|
$_[0] |
70
|
|
|
|
|
|
|
= $res->is_success |
71
|
0
|
0
|
|
|
|
0
|
? Finance::Robinhood::User->new(_rh => $s->_rh, %{$res->json}) |
|
0
|
0
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
73
|
|
|
|
|
|
|
$res->is_server_error ? (details => $res->message) : $res->json); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _test_user { |
77
|
1
|
|
50
|
1
|
|
2032
|
t::Utility::stash('USER_ID_INFO') |
78
|
|
|
|
|
|
|
// skip_all('No user id data object in stash'); |
79
|
0
|
|
|
|
|
|
isa_ok(t::Utility::stash('USER_ID_INFO')->user(), |
80
|
|
|
|
|
|
|
'Finance::Robinhood::User'); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LEGAL |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
86
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
87
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
88
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
91
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 LICENSE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
98
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
99
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
100
|
|
|
|
|
|
|
the L section. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |