API-CLI

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

    version: '0.001'
  API::CLI::Request:
    file: lib/API/CLI/Request.pm
    version: '0.001'
requires:
  App::AppSpec: '0'
  App::Spec: '0'
  App::Spec::Run::Cmd: '0'
  File::Share: '0'
  HTTP::Request: '0'
  JSON::XS: '0'
  LWP::UserAgent: '0'
  Moo: '0'
  URI: '0'
  YAML::XS: '0'
  base: '0'
  feature: '0'
  perl: '5.010'
  strict: '0'
  warnings: '0'
resources:

Makefile.PL  view on Meta::CPAN

  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010",
  "NAME" => "API::CLI",
  "PREREQ_PM" => {
    "App::AppSpec" => 0,
    "App::Spec" => 0,
    "App::Spec::Run::Cmd" => 0,
    "File::Share" => 0,
    "HTTP::Request" => 0,
    "JSON::XS" => 0,
    "LWP::UserAgent" => 0,
    "Moo" => 0,
    "URI" => 0,
    "YAML::XS" => 0,
    "base" => 0,
    "feature" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {

Makefile.PL  view on Meta::CPAN


my %FallbackPrereqs = (
  "App::AppSpec" => 0,
  "App::Spec" => 0,
  "App::Spec::Run::Cmd" => 0,
  "File::Share" => 0,
  "File::Spec" => 0,
  "HTTP::Request" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "JSON::XS" => 0,
  "LWP::UserAgent" => 0,
  "Moo" => 0,
  "Test::More" => 0,
  "URI" => 0,
  "YAML::XS" => 0,
  "base" => 0,
  "blib" => "1.01",
  "feature" => 0,
  "strict" => 0,
  "warnings" => 0

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


our $VERSION = '0.001'; # VERSION

use base 'App::Spec::Run::Cmd';

use URI;
use YAML::XS ();
use LWP::UserAgent;
use HTTP::Request;
use App::Spec;
use JSON::XS;
use API::CLI::Request;

use Moo;

has dir => ( is => 'ro' );
has openapi => ( is => 'ro' );

sub add_auth {
    my ($self, $req) = @_;
    my $appconfig = $self->read_appconfig;

lib/API/CLI/Request.pm  view on Meta::CPAN

    my $content = $res->decoded_content;
    my $status = $res->status_line;

    my $ct = $res->content_type;
    my $out = $self->verbose ? "Response: $status ($ct)\n" : undef;
    my $data;
    my $ok = 0;
    if ($res->is_success) {
        $ok = 1;
        if ($ct eq 'application/json') {
            my $coder = JSON::XS->new->ascii->pretty->allow_nonref;
            $data = $coder->decode($content);
            $content = $coder->encode($data);
        }
    }

    return ($ok, $out, $content);
}

sub content {
    shift->req->content(@_);



( run in 0.502 second using v1.01-cache-2.11-cpan-4d50c553e7e )