From c1fb530eea90fcf7c1c294b44d6d833e4dbcd809 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 24 Jun 2018 12:01:23 -0400 Subject: add scheduled transactions --- lib/WWW/YNAB/ScheduledTransaction.pm | 98 ++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/WWW/YNAB/ScheduledTransaction.pm (limited to 'lib/WWW/YNAB/ScheduledTransaction.pm') diff --git a/lib/WWW/YNAB/ScheduledTransaction.pm b/lib/WWW/YNAB/ScheduledTransaction.pm new file mode 100644 index 0000000..98c67f1 --- /dev/null +++ b/lib/WWW/YNAB/ScheduledTransaction.pm @@ -0,0 +1,98 @@ +package WWW::YNAB::ScheduledTransaction; +use Moose; + +use Moose::Util::TypeConstraints qw(enum maybe_type); + +has id => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +has date_first => ( + is => 'ro', + isa => 'Str', +); + +has date_next => ( + is => 'ro', + isa => 'Str', +); + +has frequency => ( + is => 'ro', + isa => enum([qw( + never daily weekly everyOtherWeek twiceAMonth every4Weeks + monthly everyOtherMonth every3Months every4Months twiceAYear + yearly everyOtherYear + )]), +); + +has amount => ( + is => 'ro', + isa => 'Int', +); + +has memo => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has flag_color => ( + is => 'ro', + isa => maybe_type(enum([qw(red orange yellow green blue purple)])), +); + +has account_id => ( + is => 'ro', + isa => 'Str', +); + +has payee_id => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has category_id => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has transfer_account_id => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has deleted => ( + is => 'ro', + isa => 'Bool', +); + +has account_name => ( + is => 'ro', + isa => 'Str', +); + +has payee_name => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has category_name => ( + is => 'ro', + isa => 'Maybe[Str]', +); + +has subtransactions => ( + traits => ['Array'], + is => 'bare', + isa => 'ArrayRef[WWW::YNAB::ScheduledSubTransaction]', + handles => { + subtransactions => 'elements', + } +); + +__PACKAGE__->meta->make_immutable; +no Moose; + +1; -- cgit v1.2.3-54-g00ecf