File Coverage

lib/Finance/Robinhood/Forex/Account.pm
Criterion Covered Total %
statement 16 34 47.0
branch n/a
condition 3 6 50.0
subroutine 8 11 72.7
pod 2 2 100.0
total 29 53 54.7


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