ruby-upwork-oauth2 2.1.4 → 2.3.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +1 -1
  3. data/CHANGES.md +3 -0
  4. data/README.md +1 -15
  5. data/example/example.rb +7 -0
  6. data/lib/upwork/api/client.rb +10 -4
  7. data/lib/upwork/api/config.rb +2 -2
  8. data/lib/upwork/api/routers/activities/engagement.rb +3 -3
  9. data/lib/upwork/api/routers/activities/team.rb +5 -5
  10. data/lib/upwork/api/routers/auth.rb +2 -2
  11. data/lib/upwork/api/routers/freelancers/profile.rb +2 -2
  12. data/lib/upwork/api/routers/freelancers/search.rb +2 -2
  13. data/lib/upwork/api/routers/graphql.rb +38 -0
  14. data/lib/upwork/api/routers/hr/clients/applications.rb +2 -2
  15. data/lib/upwork/api/routers/hr/clients/offers.rb +3 -3
  16. data/lib/upwork/api/routers/hr/contracts.rb +3 -3
  17. data/lib/upwork/api/routers/hr/engagements.rb +3 -3
  18. data/lib/upwork/api/routers/hr/freelancers/applications.rb +2 -2
  19. data/lib/upwork/api/routers/hr/freelancers/offers.rb +3 -3
  20. data/lib/upwork/api/routers/hr/interviews.rb +2 -2
  21. data/lib/upwork/api/routers/hr/jobs.rb +6 -6
  22. data/lib/upwork/api/routers/hr/milestones.rb +7 -7
  23. data/lib/upwork/api/routers/hr/roles.rb +3 -3
  24. data/lib/upwork/api/routers/hr/submissions.rb +3 -3
  25. data/lib/upwork/api/routers/jobs/profile.rb +2 -2
  26. data/lib/upwork/api/routers/jobs/search.rb +2 -2
  27. data/lib/upwork/api/routers/messages.rb +11 -11
  28. data/lib/upwork/api/routers/metadata.rb +7 -7
  29. data/lib/upwork/api/routers/organization/companies.rb +5 -5
  30. data/lib/upwork/api/routers/organization/teams.rb +3 -3
  31. data/lib/upwork/api/routers/organization/users.rb +2 -2
  32. data/lib/upwork/api/routers/payments.rb +1 -1
  33. data/lib/upwork/api/routers/reports/finance/accounts.rb +3 -3
  34. data/lib/upwork/api/routers/reports/finance/billings.rb +6 -6
  35. data/lib/upwork/api/routers/reports/finance/earnings.rb +6 -6
  36. data/lib/upwork/api/routers/reports/time.rb +3 -3
  37. data/lib/upwork/api/routers/snapshot.rb +3 -3
  38. data/lib/upwork/api/routers/workdays.rb +2 -2
  39. data/lib/upwork/api/routers/workdiary.rb +2 -2
  40. data/lib/upwork/api/version.rb +1 -1
  41. data/ruby-upwork-oauth2.gemspec +1 -1
  42. data/test/test_activities_engagement.rb +6 -6
  43. data/test/test_activities_team.rb +14 -14
  44. data/test/test_auth.rb +3 -3
  45. data/test/test_freelancers_profile.rb +4 -4
  46. data/test/test_freelancers_search.rb +3 -3
  47. data/test/test_graphql.rb +16 -0
  48. data/test/test_hr_clients_applications.rb +5 -5
  49. data/test/test_hr_clients_offers.rb +6 -6
  50. data/test/test_hr_contracts.rb +6 -6
  51. data/test/test_hr_engagements.rb +5 -5
  52. data/test/test_hr_freelancers_applications.rb +5 -5
  53. data/test/test_hr_freelancers_offers.rb +6 -6
  54. data/test/test_hr_interviews.rb +3 -3
  55. data/test/test_hr_jobs.rb +11 -11
  56. data/test/test_hr_milestones.rb +14 -14
  57. data/test/test_hr_roles.rb +5 -5
  58. data/test/test_hr_submissions.rb +6 -6
  59. data/test/test_jobs_profile.rb +3 -3
  60. data/test/test_jobs_search.rb +3 -3
  61. data/test/test_messages.rb +22 -22
  62. data/test/test_metadata.rb +14 -14
  63. data/test/test_organization_companies.rb +9 -9
  64. data/test/test_organization_teams.rb +5 -5
  65. data/test/test_organization_users.rb +4 -4
  66. data/test/test_payments.rb +2 -2
  67. data/test/test_reports_finance_accounts.rb +5 -5
  68. data/test/test_reports_finance_billings.rb +11 -11
  69. data/test/test_reports_finance_earnings.rb +11 -11
  70. data/test/test_reports_time.rb +13 -13
  71. data/test/test_snapshot.rb +6 -6
  72. data/test/test_workdays.rb +4 -4
  73. data/test/test_workdiary.rb +2 -2
  74. metadata +13 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30396e38e7003832bc1afee54cb092275109658e4054ff0aa477f1d587075dc9
