wheniwork_ext 0.0.12 → 0.0.13
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.
- checksums.yaml +4 -4
- data/lib/wheniwork/client/shifts.rb +5 -0
- data/lib/wheniwork/request.rb +15 -3
- data/lib/wheniwork/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a60e2e5c69d662c7fec74859d5064bfe59d7c6a
|
|
4
|
+
data.tar.gz: 7b9144ba8817067678598f29ca49c9bbe5d07fda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a5771ed2f9eb2595373a9f99fee0b73a9aba5b580cfa595bf46de913d21c5d82bedacf3a3ad6519228121eb91e29132fb25bb03cba0c20958f775fa86402db4
|
|
7
|
+
data.tar.gz: a91d2bd3740c800009be15bef0c62327a201a31bd57a96fb3594e7fc83c3b77470c543909d08f9693fdc3bb9914a8f5f8083bc347e7346b7146b34e19bc57050
|
|
@@ -5,6 +5,11 @@ module WhenIWork
|
|
|
5
5
|
get 'positions', params, options.merge(key: 'wheniwork_positions')
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
def shifts_by_users(user_ids, params = {}, options = {})
|
|
9
|
+
users_str = user_ids.join(',')
|
|
10
|
+
get "shifts?user_id=#{users_str}", params, options.merge(key: 'wheniwork_shifts')
|
|
11
|
+
end
|
|
12
|
+
|
|
8
13
|
|
|
9
14
|
def shifts(params = {}, options = {})
|
|
10
15
|
get 'shifts', params, options.merge(key: 'wheniwork_shifts')
|
data/lib/wheniwork/request.rb
CHANGED
|
@@ -10,17 +10,29 @@ module WhenIWork
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def request(method, path, params, cache_options)
|
|
13
|
+
json_params = params.to_json
|
|
13
14
|
if cache_enabled
|
|
14
15
|
key = cache_options.delete(:key) || cache_key_for(path, params)
|
|
15
16
|
options = default_options.merge(cache_options)
|
|
16
17
|
|
|
17
18
|
cache_store.fetch(key, options) do
|
|
18
|
-
|
|
19
|
+
if method == :post
|
|
20
|
+
puts json_params.to_s
|
|
21
|
+
response = Faraday.post do |req|
|
|
22
|
+
req.url endpoint+'/'+path
|
|
23
|
+
req.headers['Content-Type'] = 'application/json'
|
|
24
|
+
req.headers['W-Token'] = token
|
|
25
|
+
req.body = json_params.to_s
|
|
26
|
+
end
|
|
27
|
+
response.body
|
|
28
|
+
else
|
|
29
|
+
connection.send(method, path, params).body
|
|
30
|
+
end
|
|
19
31
|
end
|
|
20
32
|
else
|
|
21
33
|
connection.send(method, path, params).body
|
|
22
|
-
end
|
|
23
|
-
|
|
34
|
+
end
|
|
35
|
+
|
|
24
36
|
end
|
|
25
37
|
|
|
26
38
|
def cache_key_for(uri, params)
|
data/lib/wheniwork/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wheniwork_ext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Imran Haider
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-05-
|
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|