File Coverage

lib/Finance/Robinhood/Forex/Portfolio.pm
Criterion Covered Total %
statement 12 25 48.0
branch n/a
condition 2 4 50.0
subroutine 6 8 75.0
pod 1 1 100.0
total 21 38 55.2


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Forex::Portfolio;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Forex::Portfolio - Represents a Single Forex Portfolio
10              
11             =head1 SYNOPSIS
12              
13             use Finance::Robinhood;
14             my $rh = Finance::Robinhood->new;
15              
16             # TODO
17              
18             =cut
19              
20             our $VERSION = '0.92_003';
21 1     1   4944 use Mojo::Base-base, -signatures;
  1         3  
  1         10  
22 1     1   300 use Mojo::URL;
  1         2  
  1         8  
23              
24             sub _test__init {
25 1     1   8287 my $rh = t::Utility::rh_instance(1);
26 0         0 my $act = $rh->forex_portfolios->current;
27 0         0 isa_ok($act, __PACKAGE__);
28 0         0 t::Utility::stash('PORTFOLIO', $act); # Store it for later
29             }
30 1     1   149 use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1;
  1     0   3  
  1         12  
  0         0  
  0         0  
  0         0  
  0         0  
31              
32             sub _test_stringify {
33 1   50 1   2060 t::Utility::stash('PORTFOLIO') // skip_all();
34 0         0 like(+t::Utility::stash('PORTFOLIO'),
35             qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i
36             );
37             }
38             #
39             has _rh => undef => weak => 1;
40              
41             =head1 METHODS
42            
43             =head2 C
44              
45             Returns a UUID.
46              
47             =head2 C
48              
49             Returs a dollar amount.
50              
51             =head2 C
52              
53             Returns a dollar amount if applicable.
54              
55             =head2 C
56              
57             Returns a dollar amount if applicable.
58              
59             =head2 C
60              
61             Returns a UUID.
62              
63             =head2 C
64              
65             Returns a dollar amount.
66              
67             =head2 C
68              
69             Returns a dollar amount.
70              
71             =cut
72              
73             has ['account_id', 'equity',
74             'extended_hours_equity', 'extended_hours_market_value',
75             'id', 'market_value',
76             'previous_close'
77             ];
78              
79             =head2 C
80              
81             Returns a Time::Moment object.
82              
83             =cut
84              
85 0     0 1 0 sub updated_at ($s) {
  0         0  
  0         0  
86 0         0 Time::Moment->from_string($s->{updated_at});
87             }
88              
89             sub _test_updated_at {
90 1   50 1   1842 t::Utility::stash('PORTFOLIO') // skip_all();
91 0           isa_ok(t::Utility::stash('PORTFOLIO')->updated_at, 'Time::Moment');
92             }
93              
94             =head1 LEGAL
95              
96             This is a simple wrapper around the API used in the official apps. The author
97             provides no investment, legal, or tax advice and is not responsible for any
98             damages incurred while using this software. This software is not affiliated
99             with Robinhood Financial LLC in any way.
100              
101             For Robinhood's terms and disclosures, please see their website at
102             https://robinhood.com/legal/
103              
104             =head1 LICENSE
105              
106             Copyright (C) Sanko Robinson.
107              
108             This library is free software; you can redistribute it and/or modify it under
109             the terms found in the Artistic License 2. Other copyrights, terms, and
110             conditions may apply to data transmitted through this module. Please refer to
111             the L section.
112              
113             =head1 AUTHOR
114              
115             Sanko Robinson Esanko@cpan.orgE
116              
117             =cut
118              
119             1;