4
- data.tar.gz: dfc128c0a3fe618af664075bce4f87f3adcb9255ad653620e8ddf8dd1684f320
3
+ metadata.gz: 714d57824d8e7e99ce8abfb0292feb999658487dc796645583ef0f37fbb79e4b
4
+ data.tar.gz: f6d723f4d3b7f46b5c389cc1db185f5064e648e1c2bc44ec62895942c7b62fa2
5
5
  SHA512:
6
- metadata.gz: 71b9945740d5412cc7c80e720ba4f73ed06b70a409fd7e36f09153c33adb49d4f9fb9d5abaab818a4d3f721cd49c142688f9e630d1f50093a461470750317a64
7
- data.tar.gz: 7ad335171b968d0b6e53cb22807e781ba0f4f0f8d334df7c866075ae408c37d498222f9486260705a1d4583f75aac19444d9c2613a5fc4dfba7ffbd3e4d4dd2e
6
+ metadata.gz: 8edcd97947d2ccdcf59043db46f2e41a640a60bc4b091a801052841c978b6e17eb7896ff19045286e5518abed259c184570c0d14b72d67c50a5a9112da8b4a32
7
+ data.tar.gz: 7518ea1a6642682ded9da4fe7cc27cceb2e163b74f0d6a70bac74333e7a88b712d9bb0c3a0504875f524b88a35ab91ab8b52710a6339493986a8523ee50e23d9
@@ -16,7 +16,7 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  os: [ubuntu-latest, macos-latest]
19
- ruby: [ '2.7.3', '2.6.7', '2.5.9' ]
19
+ ruby: [ '3.0.1' ]
20
20
 
21
21
  name: Ruby ${{ matrix.ruby }}
22
22
  steps:
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Release History
2
2
 
3
+ ## 2.2.0
4
+ * Support Client Credentials Grant
5
+
3
6
  ## 2.1.4
4
7
  * Add GraphQL support
5
8
 
data/README.md CHANGED
@@ -12,21 +12,7 @@ This project provides a set of resources of Upwork API from http://developers.up
12
12
  based on OAuth 2.0.
13
13
 
14
14
  # Features
15
- These are the supported API resources:
16
-
17
- * My Info
18
- * Custom Payments
19
- * Hiring
20
- * Job and Freelancer Profile
21
- * Search Jobs and Freelancers
22
- * Organization
23
- * Messages
24
- * Time and Financial Reporting
25
- * Metadata
26
- * Snapshot
27
- * Team
28
- * Workd Diary
29
- * Activities
15
+ The library supports all GraphQL calls, which are publicly shared at Upwork
30
16
 
31
17
  # License
32
18
 
