lib/Finance/Robinhood/Equity/Earnings/Call.pm

filter: Statementstmt 51.6% 16 / 31 Branchbran 0.0% 0 / 8 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 63.6% 7 / 11 Podpod 100% 3 / 3 totaltotal 44.6% 29 / 65 CC 8 SCAR 14.5
CC
8
Cov
42%
_test__init
10.1
broadcast_url
6.0
replay_url
6.0
CRAP 4.3
« lib/Finance/Robinhood/User/Profile.pm ↑ Summary lib/Finance/Robinhood/Equity/Earnings.pm »
1 package Finance::Robinhood::Equity::Earnings::Call;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Equity::Earnings::Call - Earnings Call Data
10  
11 =head1 SYNOPSIS
12  
13 use Finance::Robinhood;
14 my $rh = Finance::Robinhood->new;
15
16 my $earnings = $rh->equity_earnings;
17  
18 for my $earnings ( $rh->equity_earnings('7d')->all ) {
19 CORE::say 'Earnings for ' . $earnings->symbol . ' expected ' . $earnings->report->date;
20 }
21  
22 =cut
23  
24 1 our $VERSION = '0.92_003';
25  
26 1 ▶sub _test__init {
Subroutine _test__init: called CC=3 SCAR=23.1
27 1 my $rh = t::Utility::rh_instance(1);
28 0 my $earnings = $rh->equity_earnings(range => -7);
29 0 my $call;
30 0 ▶ while ($earnings->next) {
Branch: 1 branch
BranchTrueFalseTotal
if ($earnings->next) 0 0 0
31 0 ▶ next if !$earnings->current->call;
Branch: 1 branch
BranchTrueFalseTotal
unless $earnings->current->call 0 0 0
32 0 $call = $earnings->current->call;
33 0 last;
34 }
35 0 isa_ok($call, __PACKAGE__);
36 0 t::Utility::stash('CALL', $call);
37 }
38 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 #
41 1 ▶use Time::Moment;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 #
43 1 has _rh => undef => weak => 1;
44  
45 =head1 METHODS
46  
47 =head2 C<broadcast_url( )>
48  
49 When available, this returns a Mojo::URL object. This URL will allow you to
50 join a call in progress.
51  
52 =cut
53  
54 0 ▶sub broadcast_url ($s) {
Subroutine broadcast_url: not called CC=2 SCAR=17.9
Pod documented
55 0 ▶ $s->{broadcast_url} ? Mojo::URL->new($s->{broadcast_url}) : ();
Branch: 1 branch
BranchTrueFalseTotal
$s->{'broadcast_url'} ? : 0 0 0
56 }
57  
58 1 ▶sub _test_broadcast_url {
Subroutine _test_broadcast_url: called CC=2 SCAR=10.5
59 1 ▶ t::Utility::stash('CALL') // skip_all();
Condition50%1/2
t::Utility::stash("CALL") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("CALL") // skip_all()
t::Utility::stash("CALL") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("CALL")B= skip_all()
ABresult
1X1
011
000
60 todo(
61 'Nearly impossible to catch a call in progress in a unscheduled test'
62 0 ▶ => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 0 isa_ok(t::Utility::stash('CALL')->broadcast_url(), 'Mojo::URL');
64 }
65 0 );
66 }
67  
68 =head2 C<datetime( )>
69  
70 Returns a Time::Moment object.
71  
72 =cut
73  
74 0 ▶sub datetime ($s) {
Subroutine datetime: not called CC=1 SCAR=6.9
Pod documented
75 0 Time::Moment->from_string($s->{datetime});
76 }
77  
78 1 ▶sub _test_datetime {
Subroutine _test_datetime: called CC=2 SCAR=9.2
79 1 ▶ t::Utility::stash('CALL') // skip_all();
Condition50%1/2
t::Utility::stash("CALL") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("CALL") // skip_all()
t::Utility::stash("CALL") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("CALL")B= skip_all()
ABresult
1X1
011
000
80 0 isa_ok(t::Utility::stash('CALL')->datetime(), 'Time::Moment');
81 }
82  
83 =head2 C<replay_url( )>
84  
85 When available, this returns a Mojo::URL object. This URL will allow you to
86 replay an archived call.
87  
88 =cut
89  
90 0 ▶sub replay_url ($s) {
Subroutine replay_url: not called CC=2 SCAR=17.9
Pod documented
91 0 ▶ $s->{replay_url} ? Mojo::URL->new($s->{replay_url}) : ();
Branch: 1 branch
BranchTrueFalseTotal
$s->{'replay_url'} ? : 0 0 0
92 }
93  
94 1 ▶sub _test_replay_url {
Subroutine _test_replay_url: called CC=2 SCAR=9.2
95 1 ▶ t::Utility::stash('CALL') // skip_all();
Condition50%1/2
t::Utility::stash("CALL") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("CALL") // skip_all()
t::Utility::stash("CALL") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("CALL")B= skip_all()
ABresult
1X1
011
000
96 0 isa_ok(t::Utility::stash('CALL')->replay_url(), 'Mojo::URL');
97 }
98  
99 =head1 LEGAL
100  
101 This is a simple wrapper around the API used in the official apps. The author
102 provides no investment, legal, or tax advice and is not responsible for any
103 damages incurred while using this software. This software is not affiliated
104 with Robinhood Financial LLC in any way.
105  
106 For Robinhood's terms and disclosures, please see their website at
107 https://robinhood.com/legal/
108  
109 =head1 LICENSE
110  
111 Copyright (C) Sanko Robinson.
112  
113 This library is free software; you can redistribute it and/or modify it under
114 the terms found in the Artistic License 2. Other copyrights, terms, and
115 conditions may apply to data transmitted through this module. Please refer to
116 the L<LEGAL> section.
117  
118 =head1 AUTHOR
119  
120 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
121  
122 =cut
123  
124 1 1;
« lib/Finance/Robinhood/User/Profile.pm ↑ Summary lib/Finance/Robinhood/Equity/Earnings.pm »