summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist.ini9
-rw-r--r--lib/WWW/YNAB.pm143
-rw-r--r--lib/WWW/YNAB/Account.pm62
-rw-r--r--lib/WWW/YNAB/Budget.pm128
-rw-r--r--lib/WWW/YNAB/Category.pm52
-rw-r--r--lib/WWW/YNAB/CategoryGroup.pm36
-rw-r--r--lib/WWW/YNAB/ModelHelpers.pm9
-rw-r--r--lib/WWW/YNAB/Month.pm36
-rw-r--r--lib/WWW/YNAB/Payee.pm33
-rw-r--r--lib/WWW/YNAB/ScheduledSubTransaction.pm50
-rw-r--r--lib/WWW/YNAB/ScheduledTransaction.pm81
-rw-r--r--lib/WWW/YNAB/SubTransaction.pm49
-rw-r--r--lib/WWW/YNAB/Transaction.pm84
-rw-r--r--lib/WWW/YNAB/UA.pm10
-rw-r--r--lib/WWW/YNAB/User.pm19
15 files changed, 794 insertions, 7 deletions
diff --git a/dist.ini b/dist.ini
index 3784cd1..818156c 100644
--- a/dist.ini
+++ b/dist.ini
@@ -3,9 +3,18 @@ author = Jesse Luehrs <doy@tozt.net>
license = MIT
copyright_holder = Jesse Luehrs
+[FileFinder::Filter / WeaverFiles]
+finder = :InstallModules
+finder = :ExecFiles
+skip = ^lib/WWW/YNAB/(ModelHelpers|UA).pm$
+
[@DOY]
:version = 0.15
dist = WWW-YNAB
repository = github
+[MetaNoIndex]
+package = WWW::YNAB::ModelHelpers
+package = WWW::YNAB::UA
+
[AutoPrereqs]
diff --git a/lib/WWW/YNAB.pm b/lib/WWW/YNAB.pm
index 74d0f4d..113662a 100644
--- a/lib/WWW/YNAB.pm
+++ b/lib/WWW/YNAB.pm
@@ -1,6 +1,6 @@
package WWW::YNAB;
-use Moose;
+use Moose;
# ABSTRACT: Wrapper for the YNAB API
use WWW::YNAB::Account;
@@ -18,18 +18,55 @@ use WWW::YNAB::User;
with 'WWW::YNAB::ModelHelpers';
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(access_token => 'SECRET');
+ my @budgets = $ynab->budgets;
+
+=head1 DESCRIPTION
+
+This module is a wrapper around the V1 YNAB API. It follows the API structure
+quite closely, so the API documentation should be used for information about
+the data that this module returns. You can find the API documentation at L<https://api.youneedabudget.com/>.
+
+=cut
+
+=attr access_token
+
+Your personal access token. Information about generating a personal access
+token can be found at
+L<https://api.youneedabudget.com/#personal-access-tokens>. Required.
+
+=cut
+
has access_token => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=attr base_uri
+
+The base uri for all API requests. Defaults to
+C<https://api.youneedabudget.com/v1/>. It's unlikely you'll need to change
+this.
+
+=cut
+
has base_uri => (
is => 'ro',
isa => 'Str',
default => 'https://api.youneedabudget.com/v1/',
);
+=attr ua
+
+The HTTP user agent to use. Must be compatible with L<HTTP::Tiny>.
+
+=cut
+
has ua => (
is => 'ro',
isa => 'HTTP::Tiny',
@@ -51,6 +88,10 @@ has _ua => (
},
);
+=method user
+
+=cut
+
sub user {
my $self = shift;
@@ -59,6 +100,10 @@ sub user {
$self->model_from_data('WWW::YNAB::User', $user);
}
+=method budgets
+
+=cut
+
sub budgets {
my $self = shift;
@@ -68,6 +113,17 @@ sub budgets {
} @{ $data->{data}{budgets} };
}
+=method budget($id, $server_knowledge=undef)
+
+Returns the budget with id C<$id>. The returned budget object will have a
+C<server_knowledge> method which represents the state of the server when that
+object was returned. If the C<$server_knowledge> parameter is passed here with
+a value that came from an object previously returned by this method, this
+method will only return sub-objects (transactions, accounts, etc.) which have
+changed since that previous object was generated.
+
+=cut
+
sub budget {
my $self = shift;
my ($id, $server_knowledge) = @_;
@@ -192,24 +248,53 @@ sub budget {
);
}
+=method rate_limit
+
+Returns the number of requests in the current rate limit bucket.
+
+=cut
+
sub rate_limit {
my $self = shift;
$self->_ua->rate_limit
}
+=method knows_rate_limit
+
+Returns true if the current rate limit is known. This will only be true after a
+request has already been made (since the API currently doesn't provide a way to
+just request the current rate limit).
+
+=cut
+
sub knows_rate_limit {
my $self = shift;
$self->_ua->knows_rate_limit
}
+=method total_rate_limit
+
+Returns the total number of requests that will be allowed in the current rate
+limit bucket.
+
+=cut
+
sub total_rate_limit {
my $self = shift;
$self->_ua->total_rate_limit
}
+=method knows_total_rate_limit
+
+Returns true if the current total rate limit is known. This will only be true
+after a request has already been made (since the API currently doesn't provide
+a way to just request the current rate limit).
+
+=cut
+
sub knows_total_rate_limit {
my $self = shift;
@@ -219,4 +304,60 @@ sub knows_total_rate_limit {
__PACKAGE__->meta->make_immutable;
no Moose;
+=head1 BUGS/LIMITATIONS
+
+No known bugs.
+
+Please report any bugs to GitHub Issues at
+L<https://github.com/doy/www-ynab/issues>.
+
+Not all of the API is exposed by this wrapper yet. In particular, these things
+are missing:
+
+=over 4
+
+=item All modification endpoints (this module currently only exposes read-only operations)
+
+=item The payee location API
+
+=item OAuth authentication
+
+=back
+
+Patches are greatly appreciated if you are interested in this functionality.
+
+=head1 SEE ALSO
+
+L<https://api.youneedabudget.com/>
+
+=head1 SUPPORT
+
+You can find this documentation for this module with the perldoc command.
+
+ perldoc WWW::YNAB
+
+You can also look for information at:
+
+=over 4
+
+=item * MetaCPAN
+
+L<https://metacpan.org/release/WWW-YNAB>
+
+=item * Github
+
+L<https://github.com/doy/www-ynab>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-YNAB>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/WWW-YNAB>
+
+=back
+
+=cut
+
1;
diff --git a/lib/WWW/YNAB/Account.pm b/lib/WWW/YNAB/Account.pm
index 6ce05bc..3b61b9e 100644
--- a/lib/WWW/YNAB/Account.pm
+++ b/lib/WWW/YNAB/Account.pm
@@ -1,21 +1,49 @@
package WWW::YNAB::Account;
+
use Moose;
+# ABSTRACT: Account model object
use Moose::Util::TypeConstraints qw(enum);
with 'WWW::YNAB::ModelHelpers';
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $account = $budgets[0]->account('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Accounts> for more information.
+
+=cut
+
+=method id
+
+=cut
+
has id => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=method name
+
+=cut
+
has name => (
is => 'ro',
isa => 'Str',
);
+=method type
+
+=cut
+
has type => (
is => 'ro',
isa => enum([
@@ -25,47 +53,69 @@ has type => (
]),
);
+=method on_budget
+
+=cut
+
has on_budget => (
is => 'ro',
isa => 'Bool',
);
+=method closed
+
+=cut
+
has closed => (
is => 'ro',
isa => 'Bool',
);
+=method note
+
+=cut
+
has note => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method balance
+
+=cut
+
has balance => (
is => 'ro',
isa => 'Int',
);
+=method cleared_balance
+
+=cut
+
has cleared_balance => (
is => 'ro',
isa => 'Int',
);
+=method uncleared_balance
+
+=cut
+
has uncleared_balance => (
is => 'ro',
isa => 'Int',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
);
-has _ua => (
- is => 'ro',
- isa => 'WWW::YNAB::UA',
- required => 1,
-);
-
__PACKAGE__->meta->make_immutable;
no Moose;
diff --git a/lib/WWW/YNAB/Budget.pm b/lib/WWW/YNAB/Budget.pm
index 5a8bdee..2493623 100644
--- a/lib/WWW/YNAB/Budget.pm
+++ b/lib/WWW/YNAB/Budget.pm
@@ -1,42 +1,85 @@
package WWW::YNAB::Budget;
+
use Moose;
+# ABSTRACT: Budget model object
use Carp;
use Moose::Util::TypeConstraints qw(find_type_constraint);
with 'WWW::YNAB::ModelHelpers';
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my $budget = $ynab->budget('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Budgets> for more information.
+
+=cut
+
+=method id
+
+=cut
+
has id => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=method name
+
+=cut
+
has name => (
is => 'ro',
isa => 'Str',
);
+=method last_modified_on
+
+=cut
+
has last_modified_on => (
is => 'ro',
isa => 'Str',
);
+=method first_month
+
+=cut
+
has first_month => (
is => 'ro',
isa => 'Str',
);
+=method last_month
+
+=cut
+
has last_month => (
is => 'ro',
isa => 'Str',
);
+=method server_knowledge
+
+=cut
+
has server_knowledge => (
is => 'ro',
isa => 'Int',
);
+=method accounts
+
+=cut
+
has _accounts => (
traits => ['Array'],
is => 'ro',
@@ -49,6 +92,10 @@ has _accounts => (
}
);
+=method payees
+
+=cut
+
has _payees => (
traits => ['Array'],
is => 'ro',
@@ -61,6 +108,16 @@ has _payees => (
}
);
+=method categories
+
+=cut
+
+=method category_groups
+
+Alias for C<categories>.
+
+=cut
+
has _category_groups => (
traits => ['Array'],
is => 'ro',
@@ -74,6 +131,10 @@ has _category_groups => (
}
);
+=method months
+
+=cut
+
has _months => (
traits => ['Array'],
is => 'ro',
@@ -86,6 +147,10 @@ has _months => (
}
);
+=method transactions
+
+=cut
+
has _transactions => (
traits => ['Array'],
is => 'ro',
@@ -98,6 +163,10 @@ has _transactions => (
}
);
+=method scheduled_transactions
+
+=cut
+
has _scheduled_transactions => (
traits => ['Array'],
is => 'ro',
@@ -127,6 +196,12 @@ sub _build_accounts {
]
}
+=method account($id)
+
+Returns the account with id C<$id>.
+
+=cut
+
sub account {
my $self = shift;
my ($id) = @_;
@@ -152,6 +227,12 @@ sub _build_categories {
]
}
+=method category($id)
+
+Returns the category with id C<$id>.
+
+=cut
+
sub category {
my $self = shift;
my ($id) = @_;
@@ -172,6 +253,12 @@ sub _build_payees {
]
}
+=method payee($id)
+
+Returns the payee with id C<$id>.
+
+=cut
+
sub payee {
my $self = shift;
my ($id) = @_;
@@ -192,6 +279,12 @@ sub _build_months {
]
}
+=method month($id)
+
+Returns the month with id C<$id>.
+
+=cut
+
sub month {
my $self = shift;
my ($id) = @_;
@@ -206,6 +299,29 @@ sub month {
$self->model_from_data('WWW::YNAB::Month', \%month);
}
+=method find_transactions(%query)
+
+Finds transactions based on query parameters. Valid options are (all optional):
+
+=over 4
+
+=item account
+
+=item category
+
+=item payee
+
+=item type
+
+=item since_date
+
+=back
+
+Note that only one of C<account>, C<category>, C<payee>, or C<type> may be
+specified.
+
+=cut
+
sub find_transactions {
my $self = shift;
my %query = @_;
@@ -255,6 +371,12 @@ sub _build_transactions {
$self->find_transactions
}
+=method transaction($id)
+
+Returns the transaction with id C<$id>.
+
+=cut
+
sub transaction {
my $self = shift;
my ($id) = @_;
@@ -285,6 +407,12 @@ sub _build_scheduled_transactions {
]
}
+=method scheduled_transaction($id)
+
+Returns the scheduled transaction with id C<$id>.
+
+=cut
+
sub scheduled_transaction {
my $self = shift;
my ($id) = @_;
diff --git a/lib/WWW/YNAB/Category.pm b/lib/WWW/YNAB/Category.pm
index 2fa99ef..da02c19 100644
--- a/lib/WWW/YNAB/Category.pm
+++ b/lib/WWW/YNAB/Category.pm
@@ -1,5 +1,25 @@
package WWW::YNAB::Category;
+
use Moose;
+# ABSTRACT: Category model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $transaction = $budgets[0]->category('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Categories> for more information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',
@@ -7,41 +27,73 @@ has id => (
required => 1,
);
+=method category_group_id
+
+=cut
+
has category_group_id => (
is => 'ro',
isa => 'Str',
);
+=method name
+
+=cut
+
has name => (
is => 'ro',
isa => 'Str',
);
+=method hidden
+
+=cut
+
has hidden => (
is => 'ro',
isa => 'Bool',
);
+=method note
+
+=cut
+
has note => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method budgeted
+
+=cut
+
has budgeted => (
is => 'ro',
isa => 'Int',
);
+=method activity
+
+=cut
+
has activity => (
is => 'ro',
isa => 'Int',
);
+=method balance
+
+=cut
+
has balance => (
is => 'ro',
isa => 'Int',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
diff --git a/lib/WWW/YNAB/CategoryGroup.pm b/lib/WWW/YNAB/CategoryGroup.pm
index 28ddd6f..346dc0e 100644
--- a/lib/WWW/YNAB/CategoryGroup.pm
+++ b/lib/WWW/YNAB/CategoryGroup.pm
@@ -1,5 +1,25 @@
package WWW::YNAB::CategoryGroup;
+
use Moose;
+# ABSTRACT: CategoryGroup model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my @category_groups = $budgets[0]->category_groups
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Categories> for more information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',
@@ -7,21 +27,37 @@ has id => (
required => 1,
);
+=method name
+
+=cut
+
has name => (
is => 'ro',
isa => 'Str',
);
+=method hidden
+
+=cut
+
has hidden => (
is => 'ro',
isa => 'Bool',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
);
+=method categories
+
+=cut
+
has categories => (
traits => ['Array'],
is => 'bare',
diff --git a/lib/WWW/YNAB/ModelHelpers.pm b/lib/WWW/YNAB/ModelHelpers.pm
index e61aa12..09f5cfb 100644
--- a/lib/WWW/YNAB/ModelHelpers.pm
+++ b/lib/WWW/YNAB/ModelHelpers.pm
@@ -1,4 +1,5 @@
package WWW::YNAB::ModelHelpers;
+
use Moose::Role;
sub model_from_data {
@@ -26,4 +27,12 @@ sub model_from_data {
no Moose::Role;
+=begin Pod::Coverage
+
+ model_from_data
+
+=end Pod::Coverage
+
+=cut
+
1;
diff --git a/lib/WWW/YNAB/Month.pm b/lib/WWW/YNAB/Month.pm
index 3680e18..c09ecd1 100644
--- a/lib/WWW/YNAB/Month.pm
+++ b/lib/WWW/YNAB/Month.pm
@@ -1,5 +1,25 @@
package WWW::YNAB::Month;
+
use Moose;
+# ABSTRACT: Month model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $month = $budgets[0]->month('2018-06-01');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Months> for more information.
+
+=cut
+
+=method month
+
+=cut
has month => (
is => 'ro',
@@ -7,21 +27,37 @@ has month => (
required => 1,
);
+=method note
+
+=cut
+
has note => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method to_be_budgeted
+
+=cut
+
has to_be_budgeted => (
is => 'ro',
isa => 'Maybe[Int]',
);
+=method age_of_money
+
+=cut
+
has age_of_money => (
is => 'ro',
isa => 'Maybe[Int]',
);
+=method categories
+
+=cut
+
has categories => (
traits => ['Array'],
is => 'bare',
diff --git a/lib/WWW/YNAB/Payee.pm b/lib/WWW/YNAB/Payee.pm
index d25ef9e..443cf9e 100644
--- a/lib/WWW/YNAB/Payee.pm
+++ b/lib/WWW/YNAB/Payee.pm
@@ -1,5 +1,26 @@
package WWW::YNAB::Payee;
+
use Moose;
+# ABSTRACT: Payee model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $payee = $budgets[0]->payee('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Payees> for more
+information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',
@@ -7,16 +28,28 @@ has id => (
required => 1,
);
+=method name
+
+=cut
+
has name => (
is => 'ro',
isa => 'Str',
);
+=method transfer_account_id
+
+=cut
+
has transfer_account_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
diff --git a/lib/WWW/YNAB/ScheduledSubTransaction.pm b/lib/WWW/YNAB/ScheduledSubTransaction.pm
index d275f4d..690cdd6 100644
--- a/lib/WWW/YNAB/ScheduledSubTransaction.pm
+++ b/lib/WWW/YNAB/ScheduledSubTransaction.pm
@@ -1,5 +1,27 @@
package WWW::YNAB::ScheduledSubTransaction;
+
use Moose;
+# ABSTRACT: ScheduledSubTransaction model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $scheduled_transaction = $budgets[0]->scheduled_transaction('12345678-1234-1234-1234-1234567890ab');
+ my @scheduled_sub_transactions = $scheduled_transaction->subtransactions;
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Scheduled_Transactions> for more
+information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',
@@ -7,36 +29,64 @@ has id => (
required => 1,
);
+=method scheduled_transaction_id
+
+=cut
+
has scheduled_transaction_id => (
is => 'ro',
isa => 'Str',
);
+=method amount
+
+=cut
+
has amount => (
is => 'ro',
isa => 'Int',
);
+=method memo
+
+=cut
+
has memo => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method payee_id
+
+=cut
+
has payee_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_id
+
+=cut
+
has category_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method transfer_account_id
+
+=cut
+
has transfer_account_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
diff --git a/lib/WWW/YNAB/ScheduledTransaction.pm b/lib/WWW/YNAB/ScheduledTransaction.pm
index 98c67f1..9434298 100644
--- a/lib/WWW/YNAB/ScheduledTransaction.pm
+++ b/lib/WWW/YNAB/ScheduledTransaction.pm
@@ -1,24 +1,57 @@
package WWW::YNAB::ScheduledTransaction;
+
use Moose;
+# ABSTRACT: ScheduledSubTransaction model object
use Moose::Util::TypeConstraints qw(enum maybe_type);
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $scheduled_transaction = $budgets[0]->scheduled_transaction('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Scheduled_Transactions> for more
+information.
+
+=cut
+
+=method id
+
+=cut
+
has id => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=method date_first
+
+=cut
+
has date_first => (
is => 'ro',
isa => 'Str',
);
+=method date_next
+
+=cut
+
has date_next => (
is => 'ro',
isa => 'Str',
);
+=method frequency
+
+=cut
+
has frequency => (
is => 'ro',
isa => enum([qw(
@@ -28,61 +61,109 @@ has frequency => (
)]),
);
+=method amount
+
+=cut
+
has amount => (
is => 'ro',
isa => 'Int',
);
+=method memo
+
+=cut
+
has memo => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method flag_color
+
+=cut
+
has flag_color => (
is => 'ro',
isa => maybe_type(enum([qw(red orange yellow green blue purple)])),
);
+=method account_id
+
+=cut
+
has account_id => (
is => 'ro',
isa => 'Str',
);
+=method payee_id
+
+=cut
+
has payee_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_id
+
+=cut
+
has category_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method transfer_account_id
+
+=cut
+
has transfer_account_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
);
+=method account_name
+
+=cut
+
has account_name => (
is => 'ro',
isa => 'Str',
);
+=method payee_name
+
+=cut
+
has payee_name => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_name
+
+=cut
+
has category_name => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method subtransactions
+
+=cut
+
has subtransactions => (
traits => ['Array'],
is => 'bare',
diff --git a/lib/WWW/YNAB/SubTransaction.pm b/lib/WWW/YNAB/SubTransaction.pm
index 9c761aa..a5170b6 100644
--- a/lib/WWW/YNAB/SubTransaction.pm
+++ b/lib/WWW/YNAB/SubTransaction.pm
@@ -1,5 +1,26 @@
package WWW::YNAB::SubTransaction;
+
use Moose;
+# ABSTRACT: SubTransaction model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $transaction = $budgets[0]->transaction('12345678-1234-1234-1234-1234567890ab');
+ my @subtransactions = $transaction->subtransactions;
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Transactions> for more information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',
@@ -7,36 +28,64 @@ has id => (
required => 1,
);
+=method transaction_id
+
+=cut
+
has transaction_id => (
is => 'ro',
isa => 'Str',
);
+=method amount
+
+=cut
+
has amount => (
is => 'ro',
isa => 'Int',
);
+=method memo
+
+=cut
+
has memo => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method payee_id
+
+=cut
+
has payee_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_id
+
+=cut
+
has category_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method transfer_account_id
+
+=cut
+
has transfer_account_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
diff --git a/lib/WWW/YNAB/Transaction.pm b/lib/WWW/YNAB/Transaction.pm
index 8fa1cc5..74a6764 100644
--- a/lib/WWW/YNAB/Transaction.pm
+++ b/lib/WWW/YNAB/Transaction.pm
@@ -1,89 +1,173 @@
package WWW::YNAB::Transaction;
+
use Moose;
+# ABSTRACT: Transaction model object
use Moose::Util::TypeConstraints qw(enum maybe_type);
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my @budgets = $ynab->budgets;
+ my $transaction = $budgets[0]->transaction('12345678-1234-1234-1234-1234567890ab');
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/Transactions> for more information.
+
+=cut
+
+=method id
+
+=cut
+
has id => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=method date
+
+=cut
+
has date => (
is => 'ro',
isa => 'Str',
);
+=method amount
+
+=cut
+
has amount => (
is => 'ro',
isa => 'Int',
);
+=method memo
+
+=cut
+
has memo => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method cleared
+
+=cut
+
has cleared => (
is => 'ro',
isa => enum([qw(cleared uncleared reconciled)]),
);
+=method approved
+
+=cut
+
has approved => (
is => 'ro',
isa => 'Bool',
);
+=method flag_color
+
+=cut
+
has flag_color => (
is => 'ro',
isa => maybe_type(enum([qw(red orange yellow green blue purple)])),
);
+=method account_id
+
+=cut
+
has account_id => (
is => 'ro',
isa => 'Str',
);
+=method payee_id
+
+=cut
+
has payee_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_id
+
+=cut
+
has category_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method transfer_account_id
+
+=cut
+
has transfer_account_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method import_id
+
+=cut
+
has import_id => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method deleted
+
+=cut
+
has deleted => (
is => 'ro',
isa => 'Bool',
);
+=method account_name
+
+=cut
+
has account_name => (
is => 'ro',
isa => 'Str',
);
+=method payee_name
+
+=cut
+
has payee_name => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method category_name
+
+=cut
+
has category_name => (
is => 'ro',
isa => 'Maybe[Str]',
);
+=method subtransactions
+
+=cut
+
has subtransactions => (
traits => ['Array'],
is => 'bare',
diff --git a/lib/WWW/YNAB/UA.pm b/lib/WWW/YNAB/UA.pm
index 47c9fcb..6c1968c 100644
--- a/lib/WWW/YNAB/UA.pm
+++ b/lib/WWW/YNAB/UA.pm
@@ -1,4 +1,5 @@
package WWW::YNAB::UA;
+
use Moose;
use HTTP::Tiny;
@@ -86,4 +87,13 @@ sub _request {
__PACKAGE__->meta->make_immutable;
no Moose;
+=begin Pod::Coverage
+
+ get
+ post
+
+=end Pod::Coverage
+
+=cut
+
1;
diff --git a/lib/WWW/YNAB/User.pm b/lib/WWW/YNAB/User.pm
index 2915fca..92dd09a 100644
--- a/lib/WWW/YNAB/User.pm
+++ b/lib/WWW/YNAB/User.pm
@@ -1,5 +1,24 @@
package WWW::YNAB::User;
+
use Moose;
+# ABSTRACT: User model object
+
+=head1 SYNOPSIS
+
+ use WWW::YNAB;
+
+ my $ynab = WWW::YNAB->new(...);
+ my $user = $ynab->user;
+
+=head1 OVERVIEW
+
+See L<https://api.youneedabudget.com/v1#/User> for more information.
+
+=cut
+
+=method id
+
+=cut
has id => (
is => 'ro',