| 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 | 1 | our $VERSION = '0.92_003'; | |||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=4.9
| |||||||||||||||||||
| 26 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 27 | 0 | my $user = $rh->user; | |||||||||||||||||
| 28 | 0 | isa_ok($user, 'Finance::Robinhood::User'); | |||||||||||||||||
| 29 | 0 | t::Utility::stash('USER', $user); # Store it for later | |||||||||||||||||
| 30 | 0 | my $basic_info = $user->employment(); | |||||||||||||||||
| 31 | 0 | isa_ok($basic_info, __PACKAGE__); | |||||||||||||||||
| 32 | 0 | t::Utility::stash('USER_EMPLOYMENT_INFO', $basic_info); | |||||||||||||||||
| 33 | } | ||||||||||||||||||
| 34 | 1 | ▶ | use Mojo::Base-base, -signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 35 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 36 | # | ||||||||||||||||||
| 37 | 1 | ▶ | use Time::Moment; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 38 | # | ||||||||||||||||||
| 39 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 40 | |||||||||||||||||||
| 41 | =head1 METHODS | ||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | =head2 C<employer_address( )> | ||||||||||||||||||
| 44 | |||||||||||||||||||
| 45 | Mailing address box number or street and number. | ||||||||||||||||||
| 46 | |||||||||||||||||||
| 47 | =head2 C<employer_city( )> | ||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | Mailing address city or town. | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | =head2 C<employer_name( )> | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | Name of current employer. | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | =head2 C<employer_state( )> | ||||||||||||||||||
| 56 | |||||||||||||||||||
| 57 | State code. | ||||||||||||||||||
| 58 | |||||||||||||||||||
| 59 | =head2 C<employer_zipcode( )> | ||||||||||||||||||
| 60 | |||||||||||||||||||
| 61 | Mailing address zip code. | ||||||||||||||||||
| 62 | |||||||||||||||||||
| 63 | =head2 C<employment_status( )> | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | C<employed>, C<unemployed>, C<retired>, or C<student>. | ||||||||||||||||||
| 66 | |||||||||||||||||||
| 67 | =head2 C<occupation( )> | ||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | Free form occupation. | ||||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | =head2 C<years_employed( )> | ||||||||||||||||||
| 72 | |||||||||||||||||||
| 73 | Number of years. This value is static and must be updated by the user. | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | =cut | ||||||||||||||||||
| 76 | |||||||||||||||||||
| 77 | 1 | has ['employer_address', 'employer_city', | |||||||||||||||||
| 78 | 'employer_name', 'employer_state', | ||||||||||||||||||
| 79 | 'employer_zipcode', 'employment_status', | ||||||||||||||||||
| 80 | 'occupation', 'years_employed' | ||||||||||||||||||
| 81 | ]; | ||||||||||||||||||
| 82 | |||||||||||||||||||
| 83 | =head2 C<updated_at( )> | ||||||||||||||||||
| 84 | |||||||||||||||||||
| 85 | $user->updated_at(); | ||||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | Returns a Time::Moment object. | ||||||||||||||||||
| 88 | |||||||||||||||||||
| 89 | =cut | ||||||||||||||||||
| 90 | |||||||||||||||||||
| 91 | 0 | ▶ | sub updated_at ($s) { | ||||||||||||||||
|
Subroutine
updated_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 92 | 0 | Time::Moment->from_string($s->{updated_at}); | |||||||||||||||||
| 93 | } | ||||||||||||||||||
| 94 | |||||||||||||||||||
| 95 | 1 | ▶ | sub _test_updated_at { | ||||||||||||||||
|
Subroutine
_test_updated_at: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 96 | 1 | ▶ | t::Utility::stash('USER_EMPLOYMENT_INFO') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("USER_EMPLOYMENT_INFO") // skip_all()
MC/DC0%0/2
t::Utility::stash("USER_EMPLOYMENT_INFO") // skip_all()
t::Utility::stash("USER_EMPLOYMENT_INFO")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("USER_EMPLOYMENT_INFO")B= skip_all()
| |||||||||||||||||||
| 97 | 0 | isa_ok(t::Utility::stash('USER_EMPLOYMENT_INFO')->updated_at(), | |||||||||||||||||
| 98 | 'Time::Moment'); | ||||||||||||||||||
| 99 | } | ||||||||||||||||||
| 100 | |||||||||||||||||||
| 101 | =head2 C<user( )> | ||||||||||||||||||
| 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 | ▶ | sub user($s) { | ||||||||||||||||
|
Subroutine
user: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||
| 112 | 0 | my $res = $s->_rh->_get($s->{user}); | |||||||||||||||||
| 113 | $_[0] | ||||||||||||||||||
| 114 | = $res->is_success | ||||||||||||||||||
| 115 | 0 | ▶ | ? Finance::Robinhood::User->new(_rh => $s->_rh, %{$res->json}) | ||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||
| 116 | : Finance::Robinhood::Error->new( | ||||||||||||||||||
| 117 | $res->is_server_error ? (details => $res->message) : $res->json); | ||||||||||||||||||
| 118 | } | ||||||||||||||||||
| 119 | |||||||||||||||||||
| 120 | 1 | ▶ | sub _test_user { | ||||||||||||||||
|
Subroutine
_test_user: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 121 | 1 | ▶ | t::Utility::stash('USER_EMPLOYMENT_INFO') | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("USER_EMPLOYMENT_INFO") // skip_all("No additional user data object in stash")
MC/DC0%0/2
t::Utility::stash("USER_EMPLOYMENT_INFO") // skip_all("No additional user data object in stash")
t::Utility::stash("USER_EMPLOYMENT_INFO")
skip_all("No additional user data object in stash")
Truth table33%1/3
A // B
A= t::Utility::stash("USER_EMPLOYMENT_INFO")B= skip_all("No additional user data object in stash")
| |||||||||||||||||||
| 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<LEGAL> section. | ||||||||||||||||||
| 145 | |||||||||||||||||||
| 146 | =head1 AUTHOR | ||||||||||||||||||
| 147 | |||||||||||||||||||
| 148 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 149 | |||||||||||||||||||
| 150 | =cut | ||||||||||||||||||
| 151 | |||||||||||||||||||
| 152 | 1 | 1; | |||||||||||||||||