lib/Finance/Robinhood/Search.pm

filter: Statementstmt 47.8% 22 / 46 Branchbran n/a Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 75.0% 9 / 12 Podpod 100% 3 / 3 totaltotal 50.6% 37 / 73 CC 4 SCAR 6.9
CC
4
Cov
48%
_test_forex_pairs
2.9
_test_equity_instruments
2.9
_test_tags
2.9
CRAP 2.0
« lib/Finance/Robinhood/Options/Instrument.pm ↑ Summary lib/Finance/Robinhood/Forex/Currency.pm »
1 package Finance::Robinhood::Search;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Search - Represents Search Results
10  
11 =head1 SYNOPSIS
12  
13 use Text::Wrap qw[wrap];
14 use Finance::Robinhood;
15 my $rh = Finance::Robinhood->new;
16  
17 my $search = $rh->search('shoes');
18  
19 =head1 METHODS
20  
21 =cut
22  
23 1 our $VERSION = '0.92_003';
24  
25 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=5.5
26 1 my $rh = t::Utility::rh_instance(1);
27 0 my $msft = $rh->search('microsoft');
28 0 my $btc = $rh->search('bitcoin');
29 0 my $tag = $rh->search('New on Robinhood');
30 0 isa_ok($msft, __PACKAGE__);
31 0 t::Utility::stash('MSFT', $msft); # Store it for later
32 0 isa_ok($btc, __PACKAGE__);
33 0 t::Utility::stash('BTC', $btc); # Store it for later
34 0 isa_ok($tag, __PACKAGE__);
35 0 t::Utility::stash('TAG', $tag); # Store it for later
36 }
37 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use Finance::Robinhood::Equity::Tag;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use Finance::Robinhood::Forex::Pair;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶use Finance::Robinhood::Equity::Instrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 #
43 1 has _rh => undef => weak => 1;
44  
45 =head2 C<forex_pairs( )>
46  
47 If available, this will return a list of Finance::Robinhood::Forex::Pair
48 objects.
49  
50 =cut
51  
52 0 ▶sub forex_pairs ( $s ) {
Subroutine forex_pairs: not called CC=1 SCAR=6.9
Pod documented
53 0 map { Finance::Robinhood::Forex::Pair->new(_rh => $s->_rh, %$_) }
54 0 @{$s->{currency_pairs}};
55 }
56  
57 1 ▶sub _test_forex_pairs {
Subroutine _test_forex_pairs: called CC=2 SCAR=10.5
58 1 ▶ t::Utility::stash('BTC') // skip_all();
Condition50%1/2
t::Utility::stash("BTC") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("BTC") // skip_all()
t::Utility::stash("BTC") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("BTC")B= skip_all()
ABresult
1X1
011
000
59 0 my ($btc_usd) = t::Utility::stash('BTC')->forex_pairs;
60 0 isa_ok($btc_usd, 'Finance::Robinhood::Forex::Pair');
61 }
62  
63 =head2 C<equity_instruments( )>
64  
65 If available, this will return a list of Finance::Robinhood::Equity::Instrument
66 objects.
67  
68 =cut
69  
70 0 ▶sub equity_instruments ( $s ) {
Subroutine equity_instruments: not called CC=1 SCAR=6.9
Pod documented
71 0 map { Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh, %$_) }
72 0 @{$s->{instruments}};
73 }
74  
75 1 ▶sub _test_equity_instruments {
Subroutine _test_equity_instruments: called CC=2 SCAR=10.5
76 1 ▶ t::Utility::stash('MSFT') // skip_all();
Condition50%1/2
t::Utility::stash("MSFT") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MSFT") // skip_all()
t::Utility::stash("MSFT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MSFT")B= skip_all()
ABresult
1X1
011
000
77 0 my ($instrument) = t::Utility::stash('MSFT')->equity_instruments;
78 0 isa_ok($instrument, 'Finance::Robinhood::Equity::Instrument');
79 }
80  
81 =head2 C<tags( )>
82  
83 If available, this will return a list of Finance::Robinhood::Equity::Tag
84 objects.
85  
86  
87 =cut
88  
89 0 ▶sub tags ( $s ) {
Subroutine tags: not called CC=1 SCAR=6.9
Pod documented
90 0 map { Finance::Robinhood::Equity::Tag->new(_rh => $s->_rh, %$_) }
91 0 @{$s->{tags}};
92 }
93  
94 1 ▶sub _test_tags {
Subroutine _test_tags: called CC=2 SCAR=10.5
95 1 ▶ t::Utility::stash('TAG') // skip_all();
Condition50%1/2
t::Utility::stash("TAG") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("TAG") // skip_all()
t::Utility::stash("TAG") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("TAG")B= skip_all()
ABresult
1X1
011
000
96 0 my ($tag) = t::Utility::stash('TAG')->tags;
97 0 isa_ok($tag, 'Finance::Robinhood::Equity::Tag');
98 }
99  
100 =head1 LEGAL
101  
102 This is a simple wrapper around the API used in the official apps. The author
103 provides no investment, legal, or tax advice and is not responsible for any
104 damages incurred while using this software. This software is not affiliated
105 with Robinhood Financial LLC in any way.
106  
107 For Robinhood's terms and disclosures, please see their website at
108 https://robinhood.com/legal/
109  
110 =head1 LICENSE
111  
112 Copyright (C) Sanko Robinson.
113  
114 This library is free software; you can redistribute it and/or modify it under
115 the terms found in the Artistic License 2. Other copyrights, terms, and
116 conditions may apply to data transmitted through this module. Please refer to
117 the L<LEGAL> section.
118  
119 =head1 AUTHOR
120  
121 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
122  
123 =cut
124  
125 1 1;
« lib/Finance/Robinhood/Options/Instrument.pm ↑ Summary lib/Finance/Robinhood/Forex/Currency.pm »