File Coverage

lib/Finance/Robinhood/User/Employment.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::Employment;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::User::Employment - Access Basic Data About the Current User
10              
11             =head1 SYNOPSIS
12              
13             use Finance::Robinhood;
14             my $rh = Finance::Robinhood->new;
15            
16             my $user = $rh->user;
17             my $info = $user->employment;
18              
19             CORE::say 'User is ' . $info->employment_status;
20              
21             =cut
22              
23             our $VERSION = '0.92_003';
24              
25             sub _test__init {
26 1     1   11555 my $rh = t::Utility::rh_instance(1);
27 0         0 my $user = $rh->user;
28 0         0 isa_ok($user, 'Finance::Robinhood::User');
29 0         0 t::Utility::stash('USER', $user); # Store it for later
30 0         0 my $basic_info = $user->employment();
31 0         0 isa_ok($basic_info, __PACKAGE__);
32 0         0 t::Utility::stash('USER_EMPLOYMENT_INFO', $basic_info);
33             }
34 1     1   8 use Mojo::Base-base, -signatures;
  1         3  
  1         8  
35 1     1   190 use Mojo::URL;
  1         3  
  1         7  
36             #
37 1     1   28 use Time::Moment;
  1         3  
  1         327  
38             #
39             has _rh => undef => weak => 1;
40              
41             =head1 METHODS
42              
43             =head2 C
44              
45             Mailing address box number or street and number.
46              
47             =head2 C
48              
49             Mailing address city or town.
50              
51             =head2 C
52              
53             Name of current employer.
54              
55             =head2 C
56              
57             State code.
58              
59             =head2 C
60              
61             Mailing address zip code.
62              
63             =head2 C
64              
65             C, C, C, or C.
66              
67             =head2 C
68              
69             Free form occupation.
70              
71             =head2 C
72              
73             Number of years. This value is static and must be updated by the user.
74              
75             =cut
76              
77             has ['employer_address', 'employer_city',
78             'employer_name', 'employer_state',
79             'employer_zipcode', 'employment_status',
80             'occupation', 'years_employed'
81             ];
82              
83             =head2 C
84              
85             $user->updated_at();
86              
87             Returns a Time::Moment object.
88              
89             =cut
90              
91 0     0 1 0 sub updated_at ($s) {
  0         0  
  0         0  
92 0         0 Time::Moment->from_string($s->{updated_at});
93             }
94              
95             sub _test_updated_at {
96 1   50 1   2018 t::Utility::stash('USER_EMPLOYMENT_INFO') // skip_all();
97 0         0 isa_ok(t::Utility::stash('USER_EMPLOYMENT_INFO')->updated_at(),
98             'Time::Moment');
99             }
100              
101             =head2 C
102              
103             $order->user();
104              
105             Reloads the data for this order from the API server.
106              
107             Use this if you think the status or some other info might have changed.
108              
109             =cut
110              
111 0     0 1 0 sub user($s) {
  0         0  
  0         0  
112 0         0 my $res = $s->_rh->_get($s->{user});
113             $_[0]
114             = $res->is_success
115 0 0       0 ? Finance::Robinhood::User->new(_rh => $s->_rh, %{$res->json})
  0 0       0  
116             : Finance::Robinhood::Error->new(
117             $res->is_server_error ? (details => $res->message) : $res->json);
118             }
119              
120             sub _test_user {
121 1   50 1   1880 t::Utility::stash('USER_EMPLOYMENT_INFO')
122             // skip_all('No additional user data object in stash');
123 0           isa_ok(t::Utility::stash('USER_EMPLOYMENT_INFO')->user(),
124             'Finance::Robinhood::User');
125             }
126              
127             =head1 LEGAL
128              
129             This is a simple wrapper around the API used in the official apps. The author
130             provides no investment, legal, or tax advice and is not responsible for any
131             damages incurred while using this software. This software is not affiliated
132             with Robinhood Financial LLC in any way.
133              
134             For Robinhood's terms and disclosures, please see their website at
135             https://robinhood.com/legal/
136              
137             =head1 LICENSE
138              
139             Copyright (C) Sanko Robinson.
140              
141             This library is free software; you can redistribute it and/or modify it under
142             the terms found in the Artistic License 2. Other copyrights, terms, and
143             conditions may apply to data transmitted through this module. Please refer to
144             the L section.
145              
146             =head1 AUTHOR
147              
148             Sanko Robinson Esanko@cpan.orgE
149              
150             =cut
151              
152             1;