summaryrefslogtreecommitdiffstats
path: root/lib/WWW/YNAB/ScheduledTransaction.pm
blob: 94342988d6ab997e4e900dff47371b6b30ac1178 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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(
        never daily weekly everyOtherWeek twiceAMonth every4Weeks
        monthly everyOtherMonth every3Months every4Months twiceAYear
        yearly everyOtherYear
    )]),
);

=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',
    isa     => 'ArrayRef[WWW::YNAB::ScheduledSubTransaction]',
    handles => {
        subtransactions => 'elements',
    }
);

__PACKAGE__->meta->make_immutable;
no Moose;

1;