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,49 @@
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
+ # Roles
19
+ class Roles
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 user roles
32
+ def get_all
33
+ $LOG.i "running " + __method__.to_s
34
+ @client.get '/hr/v2/userroles'
35
+ end
36
+
37
+ # Get by specific user
38
+ #
39
+ # Arguments:
40
+ # reference: (String)
41
+ def get_by_specific_user(user_reference)
42
+ $LOG.i "running " + __method__.to_s
43
+ @client.get '/hr/v2/userroles/' + user_reference
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,63 @@
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
+ # 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
@@ -0,0 +1,43 @@
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 Jobs
18
+ # Freelancer's profile info
19
+ class Profile
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 specific profile
32
+ #
33
+ # Arguments:
34
+ # key: (String)
35
+ def get_specific(key)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/profiles/v1/jobs/' + key
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
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 Jobs
18
+ # Search Job profiles
19
+ class Search
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
+ # Search profiles
32
+ #
33
+ # Arguments:
34
+ # params: (Hash)
35
+ def find(params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/profiles/v2/search/jobs', params
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,113 @@
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
+ class Mc
18
+ ENTRY_POINT = 'api'
19
+
20
+ # Init
21
+ #
22
+ # Arguments:
23
+ # client: (Client)
24
+ def initialize(client)
25
+ @client = client
26
+ @client.epoint = ENTRY_POINT
27
+ end
28
+
29
+ # Get trays
30
+ def get_trays
31
+ $LOG.i "running " + __method__.to_s
32
+ @client.get '/mc/v1/trays'
33
+ end
34
+
35
+ # Get tray by type
36
+ #
37
+ # Arguments:
38
+ # username: (String)
39
+ # type: (String)
40
+ def get_tray_by_type(username, type)
41
+ $LOG.i "running " + __method__.to_s
42
+ @client.get '/mc/v1/trays/' + username + '/' + type
43
+ end
44
+
45
+ # List thread details based on thread id
46
+ #
47
+ # Arguments:
48
+ # username: (String)
49
+ # thread_id: (String)
50
+ def get_thread_details(username, thread_id)
51
+ $LOG.i "running " + __method__.to_s
52
+ @client.get '/mc/v1/threads/' + username + '/' + thread_id
53
+ end
54
+
55
+ # Get a specific thread by context
56
+ #
57
+ # Arguments:
58
+ # username: (String)
59
+ # job_key: (String)
60
+ # application_id: (String)
61
+ # context: (String)
62
+ def get_thread_by_context(username, job_key, application_id, context = 'Interviews')
63
+ $LOG.i "running " + __method__.to_s
64
+ @client.get '/mc/v1/contexts/' + username + '/' + context + ':' + job_key + ':' + application_id
65
+ end
66
+
67
+ # Get a specific thread by context (last message content)
68
+ #
69
+ # Arguments:
70
+ # username: (String)
71
+ # job_key: (String)
72
+ # application_id: (String)
73
+ # context: (String)
74
+ def get_thread_by_context_last_posts(username, job_key, application_id, context = 'Interviews')
75
+ $LOG.i "running " + __method__.to_s
76
+ @client.get '/mc/v1/contexts/' + username + '/' + context + ':' + job_key + ':' + application_id + '/last_posts'
77
+ end
78
+
79
+ # Send new message
80
+ #
81
+ # Arguments:
82
+ # username: (String)
83
+ # params: (Hash)
84
+ def start_new_thread(username, params = {})
85
+ $LOG.i "running " + __method__.to_s
86
+ @client.post '/mc/v1/threads/' + username, params
87
+ end
88
+
89
+ # Reply to existent thread
90
+ #
91
+ # Arguments:
92
+ # username: (String)
93
+ # thread_id: (String)
94
+ # params: (Hash)
95
+ def reply_to_thread(username, thread_id, params = {})
96
+ $LOG.i "running " + __method__.to_s
97
+ @client.post '/mc/v1/threads/' + username + '/' + thread_id, params
98
+ end
99
+
100
+ # Update threads based on user actions
101
+ #
102
+ # Arguments:
103
+ # username: (String)
104
+ # thread_id: (String)
105
+ # params: (Hash)
106
+ def mark_thread(username, thread_id, params = {})
107
+ $LOG.i "running " + __method__.to_s
108
+ @client.put '/mc/v1/threads/' + username + '/' + thread_id, params
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,71 @@
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
+ # Get Metadata
18
+ class Metadata
19
+ ENTRY_POINT = 'api'
20
+
21
+ # Init
22
+ #
23
+ # Arguments:
24
+ # client: (Client)
25
+ def initialize(client)
26
+ @client = client
27
+ @client.epoint = ENTRY_POINT
28
+ end
29
+
30
+ # Get categories
31
+ def get_categories
32
+ $LOG.i "running " + __method__.to_s
33
+ @client.get '/profiles/v1/metadata/categories'
34
+ end
35
+
36
+ # Get categories (v2)
37
+ def get_categories_v2
38
+ $LOG.i "running " + __method__.to_s
39
+ @client.get '/profiles/v2/metadata/categories'
40
+ end
41
+
42
+ # Get skills
43
+ def get_skills
44
+ $LOG.i "running " + __method__.to_s
45
+ @client.get '/profiles/v1/metadata/skills'
46
+ end
47
+
48
+ # Get regions
49
+ def get_regions
50
+ $LOG.i "running " + __method__.to_s
51
+ @client.get '/profiles/v1/metadata/regions'
52
+ end
53
+
54
+ # Get tests
55
+ def get_tests
56
+ $LOG.i "running " + __method__.to_s
57
+ @client.get '/profiles/v1/metadata/tests'
58
+ end
59
+
60
+ # Get reasons
61
+ #
62
+ # Arguments:
63
+ # params: (Hash)
64
+ def get_reasons(params)
65
+ $LOG.i "running " + __method__.to_s
66
+ @client.get '/profiles/v1/metadata/reasons', params;
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,67 @@
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 Organization
18
+ # Companies inside Organization
19
+ class Companies
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 Companies Info
32
+ def get_list
33
+ $LOG.i "running " + __method__.to_s
34
+ @client.get '/hr/v2/companies'
35
+ end
36
+
37
+ # Get Specific Company
38
+ #
39
+ # Arguments:
40
+ # company_reference: (String)
41
+ def get_specific(company_reference)
42
+ $LOG.i "running " + __method__.to_s
43
+ @client.get '/hr/v2/companies/' + company_reference
44
+ end
45
+
46
+ # Get Teams in Company
47
+ #
48
+ # Arguments:
49
+ # company_reference: (String)
50
+ def get_teams(company_reference)
51
+ $LOG.i "running " + __method__.to_s
52
+ @client.get '/hr/v2/companies/' + company_reference + '/teams'
53
+ end
54
+
55
+ # Get Users in Company
56
+ #
57
+ # Arguments:
58
+ # company_reference: (String)
59
+ def get_users(company_reference)
60
+ $LOG.i "running " + __method__.to_s
61
+ @client.get '/hr/v2/companies/' + company_reference + '/users'
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end