API-Stripe
view release on metacpan or search on metacpan
lib/API/Stripe.pm view on Meta::CPAN
$agent->transactor->name($identifier);
$url->path("/v$version");
$url->userinfo($username);
return $self;
}
method PREPARE ($ua, $tx, %args) {
my $headers = $tx->req->headers;
my $url = $tx->req->url;
my $method = $tx->req->method;
my $content = 'application/json';
if (grep lc $method eq $_, qw(delete patch post put)) {
$content = 'application/x-www-form-urlencoded';
}
# default headers
$headers->header('Content-Type' => $content);
return $self;
}
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
timeout => $self->timeout,
user_agent => $self->user_agent,
identifier => $self->identifier,
username => $self->username,
version => $self->version,
);
# resource locator
my $url = $instance->url;
# modify resource locator if possible
$url->path(join '/', $self->url->path, @segments);
# return resource instance
return $instance;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
API::Stripe - Stripe.com API Client
=head1 VERSION
version 0.07
=head1 SYNOPSIS
use API::Stripe;
my $stripe = API::Stripe->new(
username => 'USERNAME',
identifier => 'APPLICATION NAME',
);
$stripe->debug(1);
$stripe->fatal(1);
my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
my $results = $charge->fetch;
# after some introspection
$charge->update( ... );
=head1 DESCRIPTION
This distribution provides an object-oriented thin-client library for
interacting with the Stripe (L<https://stripe.com>) API. For usage and
documentation information visit L<https://stripe.com/docs/api>. API::Stripe is
derived from L<API::Client> and inherits all of it's functionality. Please read
the documentation for API::Client for more usage information.
=head1 ATTRIBUTES
=head2 identifier
$stripe->identifier;
$stripe->identifier('IDENTIFIER');
The identifier attribute should be set to a string that identifies your app.
=head2 username
$stripe->username;
$stripe->username('USERNAME');
The username attribute should be set to an API key associated with your account.
=head2 debug
$stripe->debug;
$stripe->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
( run in 0.394 second using v1.01-cache-2.11-cpan-df04353d9ac )