| 1 | package WebService::Affiliate::Voucher::TradeDoubler; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | use namespace::autoclean; | ||
| 5 | |||
| 6 | use DateTime::Format::ISO8601; | ||
| 7 | |||
| 8 | with 'WebService::Affiliate::Role::Voucher'; | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | WebService::Affiliate::Voucher::TradeDoubler - TradeDoubler specific voucher code model. | ||
| 13 | |||
| 14 | =head1 VERSION | ||
| 15 | |||
| 16 | Version 0.01 | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | our $VERSION = '0.01_01'; | ||
| 21 | |||
| 22 | $VERSION = eval $VERSION; | ||
| 23 | |||
| 24 | =head1 SYNOPSIS | ||
| 25 | |||
| 26 | Models a TradeDoubler voucher code. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | =head1 METHODS | ||
| 37 | |||
| 38 | =head2 Attributes | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | has id => ( is => 'rw', isa => 'Int' ); | ||
| 43 | |||
| 44 | |||
| 45 | has _updated => ( is => 'rw', isa => 'Str', ); | ||
| 46 | has updated => ( is => 'rw', isa => 'Maybe[DateTime]', lazy => 1, builder => '_build_updated' ); | ||
| 47 | |||
| 48 | has title => ( is => 'rw', isa => 'Str' ); | ||
| 49 | has short_description => ( is => 'rw', isa => 'Str' ); | ||
| 50 | has type => ( is => 'rw', isa => 'Str' ); | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | sub _build_updated | ||
| 56 | { | ||
| 57 | my ($self) = @_; | ||
| 58 | |||
| 59 | return undef if ! $self->_updated; | ||
| 60 | |||
| 61 | return DateTime::Format::MySQL->parse_datetime( $self->_updated ) if $self->_updated =~ /^\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d$/; | ||
| 62 | return DateTime::Format::ISO8601->parse_datetime( $self->_updated ); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | =head1 METHODS | ||
| 68 | |||
| 69 | =head2 Class Methods | ||
| 70 | |||
| 71 | =head3 new | ||
| 72 | |||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | __PACKAGE__->meta->make_immutable; | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Rob Brown, C<< <rob at intelcompute.com> >> | ||
| 81 | |||
| 82 | =head1 BUGS | ||
| 83 | |||
| 84 | Please report any bugs or feature requests to C<bug-webservice-affiliate at rt.cpan.org>, or through | ||
| 85 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Affiliate>. I will be notified, and then you'll | ||
| 86 | automatically be notified of progress on your bug as I make changes. | ||
| 87 | |||
| 88 | =head1 SUPPORT | ||
| 89 | |||
| 90 | You can find documentation for this module with the perldoc command. | ||
| 91 | |||
| 92 | perldoc WebService::Affiliate | ||
| 93 | |||
| 94 | You can also look for information at: | ||
| 95 | |||
| 96 | =over 4 | ||
| 97 | |||
| 98 | =item * RT: CPAN's request tracker (report bugs here) | ||
| 99 | |||
| 100 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebService-Affiliate> | ||
| 101 | |||
| 102 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 103 | |||
| 104 | L<http://annocpan.org/dist/WebService-Affiliate> | ||
| 105 | |||
| 106 | =item * CPAN Ratings | ||
| 107 | |||
| 108 | L<http://cpanratings.perl.org/d/WebService-Affiliate> | ||
| 109 | |||
| 110 | =item * Search CPAN | ||
| 111 | |||
| 112 | L<http://search.cpan.org/dist/WebService-Affiliate/> | ||
| 113 | |||
| 114 | =back | ||
| 115 | |||
| 116 | =head1 ACKNOWLEDGEMENTS | ||
| 117 | |||
| 118 | =head1 LICENSE AND COPYRIGHT | ||
| 119 | |||
| 120 | Copyright 2012 Rob Brown. | ||
| 121 | |||
| 122 | This program is free software; you can redistribute it and/or modify it | ||
| 123 | under the terms of either: the GNU General Public License as published | ||
| 124 | by the Free Software Foundation; or the Artistic License. | ||
| 125 | |||
| 126 | See http://dev.perl.org/licenses/ for more information. | ||
| 127 | |||
| 128 | =cut | ||
| 129 | |||
| 130 | 1; # End of WebService::Affiliate |