| 1 | # Copyright (C) 2017 Koha-Suomi | ||||||||||
| 2 | # | ||||||||||
| 3 | # This file is part of Pootle-Client. | ||||||||||
| 4 | |||||||||||
| 5 | package Pootle::Resource::TranslationProject; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Modern::Perl '2015'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | binmode STDOUT, ':encoding(UTF-8)'; | |||||||||
| 10 | 1 | binmode STDERR, ':encoding(UTF-8)'; | |||||||||
| 11 | 1 | ▶ | use feature 'signatures'; no warnings "experimental::signatures"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Carp::Always; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Try::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use Scalar::Util qw(blessed); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | =head2 Pootle::Resource::TranslationProject | ||||||||||
| 17 | |||||||||||
| 18 | Pootle object | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | use base('Pootle::Resource'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | use Params::Validate qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | use Pootle::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 1 | my $l = bless({}, 'Pootle::Logger'); #Lazy load package logger this way to avoid circular dependency issues with logger includes from many packages | |||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub new($class, @params) { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 30 | 0 | ▶ | $l->debug("Initializing ".__PACKAGE__." with parameters: ".$l->flatten(@params)) if $l->is_debug(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | my %self = validate(@params, { | |||||||||
| 32 | description => 1, #eg. "" | ||||||||||
| 33 | language => 1, #eg. "/api/v1/languages/110/" | ||||||||||
| 34 | pootle_path => 1, #eg. "/fr/Firefox/" | ||||||||||
| 35 | project => 1, #eg. "/api/v1/projects/3/" | ||||||||||
| 36 | real_path => 1, #eg. "Firefox/fr" | ||||||||||
| 37 | resource_uri => 1, #eg. "/api/v1/translation-projects/65/" | ||||||||||
| 38 | stores => { type => ARRAYREF } , #eg. [ "/api/v1/stores/77/", ... ] | ||||||||||
| 39 | }); | ||||||||||
| 40 | 0 | my $s = bless(\%self, $class); | |||||||||
| 41 | |||||||||||
| 42 | 0 | return $s; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub description($s) { return $s->{description} } | ||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 46 | 0 | ▶ | sub language($s) { return $s->{language} } | ||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | 0 | ▶ | sub pootle_path($s) { return $s->{pootle_path} } | ||||||||
|
Subroutine
pootle_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 0 | ▶ | sub project($s) { return $s->{project} } | ||||||||
|
Subroutine
project: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | 0 | ▶ | sub real_path($s) { return $s->{real_path} } | ||||||||
|
Subroutine
real_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 0 | ▶ | sub resource_uri($s) { return $s->{resource_uri} } | ||||||||
|
Subroutine
resource_uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | ▶ | sub stores($s) { return $s->{stores} } | ||||||||
|
Subroutine
stores: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | |||||||||||
| 53 | =head2 Accessors | ||||||||||
| 54 | |||||||||||
| 55 | =over 4 | ||||||||||
| 56 | |||||||||||
| 57 | =item B<description> | ||||||||||
| 58 | |||||||||||
| 59 | =item B<language> | ||||||||||
| 60 | |||||||||||
| 61 | =item B<pootle_path> | ||||||||||
| 62 | |||||||||||
| 63 | =item B<project> | ||||||||||
| 64 | |||||||||||
| 65 | =item B<real_path> | ||||||||||
| 66 | |||||||||||
| 67 | =item B<resource_uri> | ||||||||||
| 68 | |||||||||||
| 69 | =item B<stores> | ||||||||||
| 70 | |||||||||||
| 71 | =cut | ||||||||||
| 72 | |||||||||||
| 73 | 1 | 1; | |||||||||