App-SimplenoteSync

 view release on metacpan or  search on metacpan

lib/App/SimplenoteSync.pm  view on Meta::CPAN

package App::SimplenoteSync;
$App::SimplenoteSync::VERSION = '0.2.1';
# ABSTRACT: Synchronise text notes with simplenoteapp.com

use v5.10;
use open qw(:std :utf8);
use Moose;
use MooseX::Types::Path::Class;
use Log::Any qw//;
use DateTime;
use Try::Tiny;
use File::ExtAttr ':all';
use Proc::InvokeEditor;
use App::SimplenoteSync::Note;
use WebService::Simplenote;
use Method::Signatures;
use namespace::autoclean;

has ['email', 'password'] => (
    is       => 'ro',
    isa      => 'Str',
    required => 1,
);

has notes => (
    is      => 'rw',
    traits  => ['Hash'],
    isa     => 'HashRef[App::SimplenoteSync::Note]',
    default => sub { {} },
    handles => {
        set_note    => 'set',
        has_note    => 'exists',
        num_notes   => 'count',
        remove_note => 'delete',
        note_kvs    => 'kv',
    },
);

has stats => (
    is      => 'rw',
    isa     => 'HashRef',
    default => sub {
        {
            new_local     => 0,
            new_remote    => 0,
            update_local  => 0,
            update_remote => 0,
            deleted_local => 0,
            trash         => 0,
            local_files   => 0,
        };
    },
);

has simplenote => (
    is      => 'rw',
    isa     => 'WebService::Simplenote',
    lazy    => 1,
    default => sub {
        my $self = shift;
        return WebService::Simplenote->new(
            email             => $self->email,
            password          => $self->password,
            no_server_updates => $self->no_server_updates,
        );
    },
);

has ['no_server_updates', 'no_local_updates'] => (
    is      => 'ro',
    isa     => 'Bool',



( run in 0.845 second using v1.01-cache-2.11-cpan-39bf76dae61 )