| 1 | package App::SD::Replica::debbugs::PullEncoder; | ||
| 2 | use Any::Moose; | ||
| 3 | |||
| 4 | use Params::Validate qw(:all); | ||
| 5 | use Memoize; | ||
| 6 | |||
| 7 | has sync_source => ( | ||
| 8 | isa => 'App::SD::Replica::debbugs', | ||
| 9 | is => 'rw', | ||
| 10 | ); | ||
| 11 | |||
| 12 | our $DEBUG = $Prophet::Handle::DEBUG; | ||
| 13 | |||
| 14 | sub run { | ||
| 15 | my $self = shift; | ||
| 16 | my %args = validate( @_, { | ||
| 17 | # mandatory args go here | ||
| 18 | example => 1, | ||
| 19 | } | ||
| 20 | ); | ||
| 21 | |||
| 22 | # TODO: code goes here | ||
| 23 | } | ||
| 24 | |||
| 25 | our %PROP_MAP = ( | ||
| 26 | remote_prop => 'sd_prop', | ||
| 27 | # ... | ||
| 28 | } | ||
| 29 | |||
| 30 | =head2 translate_prop_names L<Prophet::ChangeSet> | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | sub translate_prop_names { | ||
| 35 | my $self = shift; | ||
| 36 | my $changeset = shift; | ||
| 37 | |||
| 38 | # ... | ||
| 39 | |||
| 40 | return $changeset; | ||
| 41 | } | ||
| 42 | |||
| 43 | =head2 resolve_user_id_to_email ID | ||
| 44 | |||
| 45 | This is only implemented in Hiveminder::PullEncoder; in RT::PullEncoder | ||
| 46 | it's resolve_user_id_to. What's this for, actually? | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | sub resolve_user_id_to_email { | ||
| 51 | my $self = shift; | ||
| 52 | my $id = shift; | ||
| 53 | return undef unless ($id); | ||
| 54 | |||
| 55 | # ... | ||
| 56 | |||
| 57 | # returns email address mapping to user id | ||
| 58 | } | ||
| 59 | |||
| 60 | memoize 'resolve_user_id_to_email'; | ||
| 61 | |||
| 62 | =head2 find_matching_tickets QUERY | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | sub find_matching_tickets { | ||
| 67 | my $self = shift; | ||
| 68 | my ($query) = validate_pos(@_, 1); | ||
| 69 | return $self->sync_source->rt->search( type => 'ticket', query => $query ); | ||
| 70 | } | ||
| 71 | |||
| 72 | =head2 find_matching_transactions TASK, START | ||
| 73 | |||
| 74 | =cut | ||
| 75 | |||
| 76 | sub find_matching_transactions { | ||
| 77 | my $self = shift; | ||
| 78 | my %args = validate( @_, { task => 1, starting_transaction => 1 } ); | ||
| 79 | |||
| 80 | # ... | ||
| 81 | |||
| 82 | return \@matched; | ||
| 83 | } | ||
| 84 | |||
| 85 | __PACKAGE__->meta->make_immutable; | ||
| 86 | no Any::Moose; | ||
| 87 | 1; |