Finance-Bitcoin-Yacuna
view release on metacpan or search on metacpan
lib/Finance/Bitcoin/Yacuna.pm view on Meta::CPAN
125126127128129130131132133134135136137138139140141142143144145146147148149
}
if
(
'GET'
eq
$httpMethod
){
$self
->{
'httpClient'
}->get(
$self
->{
'uri'
} .
$self
->{
'basePath'
} .
$self
->{
'apiVersion'
}.
'/'
.
$restPath
);
}
elsif
(
'POST'
eq
$httpMethod
){
my
$req
= new HTTP::Request(
'POST'
,
$self
->{
'uri'
} .
$self
->{
'basePath'
} .
$self
->{
'apiVersion'
}.
'/'
.
$restPath
);
$req
->content_type(
'application/x-www-form-urlencoded'
);
$req
->content(
$body
);
my
$res
=
$self
->{
'httpClient'
}->request(
$req
);
return
$res
->decoded_content;
}
};
return
$self
->{
'httpClient'
}->response->decoded_content
if
$self
->{
'httpClient'
}->response;
}
sub
prepareAuth(){
my
(
$path
,
$body
,
$httpMethod
,
$apiSecret
,
$debug
) =
@_
;
my
$tokenSalt
=
''
.
time
*1000;
my
$hashInput
=
$tokenSalt
.
'@'
.
$apiSecret
.
'@'
.
$httpMethod
.
'@'
.
$path
;
$hashInput
.=
'@'
.
$body
if
''
ne
$body
;
my
$apiToken
=
$tokenSalt
.
'T'
.(sha512_hex(
$hashInput
));
if
(
defined
$debug
&&
$debug
> 0){
( run in 0.226 second using v1.01-cache-2.11-cpan-05444aca049 )