upwork-api 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 Organization
18
+ # Teams inside Organization
19
+ class Teams
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 Teams info
32
+ def get_list
33
+ $LOG.i "running " + __method__.to_s
34
+ @client.get '/hr/v2/teams'
35
+ end
36
+
37
+ # Get Users in Team
38
+ #
39
+ # Arguments:
40
+ # team_reference: (String)
41
+ def get_users_in_team(team_reference)
42
+ $LOG.i "running " + __method__.to_s
43
+ @client.get '/hr/v2/teams/' + team_reference + '/users'
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -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 Organization
18
+ # Users inside Organization
19
+ class Users
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 Auth User Info
32
+ def get_my_info
33
+ $LOG.i "running " + __method__.to_s
34
+ @client.get '/hr/v2/users/me'
35
+ end
36
+
37
+ # Get Specific User Info
38
+ #
39
+ # Arguments:
40
+ # user_reference: (String)
41
+ def get_specific(user_reference)
42
+ $LOG.i "running " + __method__.to_s
43
+ @client.get '/hr/v2/users/' + user_reference
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,42 @@
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
+ # Custom Payments
18
+ class Payments
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
+ # Submit bonus
31
+ #
32
+ # Arguments:
33
+ # team_reference: (String)
34
+ # params: (Hash)
35
+ def submit_bonus(team_reference, params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.post '/hr/v2/teams/' + team_reference + '/adjustments', params
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,56 @@
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 Reports
18
+ module Finance
19
+ # Generate Financial Reports for Accounts
20
+ class Accounts
21
+ ENTRY_POINT = 'gds'
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
+ # Generate Financial Reports for an owned Account
33
+ #
34
+ # Arguments:
35
+ # freelancer_reference: (String)
36
+ # params: (Hash)
37
+ def get_owned(freelancer_reference, params)
38
+ $LOG.i "running " + __method__.to_s
39
+ @client.get '/finreports/v2/financial_account_owner/' + freelancer_reference, params
40
+ end
41
+
42
+ # Generate Financial Reports for a Specific Account
43
+ #
44
+ # Arguments:
45
+ # entity_reference: (String)
46
+ # params: (Hash)
47
+ def get_specific(entity_reference, params)
48
+ $LOG.i "running " + __method__.to_s
49
+ @client.get '/finreports/v2/financial_accounts/' + entity_reference, params
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,86 @@
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 Reports
18
+ module Finance
19
+ # Generate Billing Reports
20
+ class Billings
21
+ ENTRY_POINT = 'gds'
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
+ # Generate Billing Reports for a Specific Freelancer
33
+ #
34
+ # Arguments:
35
+ # freelancer_reference: (String)
36
+ # params: (Hash)
37
+ def get_by_freelancer(freelancer_reference, params)
38
+ $LOG.i "running " + __method__.to_s
39
+ @client.get '/finreports/v2/providers/' + freelancer_reference + '/billings', params
40
+ end
41
+
42
+ # Generate Billing Reports for a Specific Freelancer's Team
43
+ #
44
+ # Arguments:
45
+ # freelancer_team_reference: (String)
46
+ # params: (Hash)
47
+ def get_by_freelancers_team(freelancer_team_reference, params)
48
+ $LOG.i "running " + __method__.to_s
49
+ @client.get '/finreports/v2/provider_teams/' + freelancer_team_reference + '/billings', params
50
+ end
51
+
52
+ # Generate Billing Reports for a Specific Freelancer's Company
53
+ #
54
+ # Arguments:
55
+ # freelancer_company_reference: (String)
56
+ # params: (Hash)
57
+ def get_by_freelancers_company(freelancer_company_reference, params)
58
+ $LOG.i "running " + __method__.to_s
59
+ @client.get '/finreports/v2/provider_companies/' + freelancer_company_reference + '/billings', params
60
+ end
61
+
62
+ # Generate Billing Reports for a Specific Buyer's Team
63
+ #
64
+ # Arguments:
65
+ # buyer_team_reference: (String)
66
+ # params: (Hash)
67
+ def get_by_buyers_team(buyer_team_reference, params)
68
+ $LOG.i "running " + __method__.to_s
69
+ @client.get '/finreports/v2/buyer_teams/' + buyer_team_reference + '/billings', params
70
+ end
71
+
72
+ # Generate Billing Reports for a Specific Buyer's Company
73
+ #
74
+ # Arguments:
75
+ # buyer_company_reference: (String)
76
+ # params: (Hash)
77
+ def get_by_buyers_company(buyer_company_reference, params)
78
+ $LOG.i "running " + __method__.to_s
79
+ @client.get '/finreports/v2/buyer_companies/' + buyer_company_reference + '/billings', params
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,86 @@
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 Reports
18
+ module Finance
19
+ # Generate Earning Reports
20
+ class Earnings
21
+ ENTRY_POINT = 'gds'
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
+ # Generate Earning Reports for a Specific Freelancer
33
+ #
34
+ # Arguments:
35
+ # freelancer_reference: (String)
36
+ # params: (Hash)
37
+ def get_by_freelancer(freelancer_reference, params)
38
+ $LOG.i "running " + __method__.to_s
39
+ @client.get '/finreports/v2/providers/' + freelancer_reference + '/earnings', params
40
+ end
41
+
42
+ # Generate Earning Reports for a Specific Freelancer's Team
43
+ #
44
+ # Arguments:
45
+ # freelancer_team_reference: (String)
46
+ # params: (Hash)
47
+ def get_by_freelancers_team(freelancer_team_reference, params)
48
+ $LOG.i "running " + __method__.to_s
49
+ @client.get '/finreports/v2/provider_teams/' + freelancer_team_reference + '/earnings', params
50
+ end
51
+
52
+ # Generate Earning Reports for a Specific Freelancer's Company
53
+ #
54
+ # Arguments:
55
+ # freelancer_company_reference: (String)
56
+ # params: (Hash)
57
+ def get_by_freelancers_company(freelancer_company_reference, params)
58
+ $LOG.i "running " + __method__.to_s
59
+ @client.get '/finreports/v2/provider_companies/' + freelancer_company_reference + '/earnings', params
60
+ end
61
+
62
+ # Generate Earning Reports for a Specific Buyer's Team
63
+ #
64
+ # Arguments:
65
+ # buyer_team_reference: (String)
66
+ # params: (Hash)
67
+ def get_by_buyers_team(buyer_team_reference, params)
68
+ $LOG.i "running " + __method__.to_s
69
+ @client.get '/finreports/v2/buyer_teams/' + buyer_team_reference + '/earnings', params
70
+ end
71
+
72
+ # Generate Earning Reports for a Specific Buyer's Company
73
+ #
74
+ # Arguments:
75
+ # buyer_company_reference: (String)
76
+ # params: (Hash)
77
+ def get_by_buyers_company(buyer_company_reference, params)
78
+ $LOG.i "running " + __method__.to_s
79
+ @client.get '/finreports/v2/buyer_companies/' + buyer_company_reference + '/earnings', params
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,114 @@
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 Reports
18
+ # Time reports
19
+ class Time
20
+ ENTRY_POINT = 'gds'
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
+ # Generate Time Reports for a Specific Team (with financial info)
32
+ #
33
+ # Arguments:
34
+ # company: (String)
35
+ # team: (String)
36
+ # params: (Hash)
37
+ def get_by_team_full(company, team, params)
38
+ $LOG.i "running " + __method__.to_s
39
+ get_by_type(company, team, nil, params, false)
40
+ end
41
+
42
+ # Generate Time Reports for a Specific Team (hide financial info)
43
+ #
44
+ # Arguments:
45
+ # company: (String)
46
+ # team: (String)
47
+ # params: (Hash)
48
+ def get_by_team_limited(company, team, params)
49
+ $LOG.i "running " + __method__.to_s
50
+ get_by_type(company, team, nil, params, true)
51
+ end
52
+
53
+ # Generating Agency Specific Reports
54
+ #
55
+ # Arguments:
56
+ # company: (String)
57
+ # agency: (String)
58
+ # params: (Hash)
59
+ def get_by_agency(company, agency, params)
60
+ $LOG.i "running " + __method__.to_s
61
+ get_by_type(company, nil, agency, params, false)
62
+ end
63
+
64
+ # Generating Company Wide Reports
65
+ #
66
+ # Arguments:
67
+ # company: (String)
68
+ # params: (Hash)
69
+ def get_by_company(company, params)
70
+ $LOG.i "running " + __method__.to_s
71
+ get_by_type(company, nil, nil, params, false)
72
+ end
73
+
74
+ # Generating Freelancer's Specific Reports (hide financial info)
75
+ #
76
+ # Arguments:
77
+ # freelancer_id: (String)
78
+ # params: (Hash)
79
+ def get_by_freelancer_limited(freelancer_id, params)
80
+ $LOG.i "running " + __method__.to_s
81
+ @client.get '/timereports/v1/providers/' + freelancer_id, params
82
+ end
83
+
84
+ # Generating Freelancer's Specific Reports (with financial info)
85
+ #
86
+ # Arguments:
87
+ # freelancer_id: (String)
88
+ # params: (Hash)
89
+ def get_by_freelancer_full(freelancer_id, params)
90
+ $LOG.i "running " + __method__.to_s
91
+ @client.get '/timereports/v1/providers/' + freelancer_id, params
92
+ end
93
+
94
+ private
95
+
96
+ def get_by_type(company, team, agency, params, hide_fin_data)
97
+ $LOG.i "running " + __method__.to_s
98
+ url = '';
99
+ if (team != nil)
100
+ url = '/teams/' + team;
101
+ if (hide_fin_data)
102
+ url = url + '/hours';
103
+ end
104
+ elsif (agency != nil)
105
+ url = '/agencies/' + agency
106
+ end
107
+
108
+ @client.get '/timereports/v1/companies/' + company + url, params
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end