odesk-api 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,100 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - https://developers.odesk.com/api-tos.html
|
13
|
+
|
14
|
+
module Odesk
|
15
|
+
module Api
|
16
|
+
module Routers
|
17
|
+
module Hr
|
18
|
+
# Milestones workflow
|
19
|
+
class Milestones
|
20
|
+
ENTRY_POINT = 'api'
|
21
|
+
|
22
|
+
# Init
|
23
|
+
#
|
24
|
+
# Arguments:
|
25
|
+
# client: (Client)
|
26
|
+
def initialize(client)
|
27
|
+
@client = client
|
28
|
+
@client.epoint = ENTRY_POINT
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get active Milestone for specific Contract
|
32
|
+
#
|
33
|
+
# Arguments:
|
34
|
+
# contract_id: (String)
|
35
|
+
def get_active_milestone(contract_id)
|
36
|
+
$LOG.i "running " + __method__.to_s
|
37
|
+
@client.get '/hr/v3/fp/milestones/statuses/active/contracts/' + contract_id
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get active Milestone for specific Contract
|
41
|
+
#
|
42
|
+
# Arguments:
|
43
|
+
# milestone_id: (String)
|
44
|
+
def get_submissions(milestone_id)
|
45
|
+
$LOG.i "running " + __method__.to_s
|
46
|
+
@client.get '/hr/v3/fp/milestones/' + milestone_id + '/submissions'
|
47
|
+
end
|
48
|
+
|
49
|
+
# Create a new Milestone
|
50
|
+
#
|
51
|
+
# Arguments:
|
52
|
+
# params: (Hash)
|
53
|
+
def create(params)
|
54
|
+
$LOG.i "running " + __method__.to_s
|
55
|
+
@client.post '/hr/v3/fp/milestones', params
|
56
|
+
end
|
57
|
+
|
58
|
+
# Edit an existing Milestone
|
59
|
+
#
|
60
|
+
# Arguments:
|
61
|
+
# milestone_id: (String)
|
62
|
+
# params: (Hash)
|
63
|
+
def edit(milestone_id, params)
|
64
|
+
$LOG.i "running " + __method__.to_s
|
65
|
+
@client.put '/hr/v3/fp/milestones/' + milestone_id, params
|
66
|
+
end
|
67
|
+
|
68
|
+
# Activate an existing Milestone
|
69
|
+
#
|
70
|
+
# Arguments:
|
71
|
+
# milestone_id: (String)
|
72
|
+
# params: (Hash)
|
73
|
+
def activate(milestone_id, params)
|
74
|
+
$LOG.i "running " + __method__.to_s
|
75
|
+
@client.put '/hr/v3/fp/milestones/' + milestone_id + '/activate', params
|
76
|
+
end
|
77
|
+
|
78
|
+
# Approve an existing Milestone
|
79
|
+
#
|
80
|
+
# Arguments:
|
81
|
+
# milestone_id: (String)
|
82
|
+
# params: (Hash)
|
83
|
+
def approve(milestone_id, params)
|
84
|
+
$LOG.i "running " + __method__.to_s
|
85
|
+
@client.put '/hr/v3/fp/milestones/' + milestone_id + '/approve', params
|
86
|
+
end
|
87
|
+
|
88
|
+
# Delete an existing Milestone
|
89
|
+
#
|
90
|
+
# Arguments:
|
91
|
+
# milestone_id: (String)
|
92
|
+
def delete(milestone_id)
|
93
|
+
$LOG.i "running " + __method__.to_s
|
94
|
+
@client.delete '/hr/v3/fp/milestones/' + milestone_id
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - https://developers.odesk.com/api-tos.html
|
13
|
+
|
14
|
+
module Odesk
|
15
|
+
module Api
|
16
|
+
module Routers
|
17
|
+
module Hr
|
18
|
+
# Submissions workflow
|
19
|
+
class Submissions
|
20
|
+
ENTRY_POINT = 'api'
|
21
|
+
|
22
|
+
# Init
|
23
|
+
#
|
24
|
+
# Arguments:
|
25
|
+
# client: (Client)
|
26
|
+
def initialize(client)
|
27
|
+
@client = client
|
28
|
+
@client.epoint = ENTRY_POINT
|
29
|
+
end
|
30
|
+
|
31
|
+
# Freelancer submits work for the client to approve
|
32
|
+
#
|
33
|
+
# Arguments:
|
34
|
+
# params: (Hash)
|
35
|
+
def request_approval(params)
|
36
|
+
$LOG.i "running " + __method__.to_s
|
37
|
+
@client.post '/hr/v3/fp/submissions', params
|
38
|
+
end
|
39
|
+
|
40
|
+
# Approve an existing Submission
|
41
|
+
#
|
42
|
+
# Arguments:
|
43
|
+
# submission_id: (String)
|
44
|
+
# params: (Hash)
|
45
|
+
def approve(submission_id, params)
|
46
|
+
$LOG.i "running " + __method__.to_s
|
47
|
+
@client.put '/hr/v3/fp/submissions/' + submission_id + '/approve', params
|
48
|
+
end
|
49
|
+
|
50
|
+
# Reject an existing Submission
|
51
|
+
#
|
52
|
+
# Arguments:
|
53
|
+
# submission_id: (String)
|
54
|
+
# params: (Hash)
|
55
|
+
def reject(submission_id, params)
|
56
|
+
$LOG.i "running " + __method__.to_s
|
57
|
+
@client.put '/hr/v3/fp/submissions/' + submission_id + '/reject', params
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/odesk/api/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'helper'
|
5
|
+
require 'odesk/api/routers/hr/milestones'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'mocha/test_unit'
|
8
|
+
|
9
|
+
class HrMilestonesTest < Test::Unit::TestCase
|
10
|
+
include TestHelper
|
11
|
+
|
12
|
+
def test_get_active_milestone
|
13
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
14
|
+
assert api.get_active_milestone('1234')
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_submissions
|
18
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
19
|
+
assert api.get_submissions('1234')
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_create
|
23
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
24
|
+
assert api.create({})
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_edit
|
28
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
29
|
+
assert api.edit('1234', {})
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_activate
|
33
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
34
|
+
assert api.activate('1234', {})
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_approve
|
38
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
39
|
+
assert api.approve('1234', {})
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_delete
|
43
|
+
api = Odesk::Api::Routers::Hr::Milestones.new(get_client_mock)
|
44
|
+
assert api.delete('1234')
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'helper'
|
5
|
+
require 'odesk/api/routers/hr/submissions'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'mocha/test_unit'
|
8
|
+
|
9
|
+
class HrSubmissionsTest < Test::Unit::TestCase
|
10
|
+
include TestHelper
|
11
|
+
|
12
|
+
def test_request_approval
|
13
|
+
api = Odesk::Api::Routers::Hr::Submissions.new(get_client_mock)
|
14
|
+
assert api.request_approval({})
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_approve
|
18
|
+
api = Odesk::Api::Routers::Hr::Submissions.new(get_client_mock)
|
19
|
+
assert api.approve('1234', {})
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_reject
|
23
|
+
api = Odesk::Api::Routers::Hr::Submissions.new(get_client_mock)
|
24
|
+
assert api.reject('1234', {})
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odesk-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|
@@ -123,7 +123,9 @@ files:
|
|
123
123
|
- lib/odesk/api/routers/hr/freelancers/offers.rb
|
124
124
|
- lib/odesk/api/routers/hr/interviews.rb
|
125
125
|
- lib/odesk/api/routers/hr/jobs.rb
|
126
|
+
- lib/odesk/api/routers/hr/milestones.rb
|
126
127
|
- lib/odesk/api/routers/hr/roles.rb
|
128
|
+
- lib/odesk/api/routers/hr/submissions.rb
|
127
129
|
- lib/odesk/api/routers/jobs/profile.rb
|
128
130
|
- lib/odesk/api/routers/jobs/search.rb
|
129
131
|
- lib/odesk/api/routers/mc.rb
|
@@ -157,7 +159,9 @@ files:
|
|
157
159
|
- test/test_hr_freelancers_offers.rb
|
158
160
|
- test/test_hr_interviews.rb
|
159
161
|
- test/test_hr_jobs.rb
|
162
|
+
- test/test_hr_milestones.rb
|
160
163
|
- test/test_hr_roles.rb
|
164
|
+
- test/test_hr_submissions.rb
|
161
165
|
- test/test_jobs_profile.rb
|
162
166
|
- test/test_jobs_search.rb
|
163
167
|
- test/test_logger.rb
|
@@ -216,7 +220,9 @@ test_files:
|
|
216
220
|
- test/test_hr_freelancers_offers.rb
|
217
221
|
- test/test_hr_interviews.rb
|
218
222
|
- test/test_hr_jobs.rb
|
223
|
+
- test/test_hr_milestones.rb
|
219
224
|
- test/test_hr_roles.rb
|
225
|
+
- test/test_hr_submissions.rb
|
220
226
|
- test/test_jobs_profile.rb
|
221
227
|
- test/test_jobs_search.rb
|
222
228
|
- test/test_logger.rb
|