Business-Monzo
view release on metacpan or search on metacpan
0.08 2017-06-08
- Fix VERSION confusion by moving $Business::Monzo::VERSION
into the main module to avoid parts of the cpan(m|ts) toolchain
getting confused
0.07 2016-09-29
- Rename distribution to Business-Monzo
0.06 2016-08-21
- live API test is absorbed into emulated test so can run the same
test against both live and emulated endpoints
0.05 2016-07-22
- Use Any type for Booleans as some test failures with Bool related
to incorrect coercion (?) of JSON::PP boolean types (GH #4)
0.04 2016-05-28
- Add missing attributes to Transaction and Merchant objects (GH #3)
0.03 2016-05-22
- Kwalitee improvements
say $e->request->{params} if $e->request;
say $e->request->{headers} if $e->request;
say $e->request->{content} if $e->request;
}
catch ( $e ) {
# some other failure?
...
}
You can view some useful debugging information by setting the MONZO\_DEBUG
env varible, this will show the calls to the Monzo endpoints as well as a
stack trace in the event of exceptions:
$ENV{MONZO_DEBUG} = 1;
# ATTRIBUTES
## token
Your Monzo access token, this is required
}
The supported pagination keys are `limit`, `since`, and `before` - where
`since` can be an RFC 3339-encoded timestamp or an object id, and `before`
can be an RFC 3339-encoded timestamp. `limit` should always be an integer.
# EXAMPLES
See the t/002\_end\_to\_end.t test included with this distribution. you can run
this test against the Monzo emulator by running end\_to\_end\_emulated.sh (this
is advised, don't run it against a live endpoint).
You can also see the scripts in the bin/ directory included in this dist for
more examples.
# SEE ALSO
[Business::Monzo::Account](https://metacpan.org/pod/Business%3A%3AMonzo%3A%3AAccount)
[Business::Monzo::Attachment](https://metacpan.org/pod/Business%3A%3AMonzo%3A%3AAttachment)
lib/Business/Monzo.pm view on Meta::CPAN
say $e->request->{params} if $e->request;
say $e->request->{headers} if $e->request;
say $e->request->{content} if $e->request;
}
catch ( $e ) {
# some other failure?
...
}
You can view some useful debugging information by setting the MONZO_DEBUG
env varible, this will show the calls to the Monzo endpoints as well as a
stack trace in the event of exceptions:
$ENV{MONZO_DEBUG} = 1;
=cut
use strict;
use warnings;
use Moo;
lib/Business/Monzo.pm view on Meta::CPAN
}
The supported pagination keys are C<limit>, C<since>, and C<before> - where
C<since> can be an RFC 3339-encoded timestamp or an object id, and C<before>
can be an RFC 3339-encoded timestamp. C<limit> should always be an integer.
=head1 EXAMPLES
See the t/002_end_to_end.t test included with this distribution. you can run
this test against the Monzo emulator by running end_to_end_emulated.sh (this
is advised, don't run it against a live endpoint).
You can also see the scripts in the bin/ directory included in this dist for
more examples.
=head1 SEE ALSO
L<Business::Monzo::Account>
L<Business::Monzo::Attachment>
lib/Business/Monzo/Client.pm view on Meta::CPAN
sub _get_accounts {
return shift->_get_entities( shift,'account' );
}
sub _get_pots {
return shift->_get_entities( shift,'pot','pots/listV1' );
}
sub _get_entities {
my ( $self,$params,$entity,$endpoint ) = @_;
my $plural = $entity . 's';
$endpoint //= $plural;
my $data = $self->_api_request( 'GET', $endpoint, $params );
my $class = "Business::Monzo::" . ucfirst( $entity );
my @objects;
foreach my $e ( @{ $data->{$plural} // [] } ) {
push( @objects,$class->new( client => $self,%{ $e } ) );
}
return @objects;
}
monzo_emulator.pl view on Meta::CPAN
post '/attachment/deregister' => sub {
my ( $c ) = @_;
my $id = $c->param( 'id' )
|| return $c->render( status => 400, text => "id required" );
$c->render( json => {} );
}
};
# convenience methods for file upload emulation, these endpoints
# do not exist in the Monzo API, they are here to fake uploads
get '/file/:entity_id/:file_name' => sub {
my ( $c ) = @_;
$c->render( text => "OK" );
};
post '/upload/:entity_id/:file_name' => sub {
my ( $c ) = @_;
t/business/monzo.t view on Meta::CPAN
client
transactions
transaction
accounts
/,
);
isa_ok( $Monzo->client,'Business::Monzo::Client' );
# monkey patching Mojo::UserAgent here to make this test work without
# having to actually hit the endpoints or use credentials
no warnings 'redefine';
no warnings 'once';
my $mock = Test::MockObject->new;
$mock->mock( 'success',sub { 1 } );
$mock->mock( 'headers',sub { $mock } );
$mock->mock( 'result',sub { $mock } );
$mock->mock( 'is_success',sub { $mock } );
$mock->mock( 'message',sub { $mock } );
$mock->mock( 'code',sub { $mock } );
$mock->mock( 'json',sub { $mock } );
( run in 0.438 second using v1.01-cache-2.11-cpan-b61123c0432 )