API-Medium

 view release on metacpan or  search on metacpan

lib/API/Medium.pm  view on Meta::CPAN


use Moose;
use HTTP::Tiny;
use Log::Any qw($log);
use JSON::MaybeXS;
use Module::Runtime 'use_module';

has 'server' => (
    isa     => 'Str',
    is      => 'ro',
    default => 'https://api.medium.com/v1',
);

has 'access_token' => (
    isa      => 'Str',
    is       => 'rw',
    required => 1,
);

has 'refresh_token' => (
    isa => 'Str',

lib/API/Medium.pm  view on Meta::CPAN

    isa        => 'HTTP::Tiny',
    is         => 'ro',
    lazy_build => 1,
);

sub _build__client {
    my $self = shift;

    return HTTP::Tiny->new(
        agent           => join( '/', __PACKAGE__, $VERSION ),
        default_headers => {
            'Authorization' => 'Bearer ' . $self->access_token,
            'Accept'        => 'application/json',
            'Content-Type'  => 'application/json',
        }
    );
}

sub get_current_user {
    my $self = shift;



( run in 0.380 second using v1.01-cache-2.11-cpan-0a6323c29d9 )