upwork-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.docgen +1 -0
  2. data/.gitignore +22 -0
  3. data/.travis.yml +16 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +176 -0
  6. data/README.md +79 -0
  7. data/Rakefile +12 -0
  8. data/example/myapp.rb +59 -0
  9. data/lib/upwork/api.rb +29 -0
  10. data/lib/upwork/api/client.rb +163 -0
  11. data/lib/upwork/api/config.rb +42 -0
  12. data/lib/upwork/api/logger.rb +35 -0
  13. data/lib/upwork/api/routers/activities/engagement.rb +54 -0
  14. data/lib/upwork/api/routers/activities/team.rb +117 -0
  15. data/lib/upwork/api/routers/auth.rb +38 -0
  16. data/lib/upwork/api/routers/freelancers/profile.rb +52 -0
  17. data/lib/upwork/api/routers/freelancers/search.rb +43 -0
  18. data/lib/upwork/api/routers/hr/clients/applications.rb +55 -0
  19. data/lib/upwork/api/routers/hr/clients/offers.rb +64 -0
  20. data/lib/upwork/api/routers/hr/contracts.rb +64 -0
  21. data/lib/upwork/api/routers/hr/engagements.rb +52 -0
  22. data/lib/upwork/api/routers/hr/freelancers/applications.rb +54 -0
  23. data/lib/upwork/api/routers/hr/freelancers/offers.rb +64 -0
  24. data/lib/upwork/api/routers/hr/interviews.rb +44 -0
  25. data/lib/upwork/api/routers/hr/jobs.rb +79 -0
  26. data/lib/upwork/api/routers/hr/milestones.rb +100 -0
  27. data/lib/upwork/api/routers/hr/roles.rb +49 -0
  28. data/lib/upwork/api/routers/hr/submissions.rb +63 -0
  29. data/lib/upwork/api/routers/jobs/profile.rb +43 -0
  30. data/lib/upwork/api/routers/jobs/search.rb +43 -0
  31. data/lib/upwork/api/routers/mc.rb +113 -0
  32. data/lib/upwork/api/routers/metadata.rb +71 -0
  33. data/lib/upwork/api/routers/organization/companies.rb +67 -0
  34. data/lib/upwork/api/routers/organization/teams.rb +49 -0
  35. data/lib/upwork/api/routers/organization/users.rb +49 -0
  36. data/lib/upwork/api/routers/payments.rb +42 -0
  37. data/lib/upwork/api/routers/reports/finance/accounts.rb +56 -0
  38. data/lib/upwork/api/routers/reports/finance/billings.rb +86 -0
  39. data/lib/upwork/api/routers/reports/finance/earnings.rb +86 -0
  40. data/lib/upwork/api/routers/reports/time.rb +114 -0
  41. data/lib/upwork/api/routers/snapshot.rb +95 -0
  42. data/lib/upwork/api/routers/teams.rb +47 -0
  43. data/lib/upwork/api/routers/workdiary.rb +53 -0
  44. data/lib/upwork/api/version.rb +18 -0
  45. data/test/helper.rb +21 -0
  46. data/test/test_activities_engagement.rb +21 -0
  47. data/test/test_activities_team.rb +46 -0
  48. data/test/test_auth.rb +16 -0
  49. data/test/test_client.rb +47 -0
  50. data/test/test_config.rb +25 -0
  51. data/test/test_freelancers_profile.rb +22 -0
  52. data/test/test_freelancers_search.rb +16 -0
  53. data/test/test_hr_clients_applications.rb +21 -0
  54. data/test/test_hr_clients_offers.rb +26 -0
  55. data/test/test_hr_contracts.rb +26 -0
  56. data/test/test_hr_engagements.rb +21 -0
  57. data/test/test_hr_freelancers_applications.rb +21 -0
  58. data/test/test_hr_freelancers_offers.rb +26 -0
  59. data/test/test_hr_interviews.rb +16 -0
  60. data/test/test_hr_jobs.rb +36 -0
  61. data/test/test_hr_milestones.rb +46 -0
  62. data/test/test_hr_roles.rb +21 -0
  63. data/test/test_hr_submissions.rb +26 -0
  64. data/test/test_jobs_profile.rb +16 -0
  65. data/test/test_jobs_search.rb +16 -0
  66. data/test/test_logger.rb +15 -0
  67. data/test/test_mc.rb +51 -0
  68. data/test/test_metadata.rb +41 -0
  69. data/test/test_organization_companies.rb +31 -0
  70. data/test/test_organization_teams.rb +21 -0
  71. data/test/test_organization_users.rb +21 -0
  72. data/test/test_payments.rb +16 -0
  73. data/test/test_reports_finance_accounts.rb +21 -0
  74. data/test/test_reports_finance_billings.rb +36 -0
  75. data/test/test_reports_finance_earnings.rb +36 -0
  76. data/test/test_reports_time.rb +41 -0
  77. data/test/test_snapshot.rb +41 -0
  78. data/test/test_teams.rb +21 -0
  79. data/test/test_workdiary.rb +21 -0
  80. data/upwork-api.gemspec +27 -0
  81. metadata +242 -0
