API-Handle

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "develop" : {
         "requires" : {
            "Test::Pod" : "1.41"
         }
      },
      "runtime" : {
         "requires" : {
            "Carp" : "0",
            "Data::Dumper" : "0",
            "HTTP::Request" : "0",
            "JSON::XS" : "0",
            "LWP::UserAgent" : "0",
            "Moose" : "0",
            "Moose::Role" : "0",
            "Nour::Config" : "0",
            "Nour::Database" : "0",
            "Nour::Printer" : "0",
            "OX::OAuth" : "0",
            "String::CamelCase" : "0",
            "Tie::Hash::Indexed" : "0",
            "URI" : "0",

META.yml  view on Meta::CPAN

generated_by: 'Dist::Zilla version 4.300028, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: API-Handle
requires:
  Carp: 0
  Data::Dumper: 0
  HTTP::Request: 0
  JSON::XS: 0
  LWP::UserAgent: 0
  Moose: 0
  Moose::Role: 0
  Nour::Config: 0
  Nour::Database: 0
  Nour::Printer: 0
  OX::OAuth: 0
  String::CamelCase: 0
  Tie::Hash::Indexed: 0
  URI: 0

Makefile.PL  view on Meta::CPAN

    "ExtUtils::MakeMaker" => "6.30"
  },
  "DISTNAME" => "API-Handle",
  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "NAME" => "API::Handle",
  "PREREQ_PM" => {
    "Carp" => 0,
    "Data::Dumper" => 0,
    "HTTP::Request" => 0,
    "JSON::XS" => 0,
    "LWP::UserAgent" => 0,
    "Moose" => 0,
    "Moose::Role" => 0,
    "Nour::Config" => 0,
    "Nour::Database" => 0,
    "Nour::Printer" => 0,
    "OX::OAuth" => 0,
    "String::CamelCase" => 0,
    "Tie::Hash::Indexed" => 0,
    "URI" => 0,

dist.ini  view on Meta::CPAN

copyright_holder    = Nour Sharabash
version             = 0.02

[GatherDir]
exclude_filename = README.pod
exclude_match    = ^doc.*
exclude_match    = ^cover.*

[PruneCruft]
[PkgVersion]
[MetaJSON]
[ExtraTests]
[PodSyntaxTests]

[Manifest]
[MakeMaker]

[AutoPrereqs]
[Prereqs / BuildRequires]
[Prereqs]
[Prereqs / Recommends]

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

		%conf = ();
		require Nour::Database;
		 return new Nour::Database ( %conf );
	}
);

#has _util     # TODO factor all the _methods to $self->util->methods... or not

has _json => (
	is => 'rw'
	, isa => 'JSON::XS'
	, lazy => 1
	, required => 1
	, default => sub {
		require JSON::XS;
		 return JSON::XS->new->utf8->ascii->relaxed;
	}
);

has _xml => (
	is => 'rw'
	, isa => 'XML::TreePP'
	, lazy => 1
	, required => 1
	, default => sub {
		require XML::TreePP;

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


	# Preserve hash order. Maybe needed for SOAP.
	if ( defined $args{content} and (
			( ref $args{content} eq 'ARRAY' ) or # Deprecated - backwards compatibility
			( ref $args{content} eq 'REF' and ref ${ $args{content} } eq 'ARRAY' ) # New style ? => \[]
		)
	) {
		$self->_tied( ref => \%args, key => 'content', tied => 1 );
	}

	# Leave it up to the API implementation to encode the hash/array ref into JSON / Form data / XML / etc.
	$req->content( $args{content} ) if defined $args{content};
	$req->method(   $args{method} ) if defined $args{method};
	$req->uri(         $args{uri} );

	my $res = $self->ua->request( $req );

	return wantarray ? ( $res, $req ) : $res;
}

sub db {

lib/API/Handle/OpenX.pm  view on Meta::CPAN

	$self->ua->add_handler(
		request_prepare => sub {
			my ( $req, $ua, $h ) = @_;

			# Create SOAP envelope.
			if ( my $data = $req->content ) {
				my $json = $self->_encode( type => 'json', data => $data );
				$req->content( $json );
				$req->headers->header( 'Content-Type' => 'application/json; charset=utf-8' );

				# Uncomment this to view generated JSON content.
				# $self->debug( $json );
			}
		}
		, m_scheme => $scheme
		, m_host => $host
		, m_path_match => qr/^\Q$path\E/
	);

	# Add response wrapper.
	$self->ua->add_handler(



( run in 1.881 second using v1.01-cache-2.11-cpan-140bd7fdf52 )