Finance-Bitcoin-Yacuna

 view release on metacpan or  search on metacpan

lib/Finance/Bitcoin/Yacuna.pm  view on Meta::CPAN

		}

		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.454 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )