ebService::Spotify;
use Moo;
use Method::Signatures;
use LWP::UserAgent;
use URI::QueryParam;
use JSON;
use Data::Dumper;
our $VERSION = '1.003';
has 'prefix' => ( is => 'rw', default => 'https://ap
$uri->as_string);
$self->_log("RESP", $response->content);
return $response->content ? from_json($response->content) : undef;
}
method post ($method, $payload, %args) {
my $uri = $self->
headers;
$headers->{'Content-Type'} = 'application/json';
my $response = $self->user_agent->post( $uri->as_string, %$headers, Content => to_json($payload) );
$self->_log("POST", $uri->as_stri
uth2;
use Moo;
use Method::Signatures;
use IO::File;
use LWP::UserAgent;
use URI::QueryParam;
use JSON;
use MIME::Base64;
use Data::Dumper;
our $VERSION = '1.002';
has 'client_id' => ( is => 'rw
if (my $fh = IO::File->new('< ' . $self->cache_path)) {
local $/;
$token_info = from_json( <$fh> );
$fh->close;
}
$token_info = $self->refresh_access_token($token_info->{re
IO::File->new('> ' . $self->cache_path) || die "Could not create cache file $@";
print $fh to_json($token_info);
$fh->close;
}
}
method is_token_expired ($token_info) {
return ($token_inf