File Coverage

blib/lib/WebService/Coincheck/Withdraw.pm
Criterion Covered Total %
statement 12 24 50.0
branch n/a
condition 0 2 0.0
subroutine 4 7 57.1
pod 0 4 0.0
total 16 37 43.2


line stmt bran cond sub pod time code
1             package WebService::Coincheck::Withdraw;
2 2     2   374704 use strict;
  2         13  
  2         85  
3 2     2   32 use warnings;
  2         5  
  2         134  
4             use Class::Accessor::Lite (
5 2         13 ro => [qw/
6             client
7             /],
8 2     2   589 );
  2         1071  
9              
10             sub new {
11 1     1 0 33 my $class = shift;
12 1         3 my $client = shift;
13              
14 1         6 bless {
15             client => $client,
16             }, $class;
17             }
18              
19             sub create {
20 0     0 0   my ($self, %params) = @_;
21              
22             my $req_params = {
23             bank_account_id => $params{bank_account_id},
24             amount => $params{amount},
25 0   0       currency => $params{currency} || 'JPY',
26             };
27              
28 0           my $res = $self->client->request(
29             'POST' => 'api/withdraws',
30             $req_params,
31             );
32              
33 0           return $res;
34             }
35              
36             sub all {
37 0     0 0   my ($self, %params) = @_;
38              
39 0           my $req_params;
40              
41 0           my $res = $self->client->request(
42             'GET' => 'api/withdraws',
43             $req_params,
44             );
45              
46 0           return $res;
47             }
48              
49             sub cancel {
50 0     0 0   my ($self, %params) = @_;
51              
52             my $req_params = {
53             id => $params{id},
54 0           };
55              
56 0           my $res = $self->client->request(
57             'DELETE' => "api/withdraws/$req_params->{id}",
58             $req_params,
59             );
60              
61 0           return $res;
62             }
63              
64             1;