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_003';
25              
26             sub _test__init {
27 1     1   12034 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   9 use Mojo::Base-base, -signatures;
  1         3  
  1         8  
39 1     1   192 use Mojo::URL;
  1         2  
  1         8  
40             #
41 1     1   30 use Time::Moment;
  1         3  
  1         346  
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   2374 t::Utility::stash('CALL') // skip_all();
60             todo(
61             'Nearly impossible to catch a call in progress in a unscheduled test'
62             => sub {
63 0     0   0 isa_ok(t::Utility::stash('CALL')->broadcast_url(), 'Mojo::URL');
64             }
65 0         0 );
66             }
67              
68             =head2 C
69              
70             Returns a Time::Moment object.
71              
72             =cut
73              
74 0     0 1 0 sub datetime ($s) {
  0         0  
  0         0  
75 0         0 Time::Moment->from_string($s->{datetime});
76             }
77              
78             sub _test_datetime {
79 1   50 1   1846 t::Utility::stash('CALL') // skip_all();
80 0         0 isa_ok(t::Utility::stash('CALL')->datetime(), 'Time::Moment');
81             }
82              
83             =head2 C
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     0 1 0 sub replay_url ($s) {
  0         0  
  0         0  
91 0 0       0 $s->{replay_url} ? Mojo::URL->new($s->{replay_url}) : ();
92             }
93              
94             sub _test_replay_url {
95 1   50 1   2436 t::Utility::stash('CALL') // skip_all();
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 section.
117              
118             =head1 AUTHOR
119              
120             Sanko Robinson Esanko@cpan.orgE
121              
122             =cut
123              
124             1;