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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/lightspeed_restaurant/operations/create.rb +11 -10
- data/lib/lightspeed_restaurant/operations/list.rb +11 -2
- data/lib/lightspeed_restaurant/version.rb +1 -1
- data/lightspeed_restaurant.gemspec +2 -3
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94582396ce068181cf1e60528cee1dde19525ada2f0f9200d3cc2f3ca6303f6e
|
4
|
+
data.tar.gz: 13e362e37814c125e96846c545c4f621b0a6070bc858d29c47a3b47f79a2146e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1433bfa1c87e0aeaa11734dedddf93f8c5615d886b77fcbd5dd00cd026180da5f85d201e198e1ffd601d1a1f8ef01e034ec1eed346b8587fbe3371b5b0ab9fac
|
7
|
+
data.tar.gz: 94c4dd4f9599d3b7cd6d2869fd65c94b51cdc43980f032e02a088d09c726baa247e9ce3f4c8d8327d9005a1bc522336442b5e2b73a7f9572a0af3dcbe4634739
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
9
|
-
return new(
|
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(
|
11
|
+
self.class.new(response)
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
9
|
-
instantiate(
|
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)
|
@@ -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
|
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', '~>
|
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.
|
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-
|
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:
|
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:
|
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
|
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.
|
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
|