Business-Stripe

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "HTTP::Request::Common" : "0",
            "JSON" : "0",
            "LWP::UserAgent" : "0",
            "MIME::Base64" : "0",
            "Test::More" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Business-Stripe
no_index:
  directory:
    - t
    - inc
requires:
  HTTP::Request::Common: '0'
  JSON: '0'
  LWP::UserAgent: '0'
  MIME::Base64: '0'
  Test::More: '0'
resources:
  bugtracker: https://github.com/aquaron/Business-Stripe/issues/
  license: http://dev.perl.org/licenses/
  repository: https://github.com/aquaron/Business-Stripe
version: '0.07'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

    AUTHOR              => q{Paul Pham <pham@cpan.org>},
    VERSION_FROM        => 'Stripe.pm',
    ($ExtUtils::MakeMaker::VERSION >= 6.3002
      ? ('LICENSE'=> 'perl')
      : ()),
    PL_FILES            => {},
    PREREQ_PM => {
        'Test::More'            => 0,
        'JSON'                  => 0,
        'LWP::UserAgent'        => 0,
        'HTTP::Request::Common' => 0,
        'MIME::Base64'          => 0
    },
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
    clean               => { FILES => 'Business-Stripe-*' },
    META_MERGE          => {
        resources       => {
            repository  => 'https://github.com/aquaron/Business-Stripe',
            license     => 'http://dev.perl.org/licenses/',
            bugtracker  => 'https://github.com/aquaron/Business-Stripe/issues/',
        }

Stripe.pm  view on Meta::CPAN

package Business::Stripe;

use strict;
use warnings;

use JSON;
use LWP::UserAgent;
use HTTP::Request::Common qw/DELETE GET POST/;
use MIME::Base64 qw(encode_base64);

our $VERSION         = '0.07';

use constant URL     => 'https://api.stripe.com/v1/';

=encoding utf8

=head1 NAME

Stripe.pm  view on Meta::CPAN

        -ua_args => {
            timeout   => 10,
            env_proxy => 1,
            agent     => 'myApp',
            ssl_opts  => { verify_hostname => 0 },
        },
    );

=item C<-ua> Completely overrides the default user agent object (L<LWP::UserAgent>).
Note that your object I<must> accept HTTPS, and provide a C<request()> method
accepting L<HTTP::Request> objects and returning L<HTTP::Response>-compatible
objects. You can use this to have a common user agent make all requests in
your code. The example above works exactly like:

    my $ua = LWP::UserAgent->new(
        timeout   => 10,
        env_proxy => 1,
        agent     => 'myApp',
        ssl_opts  => { verify_hostname => 0 },
    );

t/10-api.t  view on Meta::CPAN

    }

    sub request {
        my ($self, $req) = @_;
        die 'no tests available' unless exists $self->{tests}[$self->{current_test}];

        my $current_test = $self->{tests}[$self->{current_test}];
        Test::More::is(
            $req->method,
            $current_test->{http_method},
            "HTTP::Request method #" . $self->{current_test}
        );
        Test::More::is(
            $req->uri,
            $current_test->{http_uri},
            "HTTP::Request uri #" . $self->{current_test}
        );
        foreach my $header_key (sort keys %{$current_test->{http_headers}}) {
            Test::More::is(
                $req->header($header_key),
                $current_test->{http_headers}{$header_key},
                "HTTP::Request has proper header value for '$header_key'",
            );
        }
        Test::More::is(
            $req->content,
            $current_test->{http_content},
            "HTTP::Request has proper content set for test $self->{current_test}"
        );

        $self->{current_test}++;
        return $self;
    }

    sub is_success { 1 }
    sub content { '{}' }

package main;



( run in 0.443 second using v1.01-cache-2.11-cpan-de7293f3b23 )