File Coverage

lib/Finance/Robinhood/Options/Chain/Underlying.pm
Criterion Covered Total %
statement 11 23 47.8
branch n/a
condition 1 2 50.0
subroutine 5 8 62.5
pod 0 1 0.0
total 17 34 50.0


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Options::Chain::Underlying;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Options::Chain::Underlying - Represents a Single Options
10             Chain's Underlying Equity Instrument
11              
12             =head1 SYNOPSIS
13              
14             use Finance::Robinhood;
15             my $rh = Finance::Robinhood->new->login('user', 'pass');
16             my $account = $rh->accounts->current();
17              
18             # TODO
19              
20             =cut
21              
22             our $VERSION = '0.92_002';
23 1     1   8 use Mojo::Base-base, -signatures;
  1         3  
  1         6  
24 1     1   179 use Mojo::URL;
  1         2  
  1         7  
25              
26             sub _test__init {
27 1     1   12138 my $rh = t::Utility::rh_instance(1);
28              
29             #my $instrument = $rh->options_instruments(
30             # chain_id => $rh->search('MSFT')->equity_instruments->[0]->tradable_chain_id,
31             # tradability => 'tradable'
32             #)->current;
33             #isa_ok( $instrument, __PACKAGE__ );
34             #t::Utility::stash( 'INSTRUMENT', $instrument ); # Store it for later
35 0     0   0 todo( "Write actual tests!" => sub { pass('ugh') } );
  0         0  
36             }
37 1     1   183 use overload '""' => sub ( $s, @ ) { $s->{instrument} }, fallback => 1;
  1     0   2  
  1         7  
  0         0  
  0         0  
  0         0  
  0         0  
38              
39             sub _test_stringify {
40 1   50 1   2058 t::Utility::stash('UNDERLYING') // skip_all();
41 0           like(
42             +t::Utility::stash('UNDERLYING'),
43             qr'^https://api.robinhood.com/instruments/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/$'i
44             );
45             }
46             #
47             has _rh => undef => weak => 1;
48             has [ 'id', 'quantity' ];
49              
50 0     0 0   sub instrument($s) {
  0            
  0            
51             Finance::Robinhood::Equity::Instrument->new(
52             _rh => $s->_rh,
53 0           %{ $s->_rh->_get( $s->{instrument} )->json }
  0            
54             );
55             }
56              
57             =head1 LEGAL
58              
59             This is a simple wrapper around the API used in the official apps. The author
60             provides no investment, legal, or tax advice and is not responsible for any
61             damages incurred while using this software. This software is not affiliated
62             with Robinhood Financial LLC in any way.
63              
64             For Robinhood's terms and disclosures, please see their website at
65             https://robinhood.com/legal/
66              
67             =head1 LICENSE
68              
69             Copyright (C) Sanko Robinson.
70              
71             This library is free software; you can redistribute it and/or modify it under
72             the terms found in the Artistic License 2. Other copyrights, terms, and
73             conditions may apply to data transmitted through this module. Please refer to
74             the L section.
75              
76             =head1 AUTHOR
77              
78             Sanko Robinson Esanko@cpan.orgE
79              
80             =cut
81              
82             1;