File Coverage

lib/Finance/Robinhood/Equity/Account/InstantEligibility.pm
Criterion Covered Total %
statement 13 34 38.2
branch 0 4 0.0
condition 3 6 50.0
subroutine 7 10 70.0
pod 2 2 100.0
total 25 56 44.6


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Equity::Account::InstantEligibility;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Equity::Account - Robinhood Account's Instant or Gold
10             Margin Account Eligibility
11              
12             =head1 SYNOPSIS
13              
14             use Finance::Robinhood;
15             my $rh = Finance::Robinhood->new->login('user', 'pass');
16             my $account = $rh->equity_accounts->current();
17              
18             CORE::say 'Instant? ' . $account->instant_eligibility->state;
19              
20             =cut
21              
22             sub _test__init {
23 1     1   15970 my $rh = t::Utility::rh_instance(1);
24 0         0 my $acct = $rh->equity_accounts->current;
25 0         0 my $instant_eligibility = $acct->instant_eligibility;
26 0         0 isa_ok( $instant_eligibility, __PACKAGE__ );
27 0         0 t::Utility::stash( 'INSTANT', $instant_eligibility ); # Store it for later
28             }
29             our $VERSION = '0.92_002';
30 1     1   8 use Mojo::Base-base, -signatures;
  1         2  
  1         7  
31 1     1   200 use Mojo::URL;
  1         2  
  1         8  
32 1     1   62 use overload '""' => sub ( $s, @ ) { $s->{state} }, fallback => 1;
  1     0   2  
  1         21  
  0         0  
  0         0  
  0         0  
  0         0  
33              
34             sub _test_stringify {
35 1   50 1   2164 t::Utility::stash('INSTANT') // skip_all();
36 0         0 is( +t::Utility::stash('INSTANT'), 'ok' );
37             }
38              
39             =head1 METHODS
40              
41             =cut
42              
43             has _rh => undef => weak => 1;
44              
45             =head2 C
46              
47              
48             =head2 C
49              
50             =head2 C
51              
52             =cut
53              
54             has [ 'state', 'reversal', 'reason' ];
55              
56             =head2 C
57              
58             Returns a Time::Moment object if applicable.
59              
60             =cut
61              
62 0     0 1 0 sub reinstatement_date ($s) {
  0         0  
  0         0  
63 0         0 Time::Moment->from_string( $s->{reinstatement_date} . 'T00:00:00Z' );
64             }
65              
66             sub _test_reinstatement_date {
67 1   50 1   2489 t::Utility::stash('INSTANT') // skip_all('No instant eligibility object in stash');
68 0 0       0 skip_all('Instant state is okay... No reinstatement_date set')
69             if t::Utility::stash('INSTANT')->state eq 'ok';
70 0         0 isa_ok( t::Utility::stash('INSTANT')->reinstatement_date, 'Time::Moment' );
71             }
72              
73             =head2 C
74              
75             Returns a Time::Moment object if applicable.
76              
77             =cut
78              
79 0     0 1 0 sub updated_at ($s) {
  0         0  
  0         0  
80 0         0 Time::Moment->from_string( $s->{updated_at} );
81             }
82              
83             sub _test_updated_at {
84 1   50 1   2078 t::Utility::stash('INSTANT') // skip_all('No instant eligibility object in stash');
85 0 0         skip_all('Instant state is okay... No updated_at set')
86             if t::Utility::stash('INSTANT')->state eq 'ok';
87 0           isa_ok( t::Utility::stash('INSTANT')->updated_at, 'Time::Moment' );
88             }
89              
90             =head1 LEGAL
91              
92             This is a simple wrapper around the API used in the official apps. The author
93             provides no investment, legal, or tax advice and is not responsible for any
94             damages incurred while using this software. This software is not affiliated
95             with Robinhood Financial LLC in any way.
96              
97             For Robinhood's terms and disclosures, please see their website at
98             https://robinhood.com/legal/
99              
100             =head1 LICENSE
101              
102             Copyright (C) Sanko Robinson.
103              
104             This library is free software; you can redistribute it and/or modify it under
105             the terms found in the Artistic License 2. Other copyrights, terms, and
106             conditions may apply to data transmitted through this module. Please refer to
107             the L section.
108              
109             =head1 AUTHOR
110              
111             Sanko Robinson Esanko@cpan.orgE
112              
113             =cut
114              
115             1;