The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::MyGengo::Job - A translation Job in the myGengo system.

SYNOPSIS

    my $job = WebService::MyGengo::Job->new( { lc_src => 'en', lc_tgt => 'ja'... } );

    my $client = WebService::MyGengo::Client->new( $params );
    $job = $client->get_job( 123 );

ATTRIBUTES

See http://mygengo.com/api/developer-docs/payloads/ for more information, as well as the various tests in t/*.t.

job_id|id (Int)

A unique identifier for the Job.

group_id (Int)

A unique identifier for a group of Jobs.

See WebService::MyGengo::Client's `submit_jobs` method.

slug (Str)

Undocumented. Appears to act as a 'title' for the Job.

body_src (Str)

The text to be translated in UTF-8 encoding.

body_tgt (Str)

The translation result text in UTF-8 encoding.

If the Job has not been completed, this will be en empty string.

lc_src (Str)

2-character ISO code for the source language.

lc_tgt (Str)

2-character ISO code for the target language.

custom_data (Str)

Up to 1024 bytes of arbitrary text describing the Job in UTF-8 encoding.

unit_count (Int)

The number of units (words or characters) in the body_src.

tier (Str)

The tier under which this Job is being translated: machine, standard, pro, ultra, ultra_pro

credits (Num)

A decimal figure representing how many credits this Job will cost.

status (Str)

The Job's status: unpaid, available, pending, reviewable, revising, approved, rejected, cancelled, held

eta (DateTime::Duration)

A DateTime::Duration object representing an estimate of when the Job will be completed.

Usually used as `$job->eta->seconds`.

ctime (DateTime)

A DateTime representing the Job's creation date and time.

force (Bool)

Whether to force a Job to be translated, even if a Job with the same body_src already exists.

use_preferred (Bool)

Whether to only allow a "preferred translator" to work this Job.

auto_approve (Bool)

Whether to automatically approve this Job once the translation is completed.

mt (Bool)

Whether the body_tgt was translated via machine translation.

callback_url (Str)

A URL to which events related to this Job should be posted.

captcha_url (Str)

A URL pointing to a captcha image.

This will be set on Jobs in 'reviewable' status and must be submitted when rejecting a Job.

See WebService::MyGengo::Client's `reject_job` method.

preview_url (Str)

A URL pointing to a graphical representation of the translated text.

comment (WebService::MyGengo::Comment|Undef)

This is only here to support the 'comment' option for the constructor.

Returns the most recently-added comment.

comments (Array)

A list of WebService::MyGengo::Comment objects for this Job.

Provides:

fetched_comments - Returns true if comments have been fetched from the API
has_comments - Returns the number of comments in the list
comment_count - Returns the number of comments in the list
get_comment($id) - Returns a specific comment by list index

revisions (Array)

A list of WebService::MyGengo::Revision objects for this Job.

Provides:

fetched_revisions - Returns true if revisions have been fetched from the API
has_revisions - Returns the number of revisions in the list
revision_count - Returns the number of revisions in the list
get_revision($id) - Returns a specific revision by list index

feedback (WebService::MyGengo::Feedback|Undef)

A WebService::MyGengo::Feedback object for this Job.

Provides:

fetched_feedback - Returns true if feedback has been fetched from the API
has_feedback - Returns true if feedback is defined

METHODS

is_(unpaid|available|pending|reviewable|revising|approved|rejected|cancell?ed|held)

Returns true if the Job is of the given status, false otherwise

around to_hash

HACKS: The eta value (a DateTime::Duration) does not stringify to a meaningful value, so we convert it to seconds here.

We also remove the feedback entry.

See: WebService::MyGengo::Base

TODO

 * We really need to make a decision in the immutability of this object.
Is it just pedantic to try and attempt it? We could save time using
mutability. This could affect caching, though.

SEE ALSO

http://mygengo.com/api/developer-docs/methods/translate-job-id-get/

AUTHOR

Nathaniel Heinrichs

LICENSE

Copyright (c) 2011, Nathaniel Heinrichs <nheinric-at-cpan.org>. All rights reserved.

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.