Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit da7e7f9

Browse files
authored
Merge pull request #12 from upwork/v1.2.3
v1.3.0
2 parents 7f3a840 + a717f1c commit da7e7f9

File tree

11 files changed

+18
-130
lines changed

11 files changed

+18
-130
lines changed

.tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rake test

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: ruby
22
script: rake
33
rvm:
4-
- 2.0.0
5-
- 2.1.0
64
- 2.3.0
5+
- 2.5.1
76
- ruby-head
87
install: gem install oauth test-unit mocha
98
matrix:

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.3.0
4+
* Stop supporting deprecated Teamrooms API
5+
* Migrate Workdiaries, Workdays and Snapshots API to v3

lib/upwork/api/routers/snapshot.rb

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,14 @@ def initialize(client)
2727
@client.epoint = ENTRY_POINT
2828
end
2929

30-
# Get snapshot info
31-
#
32-
# Arguments:
33-
# company: (String)
34-
# username: (String)
35-
# ts: (String)
36-
def get(company, username, ts)
37-
$LOG.i "running " + __method__.to_s
38-
@client.get '/team/v1/snapshots/' + company + '/' + username + '/' + ts
39-
end
40-
41-
# Update snapshot
42-
#
43-
# Arguments:
44-
# company: (String)
45-
# username: (String)
46-
# ts: (String)
47-
# params: (Hash)
48-
def update(company, username, ts, params)
49-
$LOG.i "running " + __method__.to_s
50-
@client.put '/team/v1/snapshots/' + company + '/' + username + '/' + ts, params
51-
end
52-
53-
# Delete snapshot
54-
# Arguments:
55-
# company: (String)
56-
# username: (String)
57-
# ts: (String)
58-
def delete(company, username, ts)
59-
$LOG.i "running " + __method__.to_s
60-
@client.delete '/team/v1/snapshots/' + company + '/' + username + '/' + ts
61-
end
62-
6330
# Get snapshot info by specific contract
6431
#
6532
# Arguments:
6633
# contract: (String)
6734
# ts: (String)
6835
def get_by_contract(contract, ts)
6936
$LOG.i "running " + __method__.to_s
70-
@client.get '/team/v2/snapshots/contracts/' + contract + '/' + ts
37+
@client.get '/team/v3/snapshots/contracts/' + contract + '/' + ts
7138
end
7239

7340
# Update snapshot by specific contract
@@ -78,7 +45,7 @@ def get_by_contract(contract, ts)
7845
# params: (Hash)
7946
def update_by_contract(contract, ts, params)
8047
$LOG.i "running " + __method__.to_s
81-
@client.put '/team/v2/snapshots/contracts/' + contract + '/' + ts, params
48+
@client.put '/team/v3/snapshots/contracts/' + contract + '/' + ts, params
8249
end
8350

8451
# Delete snapshot by specific contract
@@ -87,7 +54,7 @@ def update_by_contract(contract, ts, params)
8754
# ts: (String)
8855
def delete_by_contract(contract, ts)
8956
$LOG.i "running " + __method__.to_s
90-
@client.delete '/team/v2/snapshots/contracts/' + contract + '/' + ts
57+
@client.delete '/team/v3/snapshots/contracts/' + contract + '/' + ts
9158
end
9259
end
9360
end

lib/upwork/api/routers/teams.rb

Lines changed: 0 additions & 47 deletions
This file was deleted.

lib/upwork/api/routers/workdays.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def initialize(client)
3535
# params: (Hash)
3636
def get_by_company(company, from_date, till_date, params = {})
3737
$LOG.i "running " + __method__.to_s
38-
@client.get '/team/v2/workdays/companies/' + company + '/' + from_date + ',' + till_date, params
38+
@client.get '/team/v3/workdays/companies/' + company + '/' + from_date + ',' + till_date, params
3939
end
4040

4141
# Get Workdays by Contract
@@ -46,7 +46,7 @@ def get_by_company(company, from_date, till_date, params = {})
4646
# params: (Hash)
4747
def get_by_contract(contract, from_date, till_date, params = {})
4848
$LOG.i "running " + __method__.to_s
49-
@client.get '/team/v2/workdays/contracts/' + contract + '/' + from_date + ',' + till_date, params
49+
@client.get '/team/v3/workdays/contracts/' + contract + '/' + from_date + ',' + till_date, params
5050
end
5151
end
5252
end

lib/upwork/api/routers/workdiary.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ def initialize(client)
2727
@client.epoint = ENTRY_POINT
2828
end
2929

30-
# Get Workdiary
30+
# Get Workdiary by Company
3131
# Arguments:
3232
# company: (String)
33-
# username: (String)
3433
# date: (String)
3534
# params: (Hash)
36-
def get(company, username, date, params = {})
35+
def get(company, date, params = {})
3736
$LOG.i "running " + __method__.to_s
38-
@client.get '/team/v1/workdiaries/' + company + '/' + username + '/' + date, params
37+
@client.get '/team/v3/workdiaries/companies/' + company + '/' + date, params
3938
end
4039

4140
# Get Work Diary by Contract
@@ -45,7 +44,7 @@ def get(company, username, date, params = {})
4544
# params: (Hash)
4645
def get_by_contract(contract, date, params = {})
4746
$LOG.i "running " + __method__.to_s
48-
@client.get '/team/v2/workdiaries/contracts/' + contract + '/' + date, params
47+
@client.get '/team/v3/workdiaries/contracts/' + contract + '/' + date, params
4948
end
5049
end
5150
end

lib/upwork/api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
module Upwork # :nodoc:
1515
module Api
16-
VERSION = "1.2.2"
16+
VERSION = "1.3.0"
1717
end
1818
end

test/test_snapshot.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@
99
class SnapshotTest < Test::Unit::TestCase
1010
include TestHelper
1111

12-
def test_get
13-
api = Upwork::Api::Routers::Snapshot.new(get_client_mock)
14-
assert api.get('company', 'username', '20140101')
15-
end
16-
17-
def test_update
18-
api = Upwork::Api::Routers::Snapshot.new(get_client_mock)
19-
assert api.update('company', 'username', '20140101', {})
20-
end
21-
22-
def test_delete
23-
api = Upwork::Api::Routers::Snapshot.new(get_client_mock)
24-
assert api.delete('company', 'username', '20140101')
25-
end
26-
2712
def test_get_by_contract
2813
api = Upwork::Api::Routers::Snapshot.new(get_client_mock)
2914
assert api.get_by_contract('contract', '20140101')

test/test_teams.rb

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)