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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d5b0c0cdd1041506917413526f9bc7536404a6f
4
- data.tar.gz: 3f9aa47f4ca6231f3c47dafb38c90b39e1f91388
3
+ metadata.gz: 0a60e2e5c69d662c7fec74859d5064bfe59d7c6a
4
+ data.tar.gz: 7b9144ba8817067678598f29ca49c9bbe5d07fda
5
5
  SHA512:
6
- metadata.gz: 9ab23711635762d662b238257def6b6f805412b9afead99e0867bdf2d7933aecfa116efee0a801c032eb926b7187f78e244fb09f899fcf626ba0e3c4f3fcea8a
7
- data.tar.gz: 247092bbaeaf9cc76af114ce35065f8763cb20125b1ded860036163ea9cc6b71cdf62f4979f19d68121bb7b0c6b7049f92bc97ebbd17317b51b7449f5e4ab937
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')
@@ -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
- connection.send(method, path, params).body
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)
@@ -1,3 +1,3 @@
1
1
  module Wheniwork
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
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.12
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-06 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday