odesk-api 0.1.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.
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +176 -0
- data/README.md +65 -0
- data/Rakefile +12 -0
- data/example/myapp.rb +57 -0
- data/lib/odesk/api/client.rb +161 -0
- data/lib/odesk/api/config.rb +42 -0
- data/lib/odesk/api/logger.rb +35 -0
- data/lib/odesk/api/routers/activities/company.rb +120 -0
- data/lib/odesk/api/routers/activities/team.rb +118 -0
- data/lib/odesk/api/routers/activities/user.rb +125 -0
- data/lib/odesk/api/routers/auth.rb +38 -0
- data/lib/odesk/api/routers/freelancers/profile.rb +43 -0
- data/lib/odesk/api/routers/freelancers/search.rb +43 -0
- data/lib/odesk/api/routers/hr/clients/applications.rb +55 -0
- data/lib/odesk/api/routers/hr/clients/offers.rb +63 -0
- data/lib/odesk/api/routers/hr/contracts.rb +44 -0
- data/lib/odesk/api/routers/hr/engagements.rb +52 -0
- data/lib/odesk/api/routers/hr/freelancers/applications.rb +54 -0
- data/lib/odesk/api/routers/hr/freelancers/offers.rb +54 -0
- data/lib/odesk/api/routers/hr/interviews.rb +44 -0
- data/lib/odesk/api/routers/hr/jobs.rb +79 -0
- data/lib/odesk/api/routers/hr/roles.rb +49 -0
- data/lib/odesk/api/routers/jobs/profile.rb +43 -0
- data/lib/odesk/api/routers/jobs/search.rb +43 -0
- data/lib/odesk/api/routers/mc.rb +89 -0
- data/lib/odesk/api/routers/metadata.rb +65 -0
- data/lib/odesk/api/routers/organization/companies.rb +67 -0
- data/lib/odesk/api/routers/organization/teams.rb +49 -0
- data/lib/odesk/api/routers/organization/users.rb +40 -0
- data/lib/odesk/api/routers/payments.rb +52 -0
- data/lib/odesk/api/routers/reports/finance/accounts.rb +56 -0
- data/lib/odesk/api/routers/reports/finance/billings.rb +86 -0
- data/lib/odesk/api/routers/reports/finance/earnings.rb +86 -0
- data/lib/odesk/api/routers/reports/time.rb +114 -0
- data/lib/odesk/api/routers/snapshot.rb +65 -0
- data/lib/odesk/api/routers/teams.rb +47 -0
- data/lib/odesk/api/routers/workdiary.rb +43 -0
- data/lib/odesk/api/version.rb +18 -0
- data/lib/odesk/api.rb +29 -0
- data/odesk-api.gemspec +23 -0
- data/test/helper.rb +21 -0
- data/test/test_activities_company.rb +51 -0
- data/test/test_activities_team.rb +46 -0
- data/test/test_activities_user.rb +46 -0
- data/test/test_auth.rb +16 -0
- data/test/test_client.rb +47 -0
- data/test/test_config.rb +25 -0
- data/test/test_freelancers_profile.rb +16 -0
- data/test/test_freelancers_search.rb +16 -0
- data/test/test_hr_clients_applications.rb +21 -0
- data/test/test_hr_clients_offers.rb +26 -0
- data/test/test_hr_contracts.rb +16 -0
- data/test/test_hr_engagements.rb +21 -0
- data/test/test_hr_freelancers_applications.rb +21 -0
- data/test/test_hr_freelancers_offers.rb +21 -0
- data/test/test_hr_interviews.rb +16 -0
- data/test/test_hr_jobs.rb +36 -0
- data/test/test_hr_roles.rb +21 -0
- data/test/test_jobs_profile.rb +16 -0
- data/test/test_jobs_search.rb +16 -0
- data/test/test_logger.rb +15 -0
- data/test/test_mc.rb +41 -0
- data/test/test_metadata.rb +36 -0
- data/test/test_organization_companies.rb +31 -0
- data/test/test_organization_teams.rb +21 -0
- data/test/test_organization_users.rb +16 -0
- data/test/test_payments.rb +21 -0
- data/test/test_reports_finance_accounts.rb +21 -0
- data/test/test_reports_finance_billings.rb +36 -0
- data/test/test_reports_finance_earnings.rb +36 -0
- data/test/test_reports_time.rb +41 -0
- data/test/test_snapshot.rb +26 -0
- data/test/test_teams.rb +21 -0
- data/test/test_workdiary.rb +16 -0
- metadata +189 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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
|
+
# Get adjustments
|
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.get '/hr/v2/teams/' + team_reference + '/adjustments', params
|
38
|
+
end
|
39
|
+
|
40
|
+
# Submit bonus
|
41
|
+
#
|
42
|
+
# Arguments:
|
43
|
+
# team_reference: (String)
|
44
|
+
# params: (Hash)
|
45
|
+
def get_adjustments(team_reference, params)
|
46
|
+
$LOG.i "running " + __method__.to_s
|
47
|
+
@client.post '/hr/v2/teams/' + team_reference + '/adjustments', params
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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 oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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 oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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 oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
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
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
15
|
+
module Api
|
16
|
+
module Routers
|
17
|
+
# Snapshot
|
18
|
+
class Snapshot
|
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 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
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
15
|
+
module Api
|
16
|
+
module Routers
|
17
|
+
# Team API
|
18
|
+
class Teams
|
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 Team Rooms
|
31
|
+
def get_list
|
32
|
+
$LOG.i "running " + __method__.to_s
|
33
|
+
@client.get '/team/v2/teamrooms'
|
34
|
+
end
|
35
|
+
|
36
|
+
# Get specific team or company
|
37
|
+
# Arguments:
|
38
|
+
# team: (String)
|
39
|
+
# params: (Hash)
|
40
|
+
def get_specific(team, params)
|
41
|
+
$LOG.i "running " + __method__.to_s
|
42
|
+
@client.get '/team/v2/teamrooms/' + team, params
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk
|
15
|
+
module Api
|
16
|
+
module Routers
|
17
|
+
# Work Diary
|
18
|
+
class Workdiary
|
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 Workdiary
|
31
|
+
# Arguments:
|
32
|
+
# company: (String)
|
33
|
+
# username: (String)
|
34
|
+
# date: (String)
|
35
|
+
# params: (Hash)
|
36
|
+
def get(company, username, date, params = {})
|
37
|
+
$LOG.i "running " + __method__.to_s
|
38
|
+
@client.get '/team/v1/workdiaries/' + company + '/' + username + '/' + date, params
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
module Odesk # :nodoc:
|
15
|
+
module Api
|
16
|
+
VERSION = "0.1.0"
|
17
|
+
end
|
18
|
+
end
|
data/lib/odesk/api.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Licensed under the oDesk'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@odesk.com)
|
11
|
+
# Copyright:: Copyright 2014(c) oDesk.com
|
12
|
+
# License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
|
13
|
+
|
14
|
+
require 'oauth'
|
15
|
+
|
16
|
+
require 'odesk/api/version'
|
17
|
+
require 'odesk/api/logger'
|
18
|
+
require 'odesk/api/config'
|
19
|
+
require 'odesk/api/client'
|
20
|
+
|
21
|
+
module Odesk # :nodoc:
|
22
|
+
module Api
|
23
|
+
# define some constants
|
24
|
+
BASE_HOST = 'https://www.odesk.com'
|
25
|
+
DEFAULT_EPOINT = 'api'
|
26
|
+
|
27
|
+
$LOG = Logger.new
|
28
|
+
end
|
29
|
+
end
|
data/odesk-api.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'odesk/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "odesk-api"
|
8
|
+
spec.version = Odesk::Api::VERSION
|
9
|
+
spec.authors = ["Maksym Novozhylov"]
|
10
|
+
spec.email = ["mnovozhilov@odesk.com"]
|
11
|
+
spec.summary = %q{Ruby bindings for oDesk API.}
|
12
|
+
spec.description = %q{Ruby bindings for oDesk API makes your life easier due to working with your oDesk's data.}
|
13
|
+
spec.homepage = "http://developers.odesk.com"
|
14
|
+
spec.license = "Apache-2.0"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
|
3
|
+
require 'odesk/api'
|
4
|
+
|
5
|
+
$LOG = Odesk::Api::Logger.new
|
6
|
+
|
7
|
+
module TestHelper
|
8
|
+
def get_client_mock
|
9
|
+
config = Odesk::Api::Config.new({
|
10
|
+
'consumer_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
11
|
+
'consumer_secret' => 'xxxxxxxxxxxxxxxx',
|
12
|
+
'access_token' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
13
|
+
'access_secret' => 'xxxxxxxxxxxxxxxx',
|
14
|
+
'debug' => false
|
15
|
+
})
|
16
|
+
|
17
|
+
client = Odesk::Api::Client.new(config)
|
18
|
+
client.expects(:send_request).returns(true)
|
19
|
+
client
|
20
|
+
end
|
21
|
+
end
|