data/example/example.rb CHANGED
@@ -16,6 +16,7 @@ config = Upwork::Api::Config.new({
16
16
  'client_id' => 'xxxxxxxx',
17
17
  'client_secret' => 'xxxxxxxx',
18
18
  'redirect_uri' => 'https://a.callback.url',
19
+ # 'grant_type' => 'client_credentials' # Client Credentials Grant
19
20
  # 'access_token' => 'xxxxxxxx',
20
21
  # 'refresh_token' => 'xxxxxxxx',
21
22
  # 'expires_in' => '86399'
@@ -26,6 +27,7 @@ config = Upwork::Api::Config.new({
26
27
  # setup client
27
28
  client = Upwork::Api::Client.new(config)
28
29
 
30
+ # Code Authorization Grant
29
31
  # run authorization in case we haven't done it yet
30
32
  # and do not have an access and refresh token pair
31
33
  if !config.access_token and !config.refresh_token
@@ -38,6 +40,11 @@ if !config.access_token and !config.refresh_token
38
40
  # store access token data in safe place!
39
41
  end
40
42
 
43
+ # Client Credentials Grant
44
+ if !config.access_token
45
+ @token = client.get_access_token
46
+ end
47
+
41
48
  # WARNING: the access token will be refreshed automatically for you
42
49
  # in case it's expired, i.e. expires_at < time(). Make sure you replace the
43
50
  # old token accordingly in your security storage. Call client.get_actual_config
@@ -60,10 +60,16 @@ module Upwork
60
60
  #
61
61
  # Arguments:
62
62
  # authz_code: (String)
63
- def get_access_token(authz_code)
64
- $LOG.i "getting access and refresh token pair"
65
- @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)
66
- $LOG.i "got access and refresh token pair", @access_token
63
+ def get_access_token(authz_code = nil)
64
+ if @config.grant_type == 'client_credentials'
65
+ $LOG.i "getting access token"
66
+ @access_token = @oauth2_client.client_credentials.get_token
67
+ $LOG.i "got access token", @access_token
68
+ else
69
+ $LOG.i "getting access and refresh token pair"
70
+ @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)
71
+ $LOG.i "got access and refresh token pair", @access_token
72
+ end
67
73
 
68
74
  refresh_config_from_access_token
69
75
 
@@ -18,14 +18,14 @@ module Upwork
18
18
  @@debug = false;
19
19
 
20
20
  attr_accessor :access_token, :refresh_token, :expires_in, :expires_at
21
- attr_reader :client_id, :client_secret, :redirect_uri
21
+ attr_reader :client_id, :client_secret, :redirect_uri, :grant_type
22
22
 
23
23
  # Init config object
24
24
  #
25
25
  # Arguments:
26
26
  # config: (Hash)
27
27
  def initialize(config = {})
28
- @client_id, @client_secret, @redirect_uri = config['client_id'], config['client_secret'], config['redirect_uri']
28
+ @client_id, @client_secret, @redirect_uri, @grant_type = config['client_id'], config['client_secret'], config['redirect_uri'], config['grant_type']
29
29
  @access_token, @refresh_token, @expires_in, @expires_at = config['access_token'], config['refresh_token'], config['expires_in'], config['expires_at']
30
30
  @@debug = config['debug']
31
31
 
@@ -33,7 +33,7 @@ module Upwork
33
33
  # Arguments:
34
34
  # engagement_ref: (String)
35
35
  def get_specific(engagement_ref)
36
- @client.get '/tasks/v2/tasks/contracts/' + engagement_ref
36
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
37
37
  end
38
38
 
39
39
  # Assign engagements to the list of activities
@@ -44,7 +44,7 @@ module Upwork
44
44
  # engagement: (String)
45
45
  # params: (Hash)
46
46
  def assign(company, team, engagement, params)
47
- @client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/engagements/' + engagement + '/tasks', params
47
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
48
48
  end
49
49
 
50
50
  # Assign to specific engagement the list of activities
@@ -53,7 +53,7 @@ module Upwork
53
53
  # engagement_ref: (String)
54
54
  # params: (Hash)
55
55
  def assign_to_engagement(engagement_ref, params)
56
- @client.put '/tasks/v2/tasks/contracts/' + engagement_ref, params
56
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
57
57
  end
58
58
 
59
59
  end
@@ -54,7 +54,7 @@ module Upwork
54
54
  # team: (String)
55
55
  # params: (Hash)
56
56
  def add_activity(company, team, params)
57
- @client.post '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/tasks', params
57
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
58
58
  end
59
59
 
60
60
  # Update specific oTask/Activity record within a team
@@ -65,7 +65,7 @@ module Upwork
65
65
  # code: (String)
66
66
  # params: (Hash)
67
67
  def update_activities(company, team, code, params)
68
- @client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/tasks/' + code, params
68
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
69
69
  end
70
70
 
71
71
  # Archive specific oTask/Activity record within a team
@@ -75,7 +75,7 @@ module Upwork
75
75
  # team: (String)
76
76
  # code: (String)
77
77
  def archive_activities(company, team, code)
78
- @client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/archive/' + code
78
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
79
79
  end
80
80
 
81
81
  # Unarchive specific oTask/Activity record within a team
@@ -85,7 +85,7 @@ module Upwork
85
85
  # team: (String)
86
86
  # code: (String)
87
87
  def unarchive_activities(company, team, code)
88
- @client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/unarchive/' + code
88
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
89
89
  end
90
90
 
91
91
  # Update a group of oTask/Activity records within a company
@@ -94,7 +94,7 @@ module Upwork
94
94
  # company: (String)
95
95
  # params: (Hash)
96
96
  def update_batch(company, params)
97
- @client.put '/otask/v1/tasks/companies/' + company + '/tasks/batch', params
97
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
98
98
  end
99
99
 
100
100
  private
@@ -30,9 +30,9 @@ module Upwork
30
30
  # Get info of authenticated user
31
31
  def get_user_info
32
32
  $LOG.i "running " + __method__.to_s
33
- @client.get '/auth/v1/info'
33
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
34
34
  end
35
35
  end
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -34,7 +34,7 @@ module Upwork
34
34
  # key: (String)
35
35
  def get_specific(key)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/profiles/v1/providers/' + key
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
 
40
40
  # Get brief info on specific profile
@@ -42,7 +42,7 @@ module Upwork
42
42
  # Arguments:
43
43
  # key: (String)
44
44
  def get_specific_brief(key)
45
- $LOG.i "running " + __method__.to_s
45
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
46
46
  @client.get '/profiles/v1/providers/' + key + '/brief'
47
47
  end
48
48
  end
@@ -34,10 +34,10 @@ module Upwork
34
34
  # params: (Hash)
35
35
  def find(params)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/profiles/v2/search/providers', params
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
  end
40
40
  end
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -0,0 +1,38 @@
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 2021(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
+ # Execute GraphQL requests
18
+ class Graphql
19
+ ENTRY_POINT = 'graphql'
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
+ # Execute GraphQL request
31
+ def execute(params)
32
+ $LOG.i "running " + __method__.to_s
33
+ @client.post '', params
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -35,7 +35,7 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def get_list(params)
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.get '/hr/v4/clients/applications', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
 
41
41
  # Get specific application
@@ -45,7 +45,7 @@ module Upwork
45
45
  # params: (Hash)
46
46
  def get_specific(reference, params)
47
47
  $LOG.i "running " + __method__.to_s
48
- @client.get '/hr/v4/clients/applications/' + reference, params
48
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
49
49
  end
50
50
  end
51
51
  end
@@ -35,7 +35,7 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def get_list(params)
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.get '/offers/v1/clients/offers', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
 
41
41
  # Get specific offer
@@ -45,7 +45,7 @@ module Upwork
45
45
  # params: (Hash)
46
46
  def get_specific(reference, params)
47
47
  $LOG.i "running " + __method__.to_s
48
- @client.get '/offers/v1/clients/offers/' + reference, params
48
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
49
49
  end
50
50
 
51
51
  # Make an Offer
@@ -54,7 +54,7 @@ module Upwork
54
54
  # params: (Hash)
55
55
  def make_offer(params)
56
56
  $LOG.i "running " + __method__.to_s
57
- @client.post '/offers/v1/clients/offers', params
57
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
58
58
  end
59
59
  end
60
60
  end
@@ -35,7 +35,7 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def suspend_contract(reference, params)
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.put '/hr/v2/contracts/' + reference + '/suspend', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
 
41
41
  # Restart Contract
@@ -45,7 +45,7 @@ module Upwork
45
45
  # params: (Hash)
46
46
  def restart_contract(reference, params)
47
47
  $LOG.i "running " + __method__.to_s
48
- @client.put '/hr/v2/contracts/' + reference + '/restart', params
48
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
49
49
  end
50
50
 
51
51
  # End Contract
@@ -55,7 +55,7 @@ module Upwork
55
55
  # params: (Hash)
56
56
  def end_contract(reference, params)
57
57
  $LOG.i "running " + __method__.to_s
58
- @client.delete '/hr/v2/contracts/' + reference, params
58
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
59
59
  end
60
60
  end
61
61
  end
@@ -34,7 +34,7 @@ module Upwork
34
34
  # params: (Hash)
35
35
  def get_list(params)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/hr/v2/engagements', params
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
 
40
40
  # Get specific engagement
@@ -43,10 +43,10 @@ module Upwork
43
43
  # reference: (String)
44
44
  def get_specific(reference)
45
45
  $LOG.i "running " + __method__.to_s
46
- @client.get '/hr/v2/engagements/' + reference
46
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
47
47
  end
48
48
  end
49
49
  end
50
50
  end
51
51
  end
52
- end
52
+ end
@@ -35,7 +35,7 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def get_list(params = {})
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.get '/hr/v4/contractors/applications', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
 
41
41
  # Get specific application
@@ -44,7 +44,7 @@ module Upwork
44
44
  # reference: (String)
45
45
  def get_specific(reference)
46
46
  $LOG.i "running " + __method__.to_s
47
- @client.get '/hr/v4/contractors/applications' + reference
47
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
48
48
  end
49
49
  end
50
50
  end
@@ -35,7 +35,7 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def get_list(params = {})
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.get '/offers/v1/contractors/offers', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
 
41
41
  # Get specific offer
@@ -44,7 +44,7 @@ module Upwork
44
44
  # reference: (String)
45
45
  def get_specific(reference)
46
46
  $LOG.i "running " + __method__.to_s
47
- @client.get '/offers/v1/clients/offers/' + reference
47
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
48
48
  end
49
49
 
50
50
  # Apply specific action
@@ -54,7 +54,7 @@ module Upwork
54
54
  # params: (Hash)
55
55
  def actions(reference, params)
56
56
  $LOG.i "running " + __method__.to_s
57
- @client.post '/offers/v1/clients/actions/' + reference, params
57
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
58
58
  end
59
59
  end
60
60
  end
@@ -35,10 +35,10 @@ module Upwork
35
35
  # params: (Hash)
36
36
  def invite(job_key, params)
37
37
  $LOG.i "running " + __method__.to_s
38
- @client.post '/hr/v1/jobs/' + job_key + '/candidates', params
38
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
39
39
  end
40
40
  end
41
41
  end
42
42
  end
43
43
  end
44
- end
44
+ end
@@ -34,7 +34,7 @@ module Upwork
34
34
  # params: (Hash)
35
35
  def get_list(params)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/hr/v2/jobs', params
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
 
40
40
  # Get specific job by key
@@ -43,7 +43,7 @@ module Upwork
43
43
  # key: (String)
44
44
  def get_specific(key)
45
45
  $LOG.i "running " + __method__.to_s
46
- @client.get '/hr/v2/jobs/' + key
46
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
47
47
  end
48
48
 
49
49
  # Post a new job
@@ -52,7 +52,7 @@ module Upwork
52
52
  # params: (Hash)
53
53
  def post_job(params)
54
54
  $LOG.i "running " + __method__.to_s
55
- @client.post '/hr/v2/jobs', params
55
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
56
56
  end
57
57
 
58
58
  # Edit existent job
@@ -61,7 +61,7 @@ module Upwork
61
61
  # params: (Hash)
62
62
  def edit_job(key, params)
63
63
  $LOG.i "running " + __method__.to_s
64
- @client.put '/hr/v2/jobs/' + key, params
64
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
65
65
  end
66
66
 
67
67
  # Delete existent job
@@ -70,10 +70,10 @@ module Upwork
70
70
  # params: (Hash)
71
71
  def delete_job(key, params)
72
72
  $LOG.i "running " + __method__.to_s
73
- @client.delete '/hr/v2/jobs/' + key, params
73
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
74
74
  end
75
75
  end
76
76
  end
77
77
  end
78
78
  end
79
- end
79
+ end
@@ -34,7 +34,7 @@ module Upwork
34
34
  # contract_id: (String)
35
35
  def get_active_milestone(contract_id)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/hr/v3/fp/milestones/statuses/active/contracts/' + contract_id
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
 
40
40
  # Get active Milestone for specific Contract
@@ -43,7 +43,7 @@ module Upwork
43
43
  # milestone_id: (String)
44
44
  def get_submissions(milestone_id)
45
45
  $LOG.i "running " + __method__.to_s
46
- @client.get '/hr/v3/fp/milestones/' + milestone_id + '/submissions'
46
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
47
47
  end
48
48
 
49
49
  # Create a new Milestone
@@ -52,7 +52,7 @@ module Upwork
52
52
  # params: (Hash)
53
53
  def create(params)
54
54
  $LOG.i "running " + __method__.to_s
55
- @client.post '/hr/v3/fp/milestones', params
55
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
56
56
  end
57
57
 
58
58
  # Edit an existing Milestone
@@ -62,7 +62,7 @@ module Upwork
62
62
  # params: (Hash)
63
63
  def edit(milestone_id, params)
64
64
  $LOG.i "running " + __method__.to_s
65
- @client.put '/hr/v3/fp/milestones/' + milestone_id, params
65
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
66
66
  end
67
67
 
68
68
  # Activate an existing Milestone
@@ -72,7 +72,7 @@ module Upwork
72
72
  # params: (Hash)
73
73
  def activate(milestone_id, params)
74
74
  $LOG.i "running " + __method__.to_s
75
- @client.put '/hr/v3/fp/milestones/' + milestone_id + '/activate', params
75
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
76
76
  end
77
77
 
78
78
  # Approve an existing Milestone
@@ -82,7 +82,7 @@ module Upwork
82
82
  # params: (Hash)
83
83
  def approve(milestone_id, params)
84
84
  $LOG.i "running " + __method__.to_s
85
- @client.put '/hr/v3/fp/milestones/' + milestone_id + '/approve', params
85
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
86
86
  end
87
87
 
88
88
  # Delete an existing Milestone
@@ -91,7 +91,7 @@ module Upwork
91
91
  # milestone_id: (String)
92
92
  def delete(milestone_id)
93
93
  $LOG.i "running " + __method__.to_s
94
- @client.delete '/hr/v3/fp/milestones/' + milestone_id
94
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
95
95
  end
96
96
  end
97
97
  end
@@ -31,7 +31,7 @@ module Upwork
31
31
  # Get user roles
32
32
  def get_all
33
33
  $LOG.i "running " + __method__.to_s
34
- @client.get '/hr/v2/userroles'
34
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
35
35
  end
36
36
 
37
37
  # Get by specific user
@@ -40,10 +40,10 @@ module Upwork
40
40
  # reference: (String)
41
41
  def get_by_specific_user(user_reference)
42
42
  $LOG.i "running " + __method__.to_s
43
- @client.get '/hr/v2/userroles/' + user_reference
43
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
44
44
  end
45
45
  end
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -34,7 +34,7 @@ module Upwork
34
34
  # params: (Hash)
35
35
  def request_approval(params)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.post '/hr/v3/fp/submissions', params
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
 
40
40
  # Approve an existing Submission
@@ -44,7 +44,7 @@ module Upwork
44
44
  # params: (Hash)
45
45
  def approve(submission_id, params)
46
46
  $LOG.i "running " + __method__.to_s
47
- @client.put '/hr/v3/fp/submissions/' + submission_id + '/approve', params
47
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
48
48
  end
49
49
 
50
50
  # Reject an existing Submission
@@ -54,7 +54,7 @@ module Upwork
54
54
  # params: (Hash)
55
55
  def reject(submission_id, params)
56
56
  $LOG.i "running " + __method__.to_s
57
- @client.put '/hr/v3/fp/submissions/' + submission_id + '/reject', params
57
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
58
58
  end
59
59
  end
60
60
  end
@@ -34,10 +34,10 @@ module Upwork
34
34
  # key: (String)
35
35
  def get_specific(key)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/profiles/v1/jobs/' + key
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
  end
40
40
  end
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -34,10 +34,10 @@ module Upwork
34
34
  # params: (Hash)
35
35
  def find(params)
36
36
  $LOG.i "running " + __method__.to_s
37
- @client.get '/profiles/v2/search/jobs', params
37
+ raise StandardError.new "The legacy API was deprecated. Please, use GraphQL call - see example in this library."
38
38
  end
39
39
  end
40
40
  end
41
41
  end
42
42
  end
43
- end
43
+ end