| 1 | package Net::Evernote::Notebook; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | our $VERSION = '0.07'; | ||
| 6 | |||
| 7 | sub new { | ||
| 8 | my ($class, $args) = @_; | ||
| 9 | my $debug = $ENV{DEBUG}; | ||
| 10 | my $obj = $$args{_obj}; | ||
| 11 | |||
| 12 | return bless { | ||
| 13 | _obj => $obj, | ||
| 14 | _authentication_token => $$args{_authentication_token}, | ||
| 15 | _notestore => $$args{_notestore}, | ||
| 16 | debug => $debug, | ||
| 17 | name => $$args{name}, | ||
| 18 | }, $class; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub delete { | ||
| 22 | my $self = shift; | ||
| 23 | my $guid = $self->guid; | ||
| 24 | my $authToken = $self->{_authentication_token}; | ||
| 25 | my $client = $self->{_notestore}; | ||
| 26 | |||
| 27 | return $client->expungeNotebook($authToken,$guid); | ||
| 28 | } | ||
| 29 | |||
| 30 | # the magic | ||
| 31 | sub AUTOLOAD { | ||
| 32 | my ($self,@args) = @_; | ||
| 33 | our ($AUTOLOAD); | ||
| 34 | my $method = $AUTOLOAD; | ||
| 35 | $method =~ s/.*:://; | ||
| 36 | |||
| 37 | if ($self->{_obj}->can($method)) { | ||
| 38 | return $self->{_obj}->$method; | ||
| 39 | } else { | ||
| 40 | return undef; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; | ||
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | Net::Evernote::Notebook | ||
| 49 | |||
| 50 | =head1 VERSION | ||
| 51 | |||
| 52 | Version 0.06 | ||
| 53 | |||
| 54 | |||
| 55 | =head1 SYNOPSIS | ||
| 56 | |||
| 57 | use Net::Evernote; | ||
| 58 | use Net::Evernote::Notebook; | ||
| 59 | |||
| 60 | my $evernote = Net::Evernote->new({ | ||
| 61 | authentication_token => $authentication_token | ||
| 62 | }); | ||
| 63 | |||
| 64 | my $notebook = $evernote->createNotebook({ | ||
| 65 | name => 'notebook name', | ||
| 66 | }); | ||
| 67 | |||
| 68 | my $notebookGuid = $notebook->guid; | ||
| 69 | my $note = $evernote->createNote({ | ||
| 70 | title => 'test title', | ||
| 71 | content => 'test content', | ||
| 72 | notebook_guid => $notebookGuid, | ||
| 73 | }); | ||
| 74 | |||
| 75 | =head1 SEE ALSO | ||
| 76 | |||
| 77 | http://www.evernote.com/about/developer/api/ | ||
| 78 | |||
| 79 | |||
| 80 | =head1 AUTHOR | ||
| 81 | |||
| 82 | David Collins <davidcollins4481@gmail.com> | ||
| 83 | |||
| 84 | =head1 BUGS/LIMITATIONS | ||
| 85 | |||
| 86 | If you have found bugs, please send email to <davidcollins4481@gmail.com> | ||
| 87 | |||
| 88 | |||
| 89 | =head1 SUPPORT | ||
| 90 | |||
| 91 | You can find documentation for this module with the perldoc command. | ||
| 92 | |||
| 93 | perldoc Net::Evernote::Notebook | ||
| 94 | |||
| 95 | |||
| 96 | =head1 COPYRIGHT & LICENSE | ||
| 97 | |||
| 98 | Copyright 2013 David Collins, all rights reserved. | ||
| 99 | |||
| 100 | This program is free software; you can redistribute it and/or modify | ||
| 101 | it under the same terms as Perl itself. |