File Coverage

lib/Net/Upwork/API/Routers/Hr/Milestones.pm
Criterion Covered Total %
statement 12 38 31.5
branch n/a
condition n/a
subroutine 4 12 33.3
pod 8 8 100.0
total 24 58 41.3


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::Hr::Milestones;
15              
16 2     2   71466 use strict;
  2         11  
  2         67  
17 2     2   10 use warnings;
  2         2  
  2         69  
18 2     2   431 use parent "Net::Upwork::API";
  2         295  
  2         10  
19              
20 2     2   167 use constant ENTRY_POINT => Net::Upwork::API::Client::ENTRY_POINT_API;
  2         4  
  2         906  
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_active_milestone
50              
51             Get active Milestone for specific Contract
52              
53             B
54              
55             $contract_id
56              
57             Contract ID
58              
59             B
60              
61             JSON response as a string
62              
63             =cut
64              
65             sub get_active_milestone {
66 0     0 1   my $self = shift;
67 0           my $contract_id = shift;
68              
69 0           return $self->client()->get("/hr/v3/fp/milestones/statuses/active/contracts/" . $contract_id);
70             }
71              
72             =item get_submissions
73              
74             Get active Milestone for specific Contract
75              
76             B
77              
78             $milestone_id
79              
80             Milestone ID
81              
82             B
83              
84             JSON response as a string
85              
86             =cut
87              
88             sub get_submissions {
89 0     0 1   my $self = shift;
90 0           my $milestone_id = shift;
91              
92 0           return $self->client()->get("/hr/v3/fp/milestones/" . $milestone_id . "/submissions");
93             }
94              
95             =item create
96              
97             Create a new Milestone
98              
99             B
100              
101             $params
102              
103             Hash of parameters
104              
105             B
106              
107             JSON response as a string
108              
109             =cut
110              
111             sub create {
112 0     0 1   my $self = shift;
113 0           my %params = @_;
114              
115 0           return $self->client()->post("/hr/v3/fp/milestones", %params);
116             }
117              
118             =item edit
119              
120             Edit an existing Milestone
121              
122             B
123              
124             $milestone_id
125              
126             Milestone ID
127              
128             $params
129              
130             Hash of parameters
131              
132             B
133              
134             JSON response as a string
135              
136             =cut
137              
138             sub edit {
139 0     0 1   my $self = shift;
140 0           my $milestone_id = shift;
141 0           my %params = @_;
142              
143 0           return $self->client()->put("/hr/v3/fp/milestones/" . $milestone_id, %params);
144             }
145              
146             =item activate
147              
148             Activate an existing Milestone
149              
150             B
151              
152             $milestone_id
153              
154             Milestone ID
155              
156             $params
157              
158             Hash of parameters
159              
160             B
161              
162             JSON response as a string
163              
164             =cut
165              
166             sub activate {
167 0     0 1   my $self = shift;
168 0           my $milestone_id = shift;
169 0           my %params = @_;
170              
171 0           return $self->client()->put("/hr/v3/fp/milestones/" . $milestone_id . "/activate", %params);
172             }
173              
174             =item approve
175              
176             Approve an existing Milestone
177              
178             B
179              
180             $milestone_id
181              
182             Milestone ID
183              
184             $params
185              
186             Hash of parameters
187              
188             B
189              
190             JSON response as a string
191              
192             =cut
193              
194             sub approve {
195 0     0 1   my $self = shift;
196 0           my $milestone_id = shift;
197 0           my %params = @_;
198              
199 0           return $self->client()->put("/hr/v3/fp/milestones/" . $milestone_id . "/approve", %params);
200             }
201              
202             =item delete
203              
204             Delete existent milestone
205              
206             B
207              
208             $milestone_id
209              
210             Milestone ID
211              
212             B
213              
214             JSON response as a string
215              
216             =cut
217              
218             sub delete {
219 0     0 1   my $self = shift;
220 0           my $milestone_id = shift;
221              
222 0           return $self->client()->delete("/hr/v3/fp/milestones/" . $milestone_id);
223             }
224              
225             =back
226              
227             =head1 AUTHOR
228              
229             Maksym Novozhylov C<< >>
230              
231             =head1 COPYRIGHT
232              
233             Copyright E Upwork Global Corp., 2015
234              
235             =cut
236              
237             1;