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_002';
22 1     1   7 use Mojo::Base-base, -signatures;
  1         4  
  1         8  
23 1     1   210 use Mojo::URL;
  1         3  
  1         7  
24 1     1   25 use Time::Moment;
  1         2  
  1         141  
25              
26             sub _test__init {
27 1     1   12151 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   9 use overload '""' => sub ( $s, @ ) { $s->{id} }, fallback => 1;
  1     0   2  
  1         7  
  0         0  
  0         0  
  0         0  
  0         0  
33              
34             sub _test_stringify {
35 1   50 1   1929 t::Utility::stash('ACCOUNT') // skip_all();
36 0         0 like(
37             +t::Utility::stash('ACCOUNT'),
38             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
39             );
40             }
41             #
42             has _rh => undef => weak => 1;
43              
44             =head1 METHODS
45              
46             =head2 C
47              
48             Returns a Time::Moment object.
49              
50             =head2 C
51              
52             Returns a UUID.
53              
54             =head2 C
55              
56              
57              
58             =head2 C
59              
60             One of the following: C, C, or C.
61              
62             =head2 C
63              
64             Returns a Time::Moment object.
65              
66             =head2 C
67              
68             Returns a UUID.
69              
70             =cut
71              
72             has [ 'id', 'status', 'status_reason_code', 'user_id' ];
73              
74 0     0 1 0 sub created_at ($s) {
  0         0  
  0         0  
75 0         0 Time::Moment->from_string( $s->{created_at} );
76             }
77              
78             sub _test_created_at {
79 1   50 1   2039 t::Utility::stash('ACCOUNT') // skip_all();
80 0         0 isa_ok( t::Utility::stash('ACCOUNT')->created_at, 'Time::Moment' );
81             }
82              
83 0     0 1 0 sub updated_at ($s) {
  0         0  
  0         0  
84 0         0 Time::Moment->from_string( $s->{updated_at} );
85             }
86              
87             sub _test_updated_at {
88 1   50 1   1863 t::Utility::stash('ACCOUNT') // skip_all();
89 0           isa_ok( t::Utility::stash('ACCOUNT')->updated_at, 'Time::Moment' );
90             }
91              
92             =head1 LEGAL
93              
94             This is a simple wrapper around the API used in the official apps. The author
95             provides no investment, legal, or tax advice and is not responsible for any
96             damages incurred while using this software. This software is not affiliated
97             with Robinhood Financial LLC in any way.
98              
99             For Robinhood's terms and disclosures, please see their website at
100             https://robinhood.com/legal/
101              
102             =head1 LICENSE
103              
104             Copyright (C) Sanko Robinson.
105              
106             This library is free software; you can redistribute it and/or modify it under
107             the terms found in the Artistic License 2. Other copyrights, terms, and
108             conditions may apply to data transmitted through this module. Please refer to
109             the L section.
110              
111             =head1 AUTHOR
112              
113             Sanko Robinson Esanko@cpan.orgE
114              
115             =cut
116              
117             1;