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.
Files changed (77) hide show
  1. data/.gitignore +22 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +176 -0
  4. data/README.md +65 -0
  5. data/Rakefile +12 -0
  6. data/example/myapp.rb +57 -0
  7. data/lib/odesk/api/client.rb +161 -0
  8. data/lib/odesk/api/config.rb +42 -0
  9. data/lib/odesk/api/logger.rb +35 -0
  10. data/lib/odesk/api/routers/activities/company.rb +120 -0
  11. data/lib/odesk/api/routers/activities/team.rb +118 -0
  12. data/lib/odesk/api/routers/activities/user.rb +125 -0
  13. data/lib/odesk/api/routers/auth.rb +38 -0
  14. data/lib/odesk/api/routers/freelancers/profile.rb +43 -0
  15. data/lib/odesk/api/routers/freelancers/search.rb +43 -0
  16. data/lib/odesk/api/routers/hr/clients/applications.rb +55 -0
  17. data/lib/odesk/api/routers/hr/clients/offers.rb +63 -0
  18. data/lib/odesk/api/routers/hr/contracts.rb +44 -0
  19. data/lib/odesk/api/routers/hr/engagements.rb +52 -0
  20. data/lib/odesk/api/routers/hr/freelancers/applications.rb +54 -0
  21. data/lib/odesk/api/routers/hr/freelancers/offers.rb +54 -0
  22. data/lib/odesk/api/routers/hr/interviews.rb +44 -0
  23. data/lib/odesk/api/routers/hr/jobs.rb +79 -0
  24. data/lib/odesk/api/routers/hr/roles.rb +49 -0
  25. data/lib/odesk/api/routers/jobs/profile.rb +43 -0
  26. data/lib/odesk/api/routers/jobs/search.rb +43 -0
  27. data/lib/odesk/api/routers/mc.rb +89 -0
  28. data/lib/odesk/api/routers/metadata.rb +65 -0
  29. data/lib/odesk/api/routers/organization/companies.rb +67 -0
  30. data/lib/odesk/api/routers/organization/teams.rb +49 -0
  31. data/lib/odesk/api/routers/organization/users.rb +40 -0
  32. data/lib/odesk/api/routers/payments.rb +52 -0
  33. data/lib/odesk/api/routers/reports/finance/accounts.rb +56 -0
  34. data/lib/odesk/api/routers/reports/finance/billings.rb +86 -0
  35. data/lib/odesk/api/routers/reports/finance/earnings.rb +86 -0
  36. data/lib/odesk/api/routers/reports/time.rb +114 -0
  37. data/lib/odesk/api/routers/snapshot.rb +65 -0
  38. data/lib/odesk/api/routers/teams.rb +47 -0
  39. data/lib/odesk/api/routers/workdiary.rb +43 -0
  40. data/lib/odesk/api/version.rb +18 -0
  41. data/lib/odesk/api.rb +29 -0
  42. data/odesk-api.gemspec +23 -0
  43. data/test/helper.rb +21 -0
  44. data/test/test_activities_company.rb +51 -0
  45. data/test/test_activities_team.rb +46 -0
  46. data/test/test_activities_user.rb +46 -0
  47. data/test/test_auth.rb +16 -0
  48. data/test/test_client.rb +47 -0
  49. data/test/test_config.rb +25 -0
  50. data/test/test_freelancers_profile.rb +16 -0
  51. data/test/test_freelancers_search.rb +16 -0
  52. data/test/test_hr_clients_applications.rb +21 -0
  53. data/test/test_hr_clients_offers.rb +26 -0
  54. data/test/test_hr_contracts.rb +16 -0
  55. data/test/test_hr_engagements.rb +21 -0
  56. data/test/test_hr_freelancers_applications.rb +21 -0
  57. data/test/test_hr_freelancers_offers.rb +21 -0
  58. data/test/test_hr_interviews.rb +16 -0
  59. data/test/test_hr_jobs.rb +36 -0
  60. data/test/test_hr_roles.rb +21 -0
  61. data/test/test_jobs_profile.rb +16 -0
  62. data/test/test_jobs_search.rb +16 -0
  63. data/test/test_logger.rb +15 -0
  64. data/test/test_mc.rb +41 -0
  65. data/test/test_metadata.rb +36 -0
  66. data/test/test_organization_companies.rb +31 -0
  67. data/test/test_organization_teams.rb +21 -0
  68. data/test/test_organization_users.rb +16 -0
  69. data/test/test_payments.rb +21 -0
  70. data/test/test_reports_finance_accounts.rb +21 -0
  71. data/test/test_reports_finance_billings.rb +36 -0
  72. data/test/test_reports_finance_earnings.rb +36 -0
  73. data/test/test_reports_time.rb +41 -0
  74. data/test/test_snapshot.rb +26 -0
  75. data/test/test_teams.rb +21 -0
  76. data/test/test_workdiary.rb +16 -0
  77. metadata +189 -0