@@ -0,0 +1,64 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ # Contracts API
19
+ class Contracts
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
+ # Suspend Contract
32
+ #
33
+ # Arguments:
34
+ # reference: (String)
35
+ # params: (Hash)
36
+ def suspend_contract(reference, params)
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.put '/hr/v2/contracts/' + reference + '/suspend', params
39
+ end
40
+
41
+ # Restart Contract
42
+ #
43
+ # Arguments:
44
+ # reference: (String)
45
+ # params: (Hash)
46
+ def restart_contract(reference, params)
47
+ $LOG.i "running " + __method__.to_s
48
+ @client.put '/hr/v2/contracts/' + reference + '/restart', params
49
+ end
50
+
51
+ # End Contract
52
+ #
53
+ # Arguments:
54
+ # reference: (String)
55
+ # params: (Hash)
56
+ def end_contract(reference, params)
57
+ $LOG.i "running " + __method__.to_s
58
+ @client.delete '/hr/v2/contracts/' + reference, params
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,52 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ # Engagements API
19
+ class Engagements
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 list of engagements
32
+ #
33
+ # Arguments:
34
+ # params: (Hash)
35
+ def get_list(params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/hr/v2/engagements', params
38
+ end
39
+
40
+ # Get specific engagement
41
+ #
42
+ # Arguments:
43
+ # reference: (String)
44
+ def get_specific(reference)
45
+ $LOG.i "running " + __method__.to_s
46
+ @client.get '/hr/v2/engagements/' + reference
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,54 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ module Freelancers
19
+ # Freelancer Job Applications API
20
+ class Applications
21
+ ENTRY_POINT = 'api'
22
+
23
+ # Init
24
+ #
25
+ # Arguments:
26
+ # client: (Client)
27
+ def initialize(client)
28
+ @client = client
29
+ @client.epoint = ENTRY_POINT
30
+ end
31
+
32
+ # Get list of applications
33
+ #
34
+ # Arguments:
35
+ # params: (Hash)
36
+ def get_list(params = {})
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.get '/hr/v3/contractors/applications', params
39
+ end
40
+
41
+ # Get specific application
42
+ #
43
+ # Arguments:
44
+ # reference: (String)
45
+ def get_specific(reference)
46
+ $LOG.i "running " + __method__.to_s
47
+ @client.get '/hr/v3/contractors/applications' + reference
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,64 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ module Freelancers
19
+ # Freelancers Job Offers API
20
+ class Offers
21
+ ENTRY_POINT = 'api'
22
+
23
+ # Init
24
+ #
25
+ # Arguments:
26
+ # client: (Client)
27
+ def initialize(client)
28
+ @client = client
29
+ @client.epoint = ENTRY_POINT
30
+ end
31
+
32
+ # Get list of offers
33
+ #
34
+ # Arguments:
35
+ # params: (Hash)
36
+ def get_list(params = {})
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.get '/offers/v1/contractors/offers', params
39
+ end
40
+
41
+ # Get specific offer
42
+ #
43
+ # Arguments:
44
+ # reference: (String)
45
+ def get_specific(reference)
46
+ $LOG.i "running " + __method__.to_s
47
+ @client.get '/offers/v1/clients/offers/' + reference
48
+ end
49
+
50
+ # Get specific offer
51
+ #
52
+ # Arguments:
53
+ # reference: (String)
54
+ # params: (Hash)
55
+ def actions(reference, params)
56
+ $LOG.i "running " + __method__.to_s
57
+ @client.post '/offers/v1/clients/actions/' + reference, params
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,44 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ # Interviews workflow
19
+ class Interviews
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
+ # Invite to Interview
32
+ #
33
+ # Arguments:
34
+ # job_key: (String)
35
+ # params: (Hash)
36
+ def invite(job_key, params)
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.post '/hr/v1/jobs/' + job_key + '/candidates', params
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,79 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
15
+ module Api
16
+ module Routers
17
+ module Hr
18
+ # Jobs API
19
+ class Jobs
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 list of jobs
32
+ #
33
+ # Arguments:
34
+ # params: (Hash)
35
+ def get_list(params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/hr/v2/jobs', params
38
+ end
39
+
40
+ # Get specific job by key
41
+ #
42
+ # Arguments:
43
+ # key: (String)
44
+ def get_specific(key)
45
+ $LOG.i "running " + __method__.to_s
46
+ @client.get '/hr/v2/jobs/' + key
47
+ end
48
+
49
+ # Post a new job
50
+ #
51
+ # Arguments:
52
+ # params: (Hash)
53
+ def post_job(params)
54
+ $LOG.i "running " + __method__.to_s
55
+ @client.post '/hr/v2/jobs', params
56
+ end
57
+
58
+ # Edit existent job
59
+ #
60
+ # Arguments:
61
+ # params: (Hash)
62
+ def edit_job(key, params)
63
+ $LOG.i "running " + __method__.to_s
64
+ @client.put '/hr/v2/jobs/' + key, params
65
+ end
66
+
67
+ # Delete existent job
68
+ #
69
+ # Arguments:
70
+ # params: (Hash)
71
+ def delete_job(key, params)
72
+ $LOG.i "running " + __method__.to_s
73
+ @client.delete '/hr/v2/jobs/' + key, params
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,100 @@
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 2014(c) Upwork.com
12
+ # License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
13
+
14
+ module Upwork
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