| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # Licensed under the Upwork's API Terms of Use; | 
| 2 |  |  |  |  |  |  | # you may not use this file except in compliance with the Terms. | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # Unless required by applicable law or agreed to in writing, software | 
| 5 |  |  |  |  |  |  | # distributed under the License is distributed on an "AS IS" BASIS, | 
| 6 |  |  |  |  |  |  | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 7 |  |  |  |  |  |  | # See the License for the specific language governing permissions and | 
| 8 |  |  |  |  |  |  | # limitations under the License. | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | # Author::    Maksym Novozhylov (mnovozhilov@upwork.com) | 
| 11 |  |  |  |  |  |  | # Copyright:: Copyright 2015(c) Upwork.com | 
| 12 |  |  |  |  |  |  | # License::   See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | package Net::Upwork::API::Routers::Reports::Time; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 1 |  |  | 1 |  | 74563 | use strict; | 
|  | 1 |  |  |  |  | 14 |  | 
|  | 1 |  |  |  |  | 32 |  | 
| 17 | 1 |  |  | 1 |  | 7 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 18 | 1 |  |  | 1 |  | 469 | use parent "Net::Upwork::API"; | 
|  | 1 |  |  |  |  | 384 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 1 |  |  | 1 |  | 126 | use constant ENTRY_POINT => Net::Upwork::API::Client::ENTRY_POINT_GDS; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 539 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =pod | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =head1 NAME | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | Auth | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head1 FUNCTIONS | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =over 4 | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | =item new($api) | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | Create a new object for accessing Auth API | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | B | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | $api | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | API object | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =cut | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub new { | 
| 45 | 0 |  |  | 0 | 1 |  | my ($class, $api) = @_; | 
| 46 | 0 |  |  |  |  |  | return Net::Upwork::API::init_router($class, $api, ENTRY_POINT); | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =item get_by_team_full | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | Generate Time Reports for a Specific Team (with financial info) | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | B | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | $company | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | Company | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | $team | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | Team | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | B | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | JSON response as a string | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =cut | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | sub get_by_team_full { | 
| 70 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 71 | 0 |  |  |  |  |  | my $company = shift; | 
| 72 | 0 |  |  |  |  |  | my $team = shift; | 
| 73 | 0 |  |  |  |  |  | my %params = @_; | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 0 |  |  |  |  |  | return $self->get_by_type($company, $team, "", 0, %params); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =item get_by_team_limited | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | Generate Time Reports for a Specific Team (hide financial info) | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | B | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | $company | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | Company | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | $team | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | Team | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | B | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | JSON response as a string | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =cut | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | sub get_by_team_limited { | 
| 99 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 100 | 0 |  |  |  |  |  | my $company = shift; | 
| 101 | 0 |  |  |  |  |  | my $team = shift; | 
| 102 | 0 |  |  |  |  |  | my %params = @_; | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 0 |  |  |  |  |  | return $self->get_by_type($company, $team, "", 1, %params); | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =item get_by_agency | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | Generating Agency Specific Reports | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | B | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | $company | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | Company | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | $agency | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | Agency | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | B | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | JSON response as a string | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =cut | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | sub get_by_agency { | 
| 128 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 129 | 0 |  |  |  |  |  | my $company = shift; | 
| 130 | 0 |  |  |  |  |  | my $agency = shift; | 
| 131 | 0 |  |  |  |  |  | my %params = @_; | 
| 132 |  |  |  |  |  |  |  | 
| 133 | 0 |  |  |  |  |  | return $self->get_by_type($company, "", $agency, 0, %params); | 
| 134 |  |  |  |  |  |  | } | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =item get_by_company | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | Generating Company Wide Reports | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | B | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | $company | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | Company | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | B | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | JSON response as a string | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =cut | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | sub get_by_company { | 
| 153 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 154 | 0 |  |  |  |  |  | my $company = shift; | 
| 155 | 0 |  |  |  |  |  | my %params = @_; | 
| 156 |  |  |  |  |  |  |  | 
| 157 | 0 |  |  |  |  |  | return $self->get_by_type($company, "", "", 0, %params); | 
| 158 |  |  |  |  |  |  | } | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =item get_by_freelancer_limited | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | Generating Freelancer's Specific Reports (hide financial info) | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | B | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | $freelancer_id | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | Freelancer ID | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | B | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | JSON response as a string | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | =cut | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | sub get_by_freelancer_limited { | 
| 177 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 178 | 0 |  |  |  |  |  | my $freelancer_id = shift; | 
| 179 | 0 |  |  |  |  |  | my %params = @_; | 
| 180 |  |  |  |  |  |  |  | 
| 181 | 0 |  |  |  |  |  | return $self->client()->get("/timereports/v1/providers/" . $freelancer_id . "/hours", %params); | 
| 182 |  |  |  |  |  |  | } | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =item get_by_freelancer_full | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | Generating Freelancer's Specific Reports (with financial info) | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | B | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | $freelancer_id | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | Freelancer ID | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | B | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | JSON response as a string | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | =cut | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | sub get_by_freelancer_full { | 
| 201 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 202 | 0 |  |  |  |  |  | my $freelancer_id = shift; | 
| 203 | 0 |  |  |  |  |  | my %params = @_; | 
| 204 |  |  |  |  |  |  |  | 
| 205 | 0 |  |  |  |  |  | return $self->client()->get("/timereports/v1/providers/" . $freelancer_id, %params); | 
| 206 |  |  |  |  |  |  | } | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | =item get_by_type | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | Get by type | 
| 211 |  |  |  |  |  |  |  | 
| 212 |  |  |  |  |  |  | B | 
| 213 |  |  |  |  |  |  |  | 
| 214 |  |  |  |  |  |  | $company | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | Company | 
| 217 |  |  |  |  |  |  |  | 
| 218 |  |  |  |  |  |  | $team | 
| 219 |  |  |  |  |  |  |  | 
| 220 |  |  |  |  |  |  | Team | 
| 221 |  |  |  |  |  |  |  | 
| 222 |  |  |  |  |  |  | $agency | 
| 223 |  |  |  |  |  |  |  | 
| 224 |  |  |  |  |  |  | Agency | 
| 225 |  |  |  |  |  |  |  | 
| 226 |  |  |  |  |  |  | $hide_fin_data | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | Hide financial data flag | 
| 229 |  |  |  |  |  |  |  | 
| 230 |  |  |  |  |  |  | $params | 
| 231 |  |  |  |  |  |  |  | 
| 232 |  |  |  |  |  |  | Hash of parameters | 
| 233 |  |  |  |  |  |  |  | 
| 234 |  |  |  |  |  |  | B | 
| 235 |  |  |  |  |  |  |  | 
| 236 |  |  |  |  |  |  | String | 
| 237 |  |  |  |  |  |  |  | 
| 238 |  |  |  |  |  |  | =cut | 
| 239 |  |  |  |  |  |  |  | 
| 240 |  |  |  |  |  |  | sub get_by_type { | 
| 241 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 242 | 0 |  |  |  |  |  | my $company = shift; | 
| 243 | 0 |  |  |  |  |  | my $team = shift; | 
| 244 | 0 |  |  |  |  |  | my $agency = shift; | 
| 245 | 0 |  |  |  |  |  | my $hide_fin_data = shift; | 
| 246 | 0 |  |  |  |  |  | my %params = @_; | 
| 247 |  |  |  |  |  |  |  | 
| 248 | 0 |  |  |  |  |  | my $url = ""; | 
| 249 | 0 | 0 |  |  |  |  | if (length $team) { | 
| 250 | 0 |  |  |  |  |  | $url = "/teams/" . $team; | 
| 251 | 0 | 0 |  |  |  |  | if ($hide_fin_data) { | 
|  |  | 0 |  |  |  |  |  | 
| 252 | 0 |  |  |  |  |  | $url .= "/hours"; | 
| 253 |  |  |  |  |  |  | } elsif (length $agency) { | 
| 254 | 0 |  |  |  |  |  | $url = "/agencies/" . $agency; | 
| 255 |  |  |  |  |  |  | } | 
| 256 |  |  |  |  |  |  | } | 
| 257 |  |  |  |  |  |  |  | 
| 258 | 0 |  |  |  |  |  | return $self->client()->get("/timereports/v1/companies/" . $company . $url, %params); | 
| 259 |  |  |  |  |  |  | } | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | =back | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | =head1 AUTHOR | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  | Maksym Novozhylov C<<  >> | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 268 |  |  |  |  |  |  |  | 
| 269 |  |  |  |  |  |  | Copyright E Upwork Global Corp., 2015 | 
| 270 |  |  |  |  |  |  |  | 
| 271 |  |  |  |  |  |  | =cut | 
| 272 |  |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | 1; |