Finance-Bitcoin-Yacuna

 view release on metacpan or  search on metacpan

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

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
                }
 
                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 )