File Coverage

lib/Finance/Robinhood/Equity/Earnings/Call.pm
Criterion Covered Total %
statement 13 37 35.1
branch 0 6 0.0
condition 3 6 50.0
subroutine 7 11 63.6
pod 3 3 100.0
total 26 63 41.2


line stmt bran cond sub pod time code
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             our $VERSION = '0.92_001';
25              
26             sub _test__init {
27 1     1   11686 my $rh = t::Utility::rh_instance(1);
28 0         0 my $earnings = $rh->equity_earnings( range => -7 );
29 0         0 my $call;
30 0         0 while ( $earnings->next ) {
31 0 0       0 next if !$earnings->current->call;
32 0         0 $call = $earnings->current->call;
33 0         0 last;
34             }
35 0         0 isa_ok( $call, __PACKAGE__ );
36 0         0 t::Utility::stash( 'CALL', $call );
37             }
38 1     1   7 use Mojo::Base-base, -signatures;
  1         14  
  1         10  
39 1     1   191 use Mojo::URL;
  1         2  
  1         6  
40             #
41 1     1   82 use Time::Moment;
  1         4  
  1         372  
42             #
43             has _rh => undef => weak => 1;
44              
45             =head1 METHODS
46              
47             =head2 C
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     0 1 0 sub broadcast_url ($s) {
  0         0  
  0         0  
55 0 0       0 $s->{broadcast_url} ? Mojo::URL->new( $s->{broadcast_url} ) : ();
56             }
57              
58             sub _test_broadcast_url {
59 1   50 1   1991 t::Utility::stash('CALL') // skip_all();
60             todo(
61             'Nearly impossible to catch a call in progress in a unscheduled test' => sub {
62 0     0   0 isa_ok( t::Utility::stash('CALL')->broadcast_url(), 'Mojo::URL' );
63             }
64 0         0 );
65             }
66              
67             =head2 C
68              
69             Returns a Time::Moment object.
70              
71             =cut
72              
73 0     0 1 0 sub datetime ($s) {
  0         0  
  0         0  
74 0         0 Time::Moment->from_string( $s->{datetime} );
75             }
76              
77             sub _test_datetime {
78 1   50 1   1841 t::Utility::stash('CALL') // skip_all();
79 0         0 isa_ok( t::Utility::stash('CALL')->datetime(), 'Time::Moment' );
80             }
81              
82             =head2 C
83              
84             When available, this returns a Mojo::URL object. This URL will allow you to
85             replay an archived call.
86              
87             =cut
88              
89 0     0 1 0 sub replay_url ($s) {
  0         0  
  0         0  
90 0 0       0 $s->{replay_url} ? Mojo::URL->new( $s->{replay_url} ) : ();
91             }
92              
93             sub _test_replay_url {
94 1   50 1   1905 t::Utility::stash('CALL') // skip_all();
95 0           isa_ok( t::Utility::stash('CALL')->replay_url(), 'Mojo::URL' );
96             }
97              
98             =head1 LEGAL
99              
100             This is a simple wrapper around the API used in the official apps. The author
101             provides no investment, legal, or tax advice and is not responsible for any
102             damages incurred while using this software. This software is not affiliated
103             with Robinhood Financial LLC in any way.
104              
105             For Robinhood's terms and disclosures, please see their website at
106             https://robinhood.com/legal/
107              
108             =head1 LICENSE
109              
110             Copyright (C) Sanko Robinson.
111              
112             This library is free software; you can redistribute it and/or modify it under
113             the terms found in the Artistic License 2. Other copyrights, terms, and
114             conditions may apply to data transmitted through this module. Please refer to
115             the L section.
116              
117             =head1 AUTHOR
118              
119             Sanko Robinson Esanko@cpan.orgE
120              
121             =cut
122              
123             1;