@@ -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
+ module Hr
18
+ # Engagements API
19
+ class Engagements
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 list of engagements
32
+ #
33
+ # Arguments:
34
+ # params: (Hash)
35
+ def get_list(params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/hr/v2/engagements', params
38
+ end
39
+
40
+ # Get specific engagement
41
+ #
42
+ # Arguments:
43
+ # reference: (String)
44
+ def get_specific(reference)
45
+ $LOG.i "running " + __method__.to_s
46
+ @client.get '/hr/v2/engagements/' + reference
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,54 @@
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 Hr
18
+ module Freelancers
19
+ # Freelancer Job Applications API
20
+ class Applications
21
+ ENTRY_POINT = 'api'
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
+ # Get list of applications
33
+ #
34
+ # Arguments:
35
+ # params: (Hash)
36
+ def get_list(params = {})
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.get '/hr/v3/contractors/applications', params
39
+ end
40
+
41
+ # Get specific application
42
+ #
43
+ # Arguments:
44
+ # reference: (String)
45
+ def get_specific(reference)
46
+ $LOG.i "running " + __method__.to_s
47
+ @client.get '/hr/v3/contractors/applications' + reference
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
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 Hr
18
+ module Freelancers
19
+ # Freelancers Job Offers API
20
+ class Offers
21
+ ENTRY_POINT = 'api'
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
+ # Get list of offers
33
+ #
34
+ # Arguments:
35
+ # params: (Hash)
36
+ def get_list(params = {})
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.get '/offers/v1/contractors/offers', params
39
+ end
40
+
41
+ # Get specific offer
42
+ #
43
+ # Arguments:
44
+ # reference: (String)
45
+ def get_specific(reference)
46
+ $LOG.i "running " + __method__.to_s
47
+ @client.get '/offers/v1/clients/offers/' + reference
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,44 @@
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 Hr
18
+ # Interviews workflow
19
+ class Interviews
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
+ # Invite to Interview
32
+ #
33
+ # Arguments:
34
+ # job_key: (String)
35
+ # params: (Hash)
36
+ def invite(job_key, params)
37
+ $LOG.i "running " + __method__.to_s
38
+ @client.post '/hr/v1/jobs/' + job_key + '/candidates', params
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,79 @@
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 Hr
18
+ # Jobs API
19
+ class Jobs
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 list of jobs
32
+ #
33
+ # Arguments:
34
+ # params: (Hash)
35
+ def get_list(params)
36
+ $LOG.i "running " + __method__.to_s
37
+ @client.get '/hr/v2/jobs', params
38
+ end
39
+
40
+ # Get specific job by key
41
+ #
42
+ # Arguments:
43
+ # key: (String)
44
+ def get_specific(key)
45
+ $LOG.i "running " + __method__.to_s
46
+ @client.get '/hr/v2/jobs/' + key
47
+ end
48
+
49
+ # Post a new job
50
+ #
51
+ # Arguments:
52
+ # params: (Hash)
53
+ def post_job(params)
54
+ $LOG.i "running " + __method__.to_s
55
+ @client.post '/hr/v2/jobs', params
56
+ end
57
+
58
+ # Edit existent job
59
+ #
60
+ # Arguments:
61
+ # params: (Hash)
62
+ def edit_job(key, params)
63
+ $LOG.i "running " + __method__.to_s
64
+ @client.put '/hr/v2/jobs/' + key, params
65
+ end
66
+
67
+ # Delete existent job
68
+ #
69
+ # Arguments:
70
+ # params: (Hash)
71
+ def delete_job(key, params)
72
+ $LOG.i "running " + __method__.to_s
73
+ @client.delete '/hr/v2/jobs/' + key, params
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,49 @@
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 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,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
+ 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 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 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,89 @@
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
+ class Mc
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
+ # Get trays
30
+ def get_trays
31
+ $LOG.i "running " + __method__.to_s
32
+ @client.get '/mc/v1/trays'
33
+ end
34
+
35
+ # Get tray by type
36
+ #
37
+ # Arguments:
38
+ # username: (String)
39
+ # type: (String)
40
+ def get_tray_by_type(username, type)
41
+ $LOG.i "running " + __method__.to_s
42
+ @client.get '/mc/v1/trays/' + username + '/' + type
43
+ end
44
+
45
+ # List thread details based on thread id
46
+ #
47
+ # Arguments:
48
+ # username: (String)
49
+ # thread_id: (String)
50
+ def get_thread_details(username, thread_id)
51
+ $LOG.i "running " + __method__.to_s
52
+ @client.get '/mc/v1/threads/' + username + '/' + thread_id
53
+ end
54
+
55
+ # Send new message
56
+ #
57
+ # Arguments:
58
+ # username: (String)
59
+ # params: (Hash)
60
+ def start_new_thread(username, params = {})
61
+ $LOG.i "running " + __method__.to_s
62
+ @client.post '/mc/v1/threads/' + username, params
63
+ end
64
+
65
+ # Reply to existent thread
66
+ #
67
+ # Arguments:
68
+ # username: (String)
69
+ # thread_id: (String)
70
+ # params: (Hash)
71
+ def reply_to_thread(username, thread_id, params = {})
72
+ $LOG.i "running " + __method__.to_s
73
+ @client.post '/mc/v1/threads/' + username + '/' + thread_id, params
74
+ end
75
+
76
+ # Update threads based on user actions
77
+ #
78
+ # Arguments:
79
+ # username: (String)
80
+ # thread_id: (String)
81
+ # params: (Hash)
82
+ def mark_thread(username, thread_id, params = {})
83
+ $LOG.i "running " + __method__.to_s
84
+ @client.put '/mc/v1/threads/' + username + '/' + thread_id, params
85
+ end
86
+ end
87
+ end
88
+ end
89
+ 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
+ # 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
31
+ def get_categories
32
+ $LOG.i "running " + __method__.to_s
33
+ @client.get '/profiles/v1/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 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
+ # 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
@@ -0,0 +1,49 @@
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
+ # 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