ruby-upwork-oauth2 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.docgen +1 -0
  3. data/.gitignore +22 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +176 -0
  7. data/README.md +80 -0
  8. data/Rakefile +12 -0
  9. data/example/example.rb +65 -0
  10. data/lib/upwork/api.rb +29 -0
  11. data/lib/upwork/api/client.rb +184 -0
  12. data/lib/upwork/api/config.rb +41 -0
  13. data/lib/upwork/api/logger.rb +35 -0
  14. data/lib/upwork/api/routers/activities/engagement.rb +63 -0
  15. data/lib/upwork/api/routers/activities/team.rb +117 -0
  16. data/lib/upwork/api/routers/auth.rb +38 -0
  17. data/lib/upwork/api/routers/freelancers/profile.rb +52 -0
  18. data/lib/upwork/api/routers/freelancers/search.rb +43 -0
  19. data/lib/upwork/api/routers/hr/clients/applications.rb +55 -0
  20. data/lib/upwork/api/routers/hr/clients/offers.rb +64 -0
  21. data/lib/upwork/api/routers/hr/contracts.rb +64 -0
  22. data/lib/upwork/api/routers/hr/engagements.rb +52 -0
  23. data/lib/upwork/api/routers/hr/freelancers/applications.rb +54 -0
  24. data/lib/upwork/api/routers/hr/freelancers/offers.rb +64 -0
  25. data/lib/upwork/api/routers/hr/interviews.rb +44 -0
  26. data/lib/upwork/api/routers/hr/jobs.rb +79 -0
  27. data/lib/upwork/api/routers/hr/milestones.rb +100 -0
  28. data/lib/upwork/api/routers/hr/roles.rb +49 -0
  29. data/lib/upwork/api/routers/hr/submissions.rb +63 -0
  30. data/lib/upwork/api/routers/jobs/profile.rb +43 -0
  31. data/lib/upwork/api/routers/jobs/search.rb +43 -0
  32. data/lib/upwork/api/routers/messages.rb +129 -0
  33. data/lib/upwork/api/routers/metadata.rb +65 -0
  34. data/lib/upwork/api/routers/organization/companies.rb +67 -0
  35. data/lib/upwork/api/routers/organization/teams.rb +49 -0
  36. data/lib/upwork/api/routers/organization/users.rb +49 -0
  37. data/lib/upwork/api/routers/payments.rb +42 -0
  38. data/lib/upwork/api/routers/reports/finance/accounts.rb +56 -0
  39. data/lib/upwork/api/routers/reports/finance/billings.rb +86 -0
  40. data/lib/upwork/api/routers/reports/finance/earnings.rb +86 -0
  41. data/lib/upwork/api/routers/reports/time.rb +114 -0
  42. data/lib/upwork/api/routers/snapshot.rb +62 -0
  43. data/lib/upwork/api/routers/workdays.rb +54 -0
  44. data/lib/upwork/api/routers/workdiary.rb +42 -0
  45. data/lib/upwork/api/version.rb +18 -0
  46. data/ruby-upwork-oauth2.gemspec +27 -0
  47. data/test/helper.rb +22 -0
  48. data/test/test_activities_engagement.rb +26 -0
  49. data/test/test_activities_team.rb +46 -0
  50. data/test/test_auth.rb +16 -0
  51. data/test/test_client.rb +48 -0
  52. data/test/test_config.rb +27 -0
  53. data/test/test_freelancers_profile.rb +22 -0
  54. data/test/test_freelancers_search.rb +16 -0
  55. data/test/test_hr_clients_applications.rb +21 -0
  56. data/test/test_hr_clients_offers.rb +26 -0
  57. data/test/test_hr_contracts.rb +26 -0
  58. data/test/test_hr_engagements.rb +21 -0
  59. data/test/test_hr_freelancers_applications.rb +21 -0
  60. data/test/test_hr_freelancers_offers.rb +26 -0
  61. data/test/test_hr_interviews.rb +16 -0
  62. data/test/test_hr_jobs.rb +36 -0
  63. data/test/test_hr_milestones.rb +46 -0
  64. data/test/test_hr_roles.rb +21 -0
  65. data/test/test_hr_submissions.rb +26 -0
  66. data/test/test_jobs_profile.rb +16 -0
  67. data/test/test_jobs_search.rb +16 -0
  68. data/test/test_logger.rb +15 -0
  69. data/test/test_messages.rb +56 -0
  70. data/test/test_metadata.rb +36 -0
  71. data/test/test_organization_companies.rb +31 -0
  72. data/test/test_organization_teams.rb +21 -0
  73. data/test/test_organization_users.rb +21 -0
  74. data/test/test_payments.rb +16 -0
  75. data/test/test_reports_finance_accounts.rb +21 -0
  76. data/test/test_reports_finance_billings.rb +36 -0
  77. data/test/test_reports_finance_earnings.rb +36 -0
  78. data/test/test_reports_time.rb +41 -0
  79. data/test/test_snapshot.rb +26 -0
  80. data/test/test_workdays.rb +21 -0
  81. data/test/test_workdiary.rb +16 -0
  82. metadata +230 -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,129 @@
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 2016(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 Messages
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
+ # Retrieve rooms information
30
+ #
31
+ # Arguments:
32
+ # company: (String)
33
+ # params: (Hash)
34
+ def get_rooms(company, params = {})
35
+ $LOG.i "running " + __method__.to_s
36
+ @client.get '/messages/v3/' + company + '/rooms', params
37
+ end
38
+
39
+ # Get a specific room information
40
+ #
41
+ # Arguments:
42
+ # company: (String)
43
+ # room_id: (String)
44
+ # params: (Hash)
45
+ def get_room_details(company, room_id, params = {})
46
+ $LOG.i "running " + __method__.to_s
47
+ @client.get '/messages/v3/' + company + '/rooms/' + room_id, params
48
+ end
49
+
50
+ # Get a specific room by offer ID
51
+ #
52
+ # Arguments:
53
+ # company: (String)
54
+ # offer_id: (String)
55
+ # params: (Hash)
56
+ def get_room_by_offer(company, offer_id, params = {})
57
+ $LOG.i "running " + __method__.to_s
58
+ @client.get '/messages/v3/' + company + '/rooms/offers/' + offer_id, params
59
+ end
60
+
61
+ # Get a specific room by application ID
62
+ #
63
+ # Arguments:
64
+ # company: (String)
65
+ # application_id: (String)
66
+ # params: (Hash)
67
+ def get_room_by_application(company, application_id, params = {})
68
+ $LOG.i "running " + __method__.to_s
69
+ @client.get '/messages/v3/' + company + '/rooms/applications/' + application_id, params
70
+ end
71
+
72
+ # Get a specific room by contract ID
73
+ #
74
+ # Arguments:
75
+ # company: (String)
76
+ # contract_id: (String)
77
+ # params: (Hash)
78
+ def get_room_by_contract(company, contract_id, params = {})
79
+ $LOG.i "running " + __method__.to_s
80
+ @client.get '/messages/v3/' + company + '/rooms/contracts/' + contract_id, params
81
+ end
82
+
83
+ # Create a new room
84
+ #
85
+ # Arguments:
86
+ # company: (String)
87
+ # params: (Hash)
88
+ def create_room(company, params = {})
89
+ $LOG.i "running " + __method__.to_s
90
+ @client.post '/messages/v3/' + company + '/rooms', params
91
+ end
92
+
93
+ # Send a message to a room
94
+ #
95
+ # Arguments:
96
+ # company: (String)
97
+ # room_id: (String)
98
+ # params: (Hash)
99
+ def send_message_to_room(company, room_id, params = {})
100
+ $LOG.i "running " + __method__.to_s
101
+ @client.post '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params
102
+ end
103
+
104
+ # Update a room settings
105
+ #
106
+ # Arguments:
107
+ # company: (String)
108
+ # room_id: (String)
109
+ # username: (String)
110
+ # params: (Hash)
111
+ def update_room_settings(company, room_id, username, params = {})
112
+ $LOG.i "running " + __method__.to_s
113
+ @client.put '/messages/v3/' + company + '/rooms/' + room_id + '/users/' + username, params
114
+ end
115
+
116
+ # Update the metadata of a room
117
+ #
118
+ # Arguments:
119
+ # company: (String)
120
+ # room_id: (String)
121
+ # params: (Hash)
122
+ def update_room_metadata(company, room_id, params = {})
123
+ $LOG.i "running " + __method__.to_s
124
+ @client.put '/messages/v3/' + company + '/rooms/' + room_id, params
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,65 @@
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 (v2)
31
+ def get_categories_v2
32
+ $LOG.i "running " + __method__.to_s
33
+ @client.get '/profiles/v2/metadata/categories'
34
+ end
35
+
36
+ # Get skills
37
+ def get_skills
38
+ $LOG.i "running " + __method__.to_s
39
+ @client.get '/profiles/v1/metadata/skills'
40
+ end
41
+
42
+ # Get regions
43
+ def get_regions
44
+ $LOG.i "running " + __method__.to_s
45
+ @client.get '/profiles/v1/metadata/regions'
46
+ end
47
+
48
+ # Get tests
49
+ def get_tests
50
+ $LOG.i "running " + __method__.to_s
51
+ @client.get '/profiles/v1/metadata/tests'
52
+ end
53
+
54
+ # Get reasons
55
+ #
56
+ # Arguments:
57
+ # params: (Hash)
58
+ def get_reasons(params)
59
+ $LOG.i "running " + __method__.to_s
60
+ @client.get '/profiles/v1/metadata/reasons', params;
61
+ end
62
+ end
63
+ end
64
+ end
65
+ 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