lightspeed_restaurant 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '03778001aab334ef23c2f7fbb1d399f2ffdd7038'
4
- data.tar.gz: 288c132884c84ba602e8e7f2f5e9c1e368acce28
3
+ metadata.gz: 1a4c9f58fe22f8a8a77cb2be5d2032996e453f08
4
+ data.tar.gz: 6ffb93f47a7ebfbc09856d9ba84c5d61ab3e87af
5
5
  SHA512:
6
- metadata.gz: '08c2ec16b63142cddaa01ab51c68139179690b7eb030105fb00ae2bcb9f188fcc67ad4e8c256aa7d2b884d30dbef9d8a03aa4bb4f350ad47c6ad1ed649d17a9a'
7
- data.tar.gz: 3ad0e2e5b7153854be241addde5987bed5b2d3061e2d049ea96ea9c5540e7aeab656e5e3be539d2247ddb28b4c18fa9309c8e8ddc02caf3edfd623ceb7f8c119
6
+ metadata.gz: 758a789a28515b0e3aaf4c496e7395bab6b48ae1847ba0a0198d8470e3ce4270ad8ac896393755409ae39b628da2d99cabdb783e84985738ed6882806e6eaf46
7
+ data.tar.gz: b5d95d5e6e7e3300e97274c9e08fdba70d3033b4d39ce9db9751c35f0273223ca19122dac0315517db7596ee7e954bb4c9796aeff136615abc8f94209222f0af
@@ -3,8 +3,19 @@ module LightspeedRestaurantClient
3
3
  module Update
4
4
  def update(id, attributes)
5
5
  updated_object = new(attributes)
6
- LightspeedRestaurantClient.put(resource_path + "/#{id}", updated_object)
7
- updated_object
6
+ response = LightspeedRestaurantClient.put(resource_path + "/#{id}", updated_object)
7
+ new(build_payload(attributes, response))
8
+ end
9
+
10
+ private
11
+
12
+ def build_payload(attributes, response)
13
+ begin
14
+ return JSON.parse(response)
15
+ rescue JSON::ParserError => error
16
+ raise error if response.to_i.zero?
17
+ end
18
+ attributes.merge!(id: response.to_i)
8
19
  end
9
20
  end
10
21
  end
@@ -1,3 +1,3 @@
1
1
  module LightspeedRestaurantClient
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightspeed_restaurant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Buffon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon