upwork-api 1.0.0 → 1.0.1
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/README.md +2 -2
- data/lib/upwork/api/routers/workdays.rb +54 -0
- data/lib/upwork/api/version.rb +1 -1
- data/test/test_workdays.rb +21 -0
- metadata +5 -2
data/README.md
CHANGED
@@ -30,7 +30,7 @@ These are the supported API resources:
|
|
30
30
|
|
31
31
|
# License
|
32
32
|
|
33
|
-
Copyright
|
33
|
+
Copyright 2015 Upwork Corporation. All Rights Reserved.
|
34
34
|
|
35
35
|
ruby-upwork is licensed under the Apache License, Version 2.0 (the "License");
|
36
36
|
you may not use this file except in compliance with the License.
|
@@ -72,7 +72,7 @@ Or install it yourself as:
|
|
72
72
|
## Usage
|
73
73
|
|
74
74
|
1.
|
75
|
-
Follow instructions from `Installation` section.
|
75
|
+
Follow instructions from the `Installation` section.
|
76
76
|
|
77
77
|
2.
|
78
78
|
Open `myapp.rb` and type the `consumer_key` and `consumer_secret` that you previously got from the API Center.
|
@@ -0,0 +1,54 @@
|
|
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 2015(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
|
+
# Workdays
|
18
|
+
class Workdays
|
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 Workdays by Company
|
31
|
+
# Arguments:
|
32
|
+
# company: (String)
|
33
|
+
# from_date: (String)
|
34
|
+
# till_date: (String)
|
35
|
+
# params: (Hash)
|
36
|
+
def get_by_company(company, from_date, till_date, params = {})
|
37
|
+
$LOG.i "running " + __method__.to_s
|
38
|
+
@client.get '/team/v2/workdays/companies/' + company + '/' + from_date + ',' + till_date, params
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get Workdays by Contract
|
42
|
+
# Arguments:
|
43
|
+
# contract: (String)
|
44
|
+
# from_date: (String)
|
45
|
+
# till_date: (String)
|
46
|
+
# params: (Hash)
|
47
|
+
def get_by_contract(contract, from_date, till_date, params = {})
|
48
|
+
$LOG.i "running " + __method__.to_s
|
49
|
+
@client.get '/team/v2/workdays/contracts/' + contract + '/' + from_date + ',' + till_date, params
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/upwork/api/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'helper'
|
5
|
+
require 'upwork/api/routers/workdays'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'mocha/test_unit'
|
8
|
+
|
9
|
+
class WorkdaysTest < Test::Unit::TestCase
|
10
|
+
include TestHelper
|
11
|
+
|
12
|
+
def test_get_by_company
|
13
|
+
api = Upwork::Api::Routers::Workdays.new(get_client_mock)
|
14
|
+
assert api.get_by_company('company', '20140101', '20140131', {})
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_by_contract
|
18
|
+
api = Upwork::Api::Routers::Workdays.new(get_client_mock)
|
19
|
+
assert api.get_by_contract('1234', '20140101', '20140131', {})
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upwork-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/upwork/api/routers/reports/time.rb
|
142
142
|
- lib/upwork/api/routers/snapshot.rb
|
143
143
|
- lib/upwork/api/routers/teams.rb
|
144
|
+
- lib/upwork/api/routers/workdays.rb
|
144
145
|
- lib/upwork/api/routers/workdiary.rb
|
145
146
|
- lib/upwork/api/version.rb
|
146
147
|
- test/helper.rb
|
@@ -177,6 +178,7 @@ files:
|
|
177
178
|
- test/test_reports_time.rb
|
178
179
|
- test/test_snapshot.rb
|
179
180
|
- test/test_teams.rb
|
181
|
+
- test/test_workdays.rb
|
180
182
|
- test/test_workdiary.rb
|
181
183
|
- upwork-api.gemspec
|
182
184
|
homepage: http://developers.upwork.com
|
@@ -239,4 +241,5 @@ test_files:
|
|
239
241
|
- test/test_reports_time.rb
|
240
242
|
- test/test_snapshot.rb
|
241
243
|
- test/test_teams.rb
|
244
|
+
- test/test_workdays.rb
|
242
245
|
- test/test_workdiary.rb
|