lightspeed_restaurant 3.3.1 → 3.3.2

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
  SHA256:
3
- metadata.gz: fcb898002a965d223157c8e9a9fc1f1df746f9ecdaa65d8a4717e6d14629fcdc
4
- data.tar.gz: 915188dfa294dac38cfe8507d4b9d0611cfe992a339c5c8fc9ec38530f3db7f2
3
+ metadata.gz: 94582396ce068181cf1e60528cee1dde19525ada2f0f9200d3cc2f3ca6303f6e
4
+ data.tar.gz: 13e362e37814c125e96846c545c4f621b0a6070bc858d29c47a3b47f79a2146e
5
5
  SHA512:
6
- metadata.gz: 652561c77ab12b27ceb85cd2cbb239be375ee3c5a699a3fb75f319182e2393b7b917de02b43f046f5cfefa602b099526541e2a956754e2eed83eaeeb4d4ab940
7
- data.tar.gz: f1fbcf6e664ae71985fb6de22912f821306e0a768b8686c69c73eb177d6b4cd7f17c338e186ff40449a197bf1feec09ef8a0c8e0050c88c1a8adc021ccc624e9
6
+ metadata.gz: 1433bfa1c87e0aeaa11734dedddf93f8c5615d886b77fcbd5dd00cd026180da5f85d201e198e1ffd601d1a1f8ef01e034ec1eed346b8587fbe3371b5b0ab9fac
7
+ data.tar.gz: 94c4dd4f9599d3b7cd6d2869fd65c94b51cdc43980f032e02a088d09c726baa247e9ce3f4c8d8327d9005a1bc522336442b5e2b73a7f9572a0af3dcbe4634739
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  /vendor/
11
11
  /.idea/
12
+ .DS_Store
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.2 / 2020-03-20
4
+
5
+ - Fix CVE-2020-10663 (Update JSON dependency to 2.3)
6
+
3
7
  ## 3.3.1 / 2020-02-24
4
8
 
5
9
  - Introducing `RateLimitError` when status code is `429`
@@ -4,21 +4,22 @@ module LightspeedRestaurantClient
4
4
  module Operations
5
5
  module Create
6
6
  def create(attributes, configuration = nil)
7
- response = LightspeedRestaurantClient.post(default_resource_path, attributes, {}, configuration)
8
- payload = build_payload(attributes, response)
9
- return new(payload) if is_a?(Class)
7
+ response = JSON.parse(LightspeedRestaurantClient.post(default_resource_path, attributes, {}, configuration))
8
+ response = handle_create_response(response, attributes)
9
+ return new(response) if is_a?(Class)
10
10
 
11
- self.class.new(payload)
11
+ self.class.new(response)
12
12
  end
13
13
 
14
14
  private
15
15
 
16
- def build_payload(attributes, response)
17
- JSON.parse(response)
18
- rescue JSON::ParserError => error
19
- raise error if response.to_i.zero?
20
-
21
- attributes.merge!(id: response.to_i)
16
+ def handle_create_response(response, attributes)
17
+ case response
18
+ when Numeric
19
+ attributes.merge(id: response)
20
+ else
21
+ response
22
+ end
22
23
  end
23
24
  end
24
25
  end
@@ -5,8 +5,8 @@ module LightspeedRestaurantClient
5
5
  module List
6
6
  def list(params = {}, configuration = nil)
7
7
  response = JSON.parse(LightspeedRestaurantClient.get(resource_path, params, configuration))
8
- results = response.is_a?(Array) ? response : response['results']
9
- instantiate(results)
8
+ response = handle_list_response(response)
9
+ instantiate(response)
10
10
  end
11
11
  alias all list
12
12
 
@@ -16,6 +16,15 @@ module LightspeedRestaurantClient
16
16
  respond_to?(:list_resource_path) ? list_resource_path : default_resource_path
17
17
  end
18
18
 
19
+ def handle_list_response(response)
20
+ case response
21
+ when Hash
22
+ response['results']
23
+ else
24
+ response
25
+ end
26
+ end
27
+
19
28
  def instantiate(records)
20
29
  records.map do |record|
21
30
  is_a?(Class) ? new(record) : self.class.new(record)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LightspeedRestaurantClient
4
- VERSION = '3.3.1'
4
+ VERSION = '3.3.2'
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['developers@chronogolf.com']
12
12
 
13
13
  spec.summary = 'Ruby bindings for the Lightspeed Restaurant API'
14
- spec.description = 'Lightspeed Restaurant is point of sale that helps bars, restaurants, '\
14
+ spec.description = 'Lightspeed Restaurant is a Point Of Sale that helps bars, restaurants, '\
15
15
  'and cafés deliver a better customer experience and run a more profitable business. '\
16
16
  'See https://www.lightspeedhq.com/products/restaurant/ for details'
17
17
  spec.homepage = 'https://github.com/chronogolf/lightspeed_restaurant'
@@ -23,9 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency('excon', '~> 0.71.0')
26
- spec.add_dependency('json', '~> 1.8.3')
26
+ spec.add_dependency('json', '~> 2.3')
27
27
 
28
- spec.add_development_dependency('bundler-audit')
29
28
  spec.add_development_dependency('pry')
30
29
  spec.add_development_dependency('rake')
31
30
  spec.add_development_dependency('rspec')
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: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Buffon, Laurent Cobos, Sybil Deboin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -30,28 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.3
33
+ version: '2.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.3
41
- - !ruby/object:Gem::Dependency
42
- name: bundler-audit
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
40
+ version: '2.3'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: pry
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +150,7 @@ dependencies:
164
150
  - - ">="
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
- description: Lightspeed Restaurant is point of sale that helps bars, restaurants,
153
+ description: Lightspeed Restaurant is a Point Of Sale that helps bars, restaurants,
168
154
  and cafés deliver a better customer experience and run a more profitable business.
169
155
  See https://www.lightspeedhq.com/products/restaurant/ for details
170
156
  email:
@@ -234,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
220
  - !ruby/object:Gem::Version
235
221
  version: '0'
236
222
  requirements: []
237
- rubygems_version: 3.0.3
223
+ rubygems_version: 3.0.6
238
224
  signing_key:
239
225
  specification_version: 4
240
226
  summary: Ruby bindings for the Lightspeed Restaurant API