',
};
};
has auth_class => sub {
my $self = shift;
Google::Cloud::Speech::Auth->new(from_json => $self->secret_file);
};
sub token {
my $self = shift;
my $auth_obj = $self->auth_class;
u
=> encode_base64( $audio_raw, "" ) };
my $header = {
'Content-Type' => "application/json",
'Authorization' => $self->token,
};
my $hash_ref = {
config => $self->
ch:recognize";
my $tx = $self->ua->post( $url => $header => json => $hash_ref );
my $response = $self->handle_errors($tx)->json;
if ( my $results = $response->{'results'} ) {
retu
oogle::Cloud::Speech::Auth;
use Mojo::Base '-base';
use Mojo::Collection;
use Mojo::JSON qw(encode_json decode_json);
use Mojo::JWT::Google;
use Mojo::UserAgent;
has scopes => sub { ['https://www.go
as from_json => sub { };
has jwt_token_enc => undef;
has jwt_token => undef;
sub jwt {
my $self = shift;
return Mojo::JWT::Google->new(
from_json => $self->from_json,
,
);
my $res = $tx->res;
if ( $res->is_success and $res->json('/access_token') ) {
my $token_obj = $res->json;
my $token = $token_obj->{'token_type'} . ' ' . $token_obj->{