| 1 | package Business::Monzo::Webhook; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Business::Monzo::Webhook | ||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | A class for a Monzo webhook, extends L<Business::Monzo::Resource> | ||||||||||
| 10 | |||||||||||
| 11 | =cut | ||||||||||
| 12 | |||||||||||
| 13 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 11 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 11 | extends 'Business::Monzo::Resource'; | |||||||||
| 18 | |||||||||||
| 19 | 11 | ▶ | use Types::Standard qw/ :all /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 11 | ▶ | use Business::Monzo::Exception; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | =head1 ATTRIBUTES | ||||||||||
| 23 | |||||||||||
| 24 | The Webhook class has the following attributes (with their type). | ||||||||||
| 25 | |||||||||||
| 26 | id (Str) | ||||||||||
| 27 | callback_url (Str) | ||||||||||
| 28 | account (Business::Monzo::Account) | ||||||||||
| 29 | |||||||||||
| 30 | Note that when a Str is passed to ->account this will be coerced | ||||||||||
| 31 | to a Business::Monzo::Account object. | ||||||||||
| 32 | |||||||||||
| 33 | =cut | ||||||||||
| 34 | |||||||||||
| 35 | 11 | has [ qw/ id callback_url / ] => ( | |||||||||
| 36 | is => 'ro', | ||||||||||
| 37 | isa => Str, | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | has account => ( | ||||||||||
| 41 | is => 'ro', | ||||||||||
| 42 | isa => InstanceOf['Business::Monzo::Account'], | ||||||||||
| 43 | 4 | ▶ | coerce => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 44 | 4 | my ( $args ) = @_; | |||||||||
| 45 | |||||||||||
| 46 | 4 | ▶ | if ( ! ref( $args ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 1 | require Business::Monzo::Account; | |||||||||
| 48 | 1 | $args = Business::Monzo::Account->new( | |||||||||
| 49 | id => $args, | ||||||||||
| 50 | client => $Business::Monzo::Resource::client, | ||||||||||
| 51 | ); | ||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 4 | return $args; | |||||||||
| 55 | }, | ||||||||||
| 56 | 11 | ); | |||||||||
| 57 | |||||||||||
| 58 | =head1 Operations on an webhook | ||||||||||
| 59 | |||||||||||
| 60 | =head2 delete | ||||||||||
| 61 | |||||||||||
| 62 | Deletes a webhook | ||||||||||
| 63 | |||||||||||
| 64 | $webhook->delete | ||||||||||
| 65 | |||||||||||
| 66 | =cut | ||||||||||
| 67 | |||||||||||
| 68 | 1 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 69 | 1 | my ( $self ) = @_; | |||||||||
| 70 | 1 | return $self->client->api_delete( $self->url ); | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 1 | ▶ | sub get { | ||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 74 | 1 | Business::Monzo::Exception->throw({ | |||||||||
| 75 | message => "Monzo API does not currently support getting webhook data", | ||||||||||
| 76 | }); | ||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | =head1 SEE ALSO | ||||||||||
| 80 | |||||||||||
| 81 | L<Business::Monzo> | ||||||||||
| 82 | |||||||||||
| 83 | L<Business::Monzo::Resource> | ||||||||||
| 84 | |||||||||||
| 85 | =head1 AUTHOR | ||||||||||
| 86 | |||||||||||
| 87 | Lee Johnson - C<leejo@cpan.org> | ||||||||||
| 88 | |||||||||||
| 89 | =head1 LICENSE | ||||||||||
| 90 | |||||||||||
| 91 | This library is free software; you can redistribute it and/or modify it under | ||||||||||
| 92 | the same terms as Perl itself. If you would like to contribute documentation, | ||||||||||
| 93 | features, bug fixes, or anything else then please raise an issue / pull request: | ||||||||||
| 94 | |||||||||||
| 95 | https://github.com/leejo/business-monzo | ||||||||||
| 96 | |||||||||||
| 97 | =cut | ||||||||||
| 98 | |||||||||||
| 99 | 11 | 1; | |||||||||
| 100 | |||||||||||
| 101 | # vim: ts=4:sw=4:et | ||||||||||