File Coverage

lib/Finance/Robinhood/Search.pm
Criterion Covered Total %
statement 25 52 48.0
branch n/a
condition 3 6 50.0
subroutine 10 12 83.3
pod 3 3 100.0
total 41 73 56.1


line stmt bran cond sub pod time code
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             our $VERSION = '0.92_003';
24              
25             sub _test__init {
26 1     1   12121 my $rh = t::Utility::rh_instance(1);
27 0         0 my $msft = $rh->search('microsoft');
28 0         0 my $btc = $rh->search('bitcoin');
29 0         0 my $tag = $rh->search('New on Robinhood');
30 0         0 isa_ok($msft, __PACKAGE__);
31 0         0 t::Utility::stash('MSFT', $msft); # Store it for later
32 0         0 isa_ok($btc, __PACKAGE__);
33 0         0 t::Utility::stash('BTC', $btc); # Store it for later
34 0         0 isa_ok($tag, __PACKAGE__);
35 0         0 t::Utility::stash('TAG', $tag); # Store it for later
36             }
37 1     1   9 use Mojo::Base-base, -signatures;
  1         4  
  1         11  
38 1     1   324 use Mojo::URL;
  1         4  
  1         8  
39 1     1   31 use Finance::Robinhood::Equity::Tag;
  1         5  
  1         10  
40 1     1   487 use Finance::Robinhood::Forex::Pair;
  1         3  
  1         6  
41 1     1   69 use Finance::Robinhood::Equity::Instrument;
  1         2  
  1         18  
42             #
43             has _rh => undef => weak => 1;
44              
45             =head2 C
46              
47             If available, this will return a list of Finance::Robinhood::Forex::Pair
48             objects.
49              
50             =cut
51              
52 0     0 1 0 sub forex_pairs ( $s ) {
  0         0  
  0         0  
53 0         0 map { Finance::Robinhood::Forex::Pair->new(_rh => $s->_rh, %$_) }
54 0         0 @{$s->{currency_pairs}};
  0         0  
55             }
56              
57             sub _test_forex_pairs {
58 1   50 1   1888 t::Utility::stash('BTC') // skip_all();
59 0         0 my ($btc_usd) = t::Utility::stash('BTC')->forex_pairs;
60 0         0 isa_ok($btc_usd, 'Finance::Robinhood::Forex::Pair');
61             }
62              
63             =head2 C
64              
65             If available, this will return a list of Finance::Robinhood::Equity::Instrument
66             objects.
67              
68             =cut
69              
70 2     2 1 2506 sub equity_instruments ( $s ) {
  2         5  
  2         3  
71 2         9 map { Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh, %$_) }
72 2         5 @{$s->{instruments}};
  2         6  
73             }
74              
75             sub _test_equity_instruments {
76 1   50 1   2486 t::Utility::stash('MSFT') // skip_all();
77 0         0 my ($instrument) = t::Utility::stash('MSFT')->equity_instruments;
78 0         0 isa_ok($instrument, 'Finance::Robinhood::Equity::Instrument');
79             }
80              
81             =head2 C
82              
83             If available, this will return a list of Finance::Robinhood::Equity::Tag
84             objects.
85              
86              
87             =cut
88              
89 0     0 1 0 sub tags ( $s ) {
  0         0  
  0         0  
90 0         0 map { Finance::Robinhood::Equity::Tag->new(_rh => $s->_rh, %$_) }
91 0         0 @{$s->{tags}};
  0         0  
92             }
93              
94             sub _test_tags {
95 1   50 1   1963 t::Utility::stash('TAG') // skip_all();
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 section.
118              
119             =head1 AUTHOR
120              
121             Sanko Robinson Esanko@cpan.orgE
122              
123             =cut
124              
125             1;