lightspeed_restaurant 3.3.2 → 3.5.0
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/.github/workflows/ci.yml +66 -0
- data/.rubocop.yml +66 -20
- data/.ruby-version +1 -1
- data/CHANGELOG.md +14 -0
- data/README.md +27 -14
- data/lib/lightspeed_restaurant/company.rb +2 -0
- data/lib/lightspeed_restaurant/errors/lightspeed_restaurant_error.rb +1 -6
- data/lib/lightspeed_restaurant/external_payment_provider.rb +22 -0
- data/lib/lightspeed_restaurant/inventory_product.rb +18 -0
- data/lib/lightspeed_restaurant/operations/create.rb +3 -2
- data/lib/lightspeed_restaurant/operations/find.rb +9 -1
- data/lib/lightspeed_restaurant/operations/list.rb +1 -1
- data/lib/lightspeed_restaurant/operations/renew.rb +12 -0
- data/lib/lightspeed_restaurant/request.rb +6 -5
- data/lib/lightspeed_restaurant/version.rb +1 -1
- data/lib/lightspeed_restaurant/webhook.rb +24 -0
- data/lib/lightspeed_restaurant.rb +10 -8
- data/lightspeed_restaurant.gemspec +2 -3
- data/logo.png +0 -0
- metadata +16 -26
- data/.travis.yml +0 -4
- data/circle.yml +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 819c48f8c7338828400e8fd788fa7f5d51951c8e71bd1cd86337dc329a666990
|
|
4
|
+
data.tar.gz: 4ad3e802b271568b2724c8a0a18e66a56c2dbe076f7c6a7efd6fbde14f27fd40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d0e9268772e1021354f60fc515f400d23dff8ea135c6ab5185d35dd2989695f08d52dc94fd8e1fe6003f5b7789e7f358cc043833701a40b523f25fdb783ca7d
|
|
7
|
+
data.tar.gz: 9f53439e6203bfe3ea7426fb44f5c1fc29db25f1c7956221190b99c28a702bb7d572672b213b271250e4df9ded357beea9d0ff02415ec20c4ed7890e2ed8ba2b
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
tests:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby: ['3.3', '3.4.0-preview2']
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@master
|
|
14
|
+
|
|
15
|
+
- name: Set up the Ruby version
|
|
16
|
+
uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
ruby-version: '3.3'
|
|
19
|
+
bundler-cache: true
|
|
20
|
+
|
|
21
|
+
- name: Ruby gem cache
|
|
22
|
+
uses: actions/cache@v4
|
|
23
|
+
with:
|
|
24
|
+
path: vendor/bundle
|
|
25
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
${{ runner.os }}-gems-
|
|
28
|
+
|
|
29
|
+
- name: Set up the environment
|
|
30
|
+
run: |
|
|
31
|
+
bundle config path vendor/bundle
|
|
32
|
+
bundle install --jobs 4 --retry 3
|
|
33
|
+
|
|
34
|
+
- name: Runs tests
|
|
35
|
+
run: bundle exec rspec
|
|
36
|
+
|
|
37
|
+
rubocop:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
strategy:
|
|
40
|
+
matrix:
|
|
41
|
+
ruby: ['3.3', '3.4.0-preview2']
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@master
|
|
45
|
+
|
|
46
|
+
- name: Set up the Ruby version
|
|
47
|
+
uses: ruby/setup-ruby@v1
|
|
48
|
+
with:
|
|
49
|
+
ruby-version: '3.3'
|
|
50
|
+
bundler-cache: true
|
|
51
|
+
|
|
52
|
+
- name: Ruby gem cache
|
|
53
|
+
uses: actions/cache@v4
|
|
54
|
+
with:
|
|
55
|
+
path: vendor/bundle
|
|
56
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
57
|
+
restore-keys: |
|
|
58
|
+
${{ runner.os }}-gems-
|
|
59
|
+
|
|
60
|
+
- name: Set up the environment
|
|
61
|
+
run: |
|
|
62
|
+
bundle config path vendor/bundle
|
|
63
|
+
bundle install --jobs 4 --retry 3
|
|
64
|
+
|
|
65
|
+
- name: Runs Rubocop
|
|
66
|
+
run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
|
@@ -1,44 +1,87 @@
|
|
|
1
1
|
require: rubocop-rspec
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Gemspec/RequiredRubyVersion:
|
|
4
|
+
Enabled: false
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Layout/LineLength:
|
|
7
|
+
Enabled: false
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Layout/MultilineMethodCallIndentation:
|
|
10
|
+
Enabled: false
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
Lint/ConstantDefinitionInBlock:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Lint/MissingSuper:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Lint/NonDeterministicRequireOrder:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Lint/SuppressedException:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Lint/ToJSON:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Lint/UselessMethodDefinition:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
Metrics/AbcSize:
|
|
31
|
+
Enabled: false
|
|
18
32
|
|
|
19
33
|
Metrics/BlockLength:
|
|
20
34
|
Severity: warning
|
|
21
35
|
Exclude:
|
|
22
36
|
- spec/**/*
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
Metrics/ClassLength:
|
|
39
|
+
Max: 200
|
|
40
|
+
Severity: warning
|
|
41
|
+
|
|
42
|
+
Metrics/ParameterLists:
|
|
43
|
+
Max: 6
|
|
44
|
+
MaxOptionalParameters: 6
|
|
45
|
+
|
|
46
|
+
Metrics/MethodLength:
|
|
47
|
+
Max: 15
|
|
48
|
+
|
|
49
|
+
Naming/BinaryOperatorParameterName:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
RSpec/ContextWording:
|
|
53
|
+
Enabled: false
|
|
54
|
+
|
|
55
|
+
RSpec/InstanceVariable:
|
|
56
|
+
Enabled: false
|
|
57
|
+
|
|
58
|
+
RSpec/LeakyConstantDeclaration:
|
|
25
59
|
Enabled: false
|
|
26
60
|
|
|
27
61
|
RSpec/MultipleExpectations:
|
|
28
62
|
Max: 3
|
|
29
63
|
|
|
30
|
-
|
|
64
|
+
RSpec/MessageSpies:
|
|
31
65
|
Enabled: false
|
|
32
66
|
|
|
33
|
-
|
|
67
|
+
RSpec/NoExpectationExample:
|
|
34
68
|
Enabled: false
|
|
35
69
|
|
|
36
|
-
|
|
70
|
+
RSpec/StubbedMock:
|
|
71
|
+
Enabled: false
|
|
72
|
+
|
|
73
|
+
RSpec/ExampleLength:
|
|
37
74
|
Enabled: false
|
|
38
75
|
|
|
39
76
|
Style/ClassAndModuleChildren:
|
|
40
77
|
Enabled: false
|
|
41
78
|
|
|
79
|
+
Style/Documentation:
|
|
80
|
+
Enabled: false
|
|
81
|
+
|
|
82
|
+
Style/NumericLiterals:
|
|
83
|
+
Enabled: false
|
|
84
|
+
|
|
42
85
|
Style/PercentLiteralDelimiters:
|
|
43
86
|
PreferredDelimiters:
|
|
44
87
|
default: ()
|
|
@@ -48,9 +91,12 @@ Style/PercentLiteralDelimiters:
|
|
|
48
91
|
'%w': '[]'
|
|
49
92
|
'%W': '[]'
|
|
50
93
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
94
|
+
Style/StringLiterals:
|
|
95
|
+
EnforcedStyle: single_quotes
|
|
96
|
+
SupportedStyles:
|
|
97
|
+
- single_quotes
|
|
98
|
+
- double_quotes
|
|
99
|
+
ConsistentQuotesInMultiline: false
|
|
54
100
|
|
|
55
|
-
|
|
101
|
+
Security/YAMLLoad:
|
|
56
102
|
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-
|
|
1
|
+
ruby-3.3.6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.5.0 / 2024-12-10
|
|
4
|
+
|
|
5
|
+
- Add `externalPaymentProvider` resource endpoints
|
|
6
|
+
- Add `webhook` resource endpoints
|
|
7
|
+
- Upgrade ruby version to 3.3.6
|
|
8
|
+
|
|
9
|
+
## 3.4.0 / 2021-04-08
|
|
10
|
+
|
|
11
|
+
- Add `find` endpoint for the InventoryProduct
|
|
12
|
+
|
|
13
|
+
## 3.3.3 / 2021-04-08
|
|
14
|
+
|
|
15
|
+
- Add `find` endpoint for the company
|
|
16
|
+
|
|
3
17
|
## 3.3.2 / 2020-03-20
|
|
4
18
|
|
|
5
19
|
- Fix CVE-2020-10663 (Update JSON dependency to 2.3)
|
data/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Lightspeed Restaurant API Client
|
|
2
2
|
|
|
3
|
-
[](https://gemnasium.com/chronogolf/lightspeed_restaurant) [](https://codeclimate.com/github/chronogolf/lightspeed_restaurant) [](https://badge.fury.io/rb/lightspeed_restaurant)
|
|
3
|
+
[](https://codeclimate.com/github/chronogolf/lightspeed_restaurant) [](https://badge.fury.io/rb/lightspeed_restaurant)
|
|
5
4
|
|
|
6
|
-
[Lightspeed Restaurant API Client](https://github.com/chronogolf/lightspeed_restaurant) is a gem for interacting with [Lightspeed Restaurant](https://www.lightspeedhq.com/
|
|
5
|
+
[Lightspeed Restaurant API Client](https://github.com/chronogolf/lightspeed_restaurant) is a gem for interacting with [Lightspeed Restaurant](https://www.lightspeedhq.com/pos/restaurant/) API.
|
|
7
6
|
Lightspeed Restaurant is point of sale that helps bars, restaurants, and cafés deliver a better customer experience and run a more profitable business.
|
|
8
7
|
|
|
9
8
|
## Installation
|
|
@@ -11,7 +10,7 @@ Lightspeed Restaurant is point of sale that helps bars, restaurants, and cafés
|
|
|
11
10
|
Add this line to your application's Gemfile:
|
|
12
11
|
|
|
13
12
|
```ruby
|
|
14
|
-
gem
|
|
13
|
+
gem "lightspeed_restaurant"
|
|
15
14
|
```
|
|
16
15
|
|
|
17
16
|
And then execute:
|
|
@@ -27,23 +26,29 @@ Or install it yourself as:
|
|
|
27
26
|
### Basic Usage
|
|
28
27
|
|
|
29
28
|
First, set your api token:
|
|
29
|
+
|
|
30
30
|
```ruby
|
|
31
31
|
LightspeedRestaurantClient.api_token = "YOUR_API_TOKEN_HERE"
|
|
32
32
|
```
|
|
33
|
+
|
|
33
34
|
Next, make requests using the resource class you need:
|
|
35
|
+
|
|
34
36
|
```ruby
|
|
35
37
|
customers = LightspeedRestaurantClient::Customer.all
|
|
36
38
|
customer = customers.first
|
|
37
|
-
customer.firstName =
|
|
39
|
+
customer.firstName = "Tom"
|
|
38
40
|
customer.save
|
|
39
41
|
```
|
|
40
|
-
|
|
42
|
+
|
|
43
|
+
That"s it!
|
|
41
44
|
|
|
42
45
|
### Using a custom API configuration per action
|
|
46
|
+
|
|
43
47
|
Each action support a configuration object as the last param, allows you to setup `api_token`, `base_uri`
|
|
44
48
|
Sample usage:
|
|
49
|
+
|
|
45
50
|
```ruby
|
|
46
|
-
LightspeedRestaurantClient::Customer.all(LightspeedRestaurantClient.default_configuration.with(api_token:
|
|
51
|
+
LightspeedRestaurantClient::Customer.all(LightspeedRestaurantClient.default_configuration.with(api_token: "MY_OTHER_TOKEN", base_uri: "other_ls_resto_uri"))
|
|
47
52
|
```
|
|
48
53
|
|
|
49
54
|
### Available operations
|
|
@@ -55,28 +60,33 @@ LightspeedRestaurantClient::Customer.all
|
|
|
55
60
|
```
|
|
56
61
|
|
|
57
62
|
#### Find
|
|
63
|
+
|
|
58
64
|
```ruby
|
|
59
65
|
LightspeedRestaurantClient::Customer.find(123)
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
#### Create
|
|
69
|
+
|
|
63
70
|
```ruby
|
|
64
|
-
LightspeedRestaurantClient::Customer.create(...firstName:
|
|
71
|
+
LightspeedRestaurantClient::Customer.create(...firstName: "Tom", email: "tom@brady.com"...)
|
|
65
72
|
```
|
|
66
73
|
|
|
67
74
|
#### Update
|
|
75
|
+
|
|
68
76
|
```ruby
|
|
69
|
-
LightspeedRestaurantClient::Customer.update(123, { email:
|
|
77
|
+
LightspeedRestaurantClient::Customer.update(123, { email: "tom@brady.com" })
|
|
70
78
|
```
|
|
71
79
|
|
|
72
80
|
#### Save
|
|
81
|
+
|
|
73
82
|
```ruby
|
|
74
83
|
customer = LightspeedRestaurantClient::Customer.find(123)
|
|
75
|
-
customer.firstName =
|
|
84
|
+
customer.firstName = "Micheal"
|
|
76
85
|
customer.save
|
|
77
86
|
```
|
|
78
87
|
|
|
79
88
|
#### Destroy
|
|
89
|
+
|
|
80
90
|
```ruby
|
|
81
91
|
customer = LightspeedRestaurantClient::Customer.find(123)
|
|
82
92
|
customer.destroy
|
|
@@ -86,6 +96,7 @@ customer.destroy
|
|
|
86
96
|
|
|
87
97
|
By default the logs are done on STDOUT.
|
|
88
98
|
You can specify your own logger (it has to respond to info and error methods, like the Rails logger) :
|
|
99
|
+
|
|
89
100
|
```ruby
|
|
90
101
|
LightspeedRestaurantClient.logger = "YOUR_LOGGER"
|
|
91
102
|
```
|
|
@@ -95,13 +106,15 @@ LightspeedRestaurantClient.logger = "YOUR_LOGGER"
|
|
|
95
106
|
Pull requests are welcome on GitHub at https://github.com/chronogolf/lightspeed_restaurant.
|
|
96
107
|
|
|
97
108
|
## About Us
|
|
98
|
-
[![Chronogolf][crest]](https://www.chronogolf.com)
|
|
99
109
|
|
|
100
|
-
[Chronogolf](https://www.
|
|
110
|
+
[![Chronogolf by Lightspeed][crest]](https://www.lightspeedhq.com)
|
|
111
|
+
|
|
112
|
+
[Chronogolf by Lightspeed](https://www.lightspeedhq.com/golf/)'s mission is to facilitate the interactions between golf managers and golf players. We are building software that allows golf directors to better manage their course, together with a marketplace to find & book games in real-time. We are constantly innovating and trying to challenge the status quo.
|
|
101
113
|
|
|
102
|
-
|
|
114
|
+
Learn more at [https://www.lightspeedhq.com/golf/](https://www.lightspeedhq.com/golf/)
|
|
103
115
|
|
|
104
116
|
## Future Improvements
|
|
117
|
+
|
|
105
118
|
- Improve destroy operation to handle destroy by passing an ID (or an array of IDs)
|
|
106
119
|
- Add missing resources (Company, Reservation, Floor, Table...)
|
|
107
120
|
- Improve test coverage
|
|
@@ -110,4 +123,4 @@ Find more informations at https://pro.chronogolf.com
|
|
|
110
123
|
|
|
111
124
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
112
125
|
|
|
113
|
-
[crest]:
|
|
126
|
+
[crest]: ./logo.png
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'lightspeed_restaurant/base'
|
|
4
|
+
require 'lightspeed_restaurant/operations/find'
|
|
4
5
|
require 'lightspeed_restaurant/operations/list'
|
|
5
6
|
|
|
6
7
|
module LightspeedRestaurantClient
|
|
7
8
|
class Company < LightspeedRestaurantClient::Base
|
|
9
|
+
extend Operations::Find
|
|
8
10
|
extend Operations::List
|
|
9
11
|
|
|
10
12
|
def self.resource_name
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module LightspeedRestaurantClient
|
|
4
4
|
class LightspeedRestaurantClientError < StandardError
|
|
5
|
-
attr_reader :message
|
|
6
|
-
attr_reader :http_status
|
|
7
|
-
attr_reader :http_body
|
|
8
|
-
attr_reader :http_headers
|
|
9
|
-
attr_reader :request_id
|
|
10
|
-
attr_reader :json_body
|
|
5
|
+
attr_reader :message, :http_status, :http_body, :http_headers, :request_id, :json_body
|
|
11
6
|
|
|
12
7
|
def initialize(message = nil, http_status = nil, http_body = nil, http_headers = nil)
|
|
13
8
|
@message = message
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'lightspeed_restaurant/base'
|
|
4
|
+
require 'lightspeed_restaurant/operations/list'
|
|
5
|
+
require 'lightspeed_restaurant/operations/find'
|
|
6
|
+
require 'lightspeed_restaurant/operations/create'
|
|
7
|
+
|
|
8
|
+
module LightspeedRestaurantClient
|
|
9
|
+
class ExternalPaymentProvider < LightspeedRestaurantClient::Base
|
|
10
|
+
extend Operations::Create
|
|
11
|
+
extend Operations::Find
|
|
12
|
+
extend Operations::List
|
|
13
|
+
|
|
14
|
+
def self.resource_name
|
|
15
|
+
'externalPaymentProvider'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.default_resource_path
|
|
19
|
+
"/rest/partner/v1/#{resource_name}/"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'lightspeed_restaurant/base'
|
|
4
|
+
require 'lightspeed_restaurant/operations/find'
|
|
5
|
+
|
|
6
|
+
module LightspeedRestaurantClient
|
|
7
|
+
class InventoryProduct < LightspeedRestaurantClient::Base
|
|
8
|
+
extend Operations::Find
|
|
9
|
+
|
|
10
|
+
def self.resource_name
|
|
11
|
+
'Inventory/Product'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.default_resource_path
|
|
15
|
+
"/rest/#{resource_name.downcase}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -14,9 +14,10 @@ module LightspeedRestaurantClient
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
16
|
def handle_create_response(response, attributes)
|
|
17
|
-
|
|
18
|
-
when Numeric
|
|
17
|
+
if response.is_a?(Numeric)
|
|
19
18
|
attributes.merge(id: response)
|
|
19
|
+
elsif self == LightspeedRestaurantClient::ExternalPaymentProvider
|
|
20
|
+
response.merge(id: response['data']['id'])
|
|
20
21
|
else
|
|
21
22
|
response
|
|
22
23
|
end
|
|
@@ -4,9 +4,17 @@ module LightspeedRestaurantClient
|
|
|
4
4
|
module Operations
|
|
5
5
|
module Find
|
|
6
6
|
def find(id, configuration = nil)
|
|
7
|
-
response = JSON.parse(LightspeedRestaurantClient.get(default_resource_path +
|
|
7
|
+
response = JSON.parse(LightspeedRestaurantClient.get(default_resource_path + id_path(id), {}, configuration))
|
|
8
8
|
new(response)
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def id_path(id)
|
|
14
|
+
return id.to_s if self == LightspeedRestaurantClient::ExternalPaymentProvider
|
|
15
|
+
|
|
16
|
+
"/#{id}"
|
|
17
|
+
end
|
|
10
18
|
end
|
|
11
19
|
end
|
|
12
20
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LightspeedRestaurantClient
|
|
4
|
+
module Operations
|
|
5
|
+
module Renew
|
|
6
|
+
def renew(id, configuration = nil)
|
|
7
|
+
response = JSON.parse(LightspeedRestaurantClient.post("#{default_resource_path}/#{id}/renew", {}, {}, configuration))
|
|
8
|
+
new(response)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -6,6 +6,7 @@ require 'lightspeed_restaurant/errors/authentication_error'
|
|
|
6
6
|
require 'lightspeed_restaurant/errors/invalid_request_error'
|
|
7
7
|
require 'lightspeed_restaurant/errors/not_found_error'
|
|
8
8
|
require 'lightspeed_restaurant/errors/rate_limit_error'
|
|
9
|
+
require 'lightspeed_restaurant/errors/unauthorized_error'
|
|
9
10
|
require 'uri'
|
|
10
11
|
|
|
11
12
|
module LightspeedRestaurantClient
|
|
@@ -19,7 +20,7 @@ module LightspeedRestaurantClient
|
|
|
19
20
|
@headers = { 'Content-Type' => 'application/json', 'X-Auth-Token' => token }
|
|
20
21
|
@body = body.to_json
|
|
21
22
|
@query = query
|
|
22
|
-
@path =
|
|
23
|
+
@path = "/PosServer#{path}"
|
|
23
24
|
@connection = Excon.new(@base_uri)
|
|
24
25
|
@logger = logger || begin
|
|
25
26
|
require 'logger'
|
|
@@ -73,22 +74,22 @@ module LightspeedRestaurantClient
|
|
|
73
74
|
|
|
74
75
|
def response_object_error(response)
|
|
75
76
|
APIError.new("Invalid response object from API: #{JSON.parse(response.body)['description']}",
|
|
76
|
-
|
|
77
|
+
response.status, response.body, response.headers)
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
def invalid_request_error(response)
|
|
80
81
|
InvalidRequestError.new(JSON.parse(response.body)['description'],
|
|
81
|
-
|
|
82
|
+
response.status, response.body, response.headers)
|
|
82
83
|
end
|
|
83
84
|
|
|
84
85
|
def authentication_error(response)
|
|
85
86
|
AuthenticationError.new(JSON.parse(response.body)['description'],
|
|
86
|
-
|
|
87
|
+
response.status, response.body, response.headers)
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
def rate_limit_error(response)
|
|
90
91
|
RateLimitError.new(JSON.parse(response.body)['description'],
|
|
91
|
-
|
|
92
|
+
response.status, response.body, response.headers)
|
|
92
93
|
end
|
|
93
94
|
end
|
|
94
95
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'lightspeed_restaurant/base'
|
|
4
|
+
require 'lightspeed_restaurant/operations/list'
|
|
5
|
+
require 'lightspeed_restaurant/operations/find'
|
|
6
|
+
require 'lightspeed_restaurant/operations/create'
|
|
7
|
+
require 'lightspeed_restaurant/operations/renew'
|
|
8
|
+
|
|
9
|
+
module LightspeedRestaurantClient
|
|
10
|
+
class Webhook < LightspeedRestaurantClient::Base
|
|
11
|
+
extend Operations::Create
|
|
12
|
+
extend Operations::List
|
|
13
|
+
extend Operations::Find
|
|
14
|
+
extend Operations::Renew
|
|
15
|
+
|
|
16
|
+
def self.resource_name
|
|
17
|
+
'Webhooks'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.default_resource_path
|
|
21
|
+
"/rest/v1/#{resource_name.downcase}/subscriptions"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
require 'excon'
|
|
7
7
|
require 'json'
|
|
8
8
|
|
|
9
|
-
require 'lightspeed_restaurant/
|
|
10
|
-
require 'lightspeed_restaurant/request'
|
|
9
|
+
require 'lightspeed_restaurant/company'
|
|
11
10
|
require 'lightspeed_restaurant/configuration'
|
|
12
|
-
|
|
13
|
-
require 'lightspeed_restaurant/customer'
|
|
14
11
|
require 'lightspeed_restaurant/customer_credit_change'
|
|
15
|
-
require 'lightspeed_restaurant/customer_loyalty_card'
|
|
16
12
|
require 'lightspeed_restaurant/customer_establishment_order'
|
|
17
|
-
require 'lightspeed_restaurant/
|
|
18
|
-
require 'lightspeed_restaurant/
|
|
13
|
+
require 'lightspeed_restaurant/customer_loyalty_card'
|
|
14
|
+
require 'lightspeed_restaurant/customer'
|
|
15
|
+
require 'lightspeed_restaurant/external_payment_provider'
|
|
16
|
+
require 'lightspeed_restaurant/inventory_product'
|
|
19
17
|
require 'lightspeed_restaurant/payment_type'
|
|
20
|
-
require 'lightspeed_restaurant/product_group'
|
|
21
18
|
require 'lightspeed_restaurant/product_group_product'
|
|
19
|
+
require 'lightspeed_restaurant/product_group'
|
|
20
|
+
require 'lightspeed_restaurant/receipt'
|
|
21
|
+
require 'lightspeed_restaurant/request'
|
|
22
|
+
require 'lightspeed_restaurant/version'
|
|
23
|
+
require 'lightspeed_restaurant/webhook'
|
|
22
24
|
|
|
23
25
|
module LightspeedRestaurantClient
|
|
24
26
|
class << self
|
|
@@ -22,13 +22,12 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.require_paths = ['lib']
|
|
24
24
|
|
|
25
|
-
spec.add_dependency('excon', '~> 0.
|
|
26
|
-
spec.add_dependency('json', '~> 2.
|
|
25
|
+
spec.add_dependency('excon', '~> 0.91.0')
|
|
26
|
+
spec.add_dependency('json', '~> 2.6.1')
|
|
27
27
|
|
|
28
28
|
spec.add_development_dependency('pry')
|
|
29
29
|
spec.add_development_dependency('rake')
|
|
30
30
|
spec.add_development_dependency('rspec')
|
|
31
|
-
spec.add_development_dependency('rspec_junit_formatter')
|
|
32
31
|
spec.add_development_dependency('rubocop')
|
|
33
32
|
spec.add_development_dependency('rubocop-rspec')
|
|
34
33
|
spec.add_development_dependency('vcr')
|
data/logo.png
ADDED
|
Binary file
|
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.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Olivier Buffon, Laurent Cobos, Sybil Deboin
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: excon
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.91.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.91.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: json
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 2.6.1
|
|
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:
|
|
40
|
+
version: 2.6.1
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: pry
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,20 +80,6 @@ dependencies:
|
|
|
80
80
|
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rspec_junit_formatter
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
83
|
- !ruby/object:Gem::Dependency
|
|
98
84
|
name: rubocop
|
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -159,12 +145,12 @@ executables: []
|
|
|
159
145
|
extensions: []
|
|
160
146
|
extra_rdoc_files: []
|
|
161
147
|
files:
|
|
148
|
+
- ".github/workflows/ci.yml"
|
|
162
149
|
- ".gitignore"
|
|
163
150
|
- ".rspec"
|
|
164
151
|
- ".rubocop.yml"
|
|
165
152
|
- ".ruby-gemset"
|
|
166
153
|
- ".ruby-version"
|
|
167
|
-
- ".travis.yml"
|
|
168
154
|
- CHANGELOG.md
|
|
169
155
|
- Gemfile
|
|
170
156
|
- LICENSE.txt
|
|
@@ -172,7 +158,6 @@ files:
|
|
|
172
158
|
- Rakefile
|
|
173
159
|
- bin/console
|
|
174
160
|
- bin/setup
|
|
175
|
-
- circle.yml
|
|
176
161
|
- lib/lightspeed_restaurant.rb
|
|
177
162
|
- lib/lightspeed_restaurant/base.rb
|
|
178
163
|
- lib/lightspeed_restaurant/company.rb
|
|
@@ -188,10 +173,13 @@ files:
|
|
|
188
173
|
- lib/lightspeed_restaurant/errors/not_found_error.rb
|
|
189
174
|
- lib/lightspeed_restaurant/errors/rate_limit_error.rb
|
|
190
175
|
- lib/lightspeed_restaurant/errors/unauthorized_error.rb
|
|
176
|
+
- lib/lightspeed_restaurant/external_payment_provider.rb
|
|
177
|
+
- lib/lightspeed_restaurant/inventory_product.rb
|
|
191
178
|
- lib/lightspeed_restaurant/operations/create.rb
|
|
192
179
|
- lib/lightspeed_restaurant/operations/destroy.rb
|
|
193
180
|
- lib/lightspeed_restaurant/operations/find.rb
|
|
194
181
|
- lib/lightspeed_restaurant/operations/list.rb
|
|
182
|
+
- lib/lightspeed_restaurant/operations/renew.rb
|
|
195
183
|
- lib/lightspeed_restaurant/operations/save.rb
|
|
196
184
|
- lib/lightspeed_restaurant/operations/update.rb
|
|
197
185
|
- lib/lightspeed_restaurant/payment_type.rb
|
|
@@ -200,12 +188,14 @@ files:
|
|
|
200
188
|
- lib/lightspeed_restaurant/receipt.rb
|
|
201
189
|
- lib/lightspeed_restaurant/request.rb
|
|
202
190
|
- lib/lightspeed_restaurant/version.rb
|
|
191
|
+
- lib/lightspeed_restaurant/webhook.rb
|
|
203
192
|
- lightspeed_restaurant.gemspec
|
|
193
|
+
- logo.png
|
|
204
194
|
homepage: https://github.com/chronogolf/lightspeed_restaurant
|
|
205
195
|
licenses:
|
|
206
196
|
- MIT
|
|
207
197
|
metadata: {}
|
|
208
|
-
post_install_message:
|
|
198
|
+
post_install_message:
|
|
209
199
|
rdoc_options: []
|
|
210
200
|
require_paths:
|
|
211
201
|
- lib
|
|
@@ -220,8 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
220
210
|
- !ruby/object:Gem::Version
|
|
221
211
|
version: '0'
|
|
222
212
|
requirements: []
|
|
223
|
-
rubygems_version: 3.
|
|
224
|
-
signing_key:
|
|
213
|
+
rubygems_version: 3.5.11
|
|
214
|
+
signing_key:
|
|
225
215
|
specification_version: 4
|
|
226
216
|
summary: Ruby bindings for the Lightspeed Restaurant API
|
|
227
217
|
test_files: []
|
data/.travis.yml
DELETED
data/circle.yml
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
machine:
|
|
2
|
-
timezone:
|
|
3
|
-
America/New_York
|
|
4
|
-
environment:
|
|
5
|
-
RACK_ENV: test
|
|
6
|
-
test:
|
|
7
|
-
override:
|
|
8
|
-
- bundle exec bundle-audit check --update
|
|
9
|
-
- bundle exec rubocop
|
|
10
|
-
- bundle exec rspec --format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/junit/rspec.xml --format progress
|