lightspeed_restaurant 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/lightspeed_restaurant.rb +1 -1
- data/lib/lightspeed_restaurant/base.rb +1 -1
- data/lib/lightspeed_restaurant/company.rb +2 -2
- data/lib/lightspeed_restaurant/customer.rb +2 -2
- data/lib/lightspeed_restaurant/customer_credit_change.rb +2 -2
- data/lib/lightspeed_restaurant/errors/api_error.rb +2 -2
- data/lib/lightspeed_restaurant/errors/authentication_error.rb +2 -2
- data/lib/lightspeed_restaurant/errors/invalid_request_error.rb +2 -2
- data/lib/lightspeed_restaurant/errors/lightspeed_restaurant_error.rb +2 -2
- data/lib/lightspeed_restaurant/errors/not_found_error.rb +2 -2
- data/lib/lightspeed_restaurant/errors/unauthorized_error.rb +2 -2
- data/lib/lightspeed_restaurant/operations/create.rb +2 -2
- data/lib/lightspeed_restaurant/operations/destroy.rb +2 -2
- data/lib/lightspeed_restaurant/operations/find.rb +2 -2
- data/lib/lightspeed_restaurant/operations/list.rb +2 -2
- data/lib/lightspeed_restaurant/operations/save.rb +2 -2
- data/lib/lightspeed_restaurant/operations/update.rb +2 -2
- data/lib/lightspeed_restaurant/receipt.rb +2 -2
- data/lib/lightspeed_restaurant/request.rb +1 -1
- data/lib/lightspeed_restaurant/version.rb +2 -2
- data/lightspeed_restaurant.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0186cb16478695e6d02aff5fe4b6e2711a43fda
|
4
|
+
data.tar.gz: 106ec14d75d86227e7b1a5de915425298e229e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3830ef03d1aead52f6349f4e6a19842f13b8250a85e648049ab816dee2f25dcf8772ec75d5c45125fe14f8992c27a3edd8f03ef40ac283d4729979e14d3be1
|
7
|
+
data.tar.gz: d2767d9d5e12d7c7c169b627b8dae25aa5134505694e9710f7d10ecebc44b541527dae1ea73572bab4d811865f0577d1e472dace3203ed580df54af8cd8aa67c
|
data/README.md
CHANGED
@@ -27,11 +27,11 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
First, set your api token:
|
29
29
|
```ruby
|
30
|
-
|
30
|
+
LightspeedRestaurantClient.api_token = "YOUR_API_TOKEN_HERE"
|
31
31
|
```
|
32
32
|
Next, make requests using the resource class you need:
|
33
33
|
```ruby
|
34
|
-
customers =
|
34
|
+
customers = LightspeedRestaurantClient::Customer.all
|
35
35
|
customer = customers.first
|
36
36
|
customer.firstName = 'Tom'
|
37
37
|
customer.save
|
@@ -43,34 +43,34 @@ That's it!
|
|
43
43
|
#### List
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
|
46
|
+
LightspeedRestaurantClient::Customer.all
|
47
47
|
```
|
48
48
|
|
49
49
|
#### Find
|
50
50
|
```ruby
|
51
|
-
|
51
|
+
LightspeedRestaurantClient::Customer.find(123)
|
52
52
|
```
|
53
53
|
|
54
54
|
#### Create
|
55
55
|
```ruby
|
56
|
-
|
56
|
+
LightspeedRestaurantClient::Customer.create(...firstName: 'Tom', email: 'tom@brady.com'...)
|
57
57
|
```
|
58
58
|
|
59
59
|
#### Update
|
60
60
|
```ruby
|
61
|
-
|
61
|
+
LightspeedRestaurantClient::Customer.update(123, { email: 'tom@brady.com' })
|
62
62
|
```
|
63
63
|
|
64
64
|
#### Save
|
65
65
|
```ruby
|
66
|
-
customer =
|
66
|
+
customer = LightspeedRestaurantClient::Customer.find(123)
|
67
67
|
customer.firstName = 'Micheal'
|
68
68
|
customer.save
|
69
69
|
```
|
70
70
|
|
71
71
|
#### Destroy
|
72
72
|
```ruby
|
73
|
-
customer =
|
73
|
+
customer = LightspeedRestaurantClient::Customer.find(123)
|
74
74
|
customer.destroy
|
75
75
|
```
|
76
76
|
|
@@ -12,7 +12,7 @@ require 'lightspeed_restaurant/customer_credit_change'
|
|
12
12
|
require 'lightspeed_restaurant/receipt'
|
13
13
|
require 'lightspeed_restaurant/company'
|
14
14
|
|
15
|
-
module
|
15
|
+
module LightspeedRestaurantClient
|
16
16
|
class << self
|
17
17
|
attr_accessor :api_token, :base_uri
|
18
18
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'lightspeed_restaurant/base'
|
2
2
|
require 'lightspeed_restaurant/operations/list'
|
3
3
|
|
4
|
-
module
|
5
|
-
class Company <
|
4
|
+
module LightspeedRestaurantClient
|
5
|
+
class Company < LightspeedRestaurantClient::Base
|
6
6
|
extend Operations::List
|
7
7
|
|
8
8
|
def self.resource_name
|
@@ -5,8 +5,8 @@ require 'lightspeed_restaurant/operations/create'
|
|
5
5
|
require 'lightspeed_restaurant/operations/update'
|
6
6
|
require 'lightspeed_restaurant/operations/save'
|
7
7
|
|
8
|
-
module
|
9
|
-
class Customer <
|
8
|
+
module LightspeedRestaurantClient
|
9
|
+
class Customer < LightspeedRestaurantClient::Base
|
10
10
|
include Operations::Save
|
11
11
|
extend Operations::Create
|
12
12
|
extend Operations::Update
|
@@ -2,8 +2,8 @@ require 'lightspeed_restaurant/base'
|
|
2
2
|
require 'lightspeed_restaurant/operations/list'
|
3
3
|
require 'lightspeed_restaurant/operations/create'
|
4
4
|
|
5
|
-
module
|
6
|
-
class CustomerCreditChange <
|
5
|
+
module LightspeedRestaurantClient
|
6
|
+
class CustomerCreditChange < LightspeedRestaurantClient::Base
|
7
7
|
include Operations::List
|
8
8
|
include Operations::Create
|
9
9
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module Create
|
4
4
|
def create(attributes)
|
5
|
-
response =
|
5
|
+
response = LightspeedRestaurantClient.post(resource_path, attributes)
|
6
6
|
payload = build_payload(attributes, response)
|
7
7
|
return new(payload) if is_a?(Class)
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module Destroy
|
4
4
|
def destroy
|
5
|
-
JSON.parse(
|
5
|
+
JSON.parse(LightspeedRestaurantClient.delete(self.class.resource_path + "/#{id}"))
|
6
6
|
self
|
7
7
|
end
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module Find
|
4
4
|
def find(id)
|
5
|
-
response = JSON.parse(
|
5
|
+
response = JSON.parse(LightspeedRestaurantClient.get(resource_path + "/#{id}"))
|
6
6
|
new(response)
|
7
7
|
end
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module List
|
4
4
|
def list(params = {})
|
5
|
-
response = JSON.parse(
|
5
|
+
response = JSON.parse(LightspeedRestaurantClient.get(resource_path, {}, params))
|
6
6
|
results = response.is_a?(Array) ? response : response['results']
|
7
7
|
instantiate(results)
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module Save
|
4
4
|
def save
|
5
|
-
|
5
|
+
LightspeedRestaurantClient.put(self.class.resource_path + "/#{id}", self)
|
6
6
|
self
|
7
7
|
end
|
8
8
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module LightspeedRestaurantClient
|
2
2
|
module Operations
|
3
3
|
module Update
|
4
4
|
def update(id, attributes)
|
5
5
|
updated_object = new(attributes)
|
6
|
-
|
6
|
+
LightspeedRestaurantClient.put(resource_path + "/#{id}", updated_object)
|
7
7
|
updated_object
|
8
8
|
end
|
9
9
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'lightspeed_restaurant/base'
|
2
2
|
require 'lightspeed_restaurant/operations/list'
|
3
3
|
|
4
|
-
module
|
5
|
-
class Receipt <
|
4
|
+
module LightspeedRestaurantClient
|
5
|
+
class Receipt < LightspeedRestaurantClient::Base
|
6
6
|
extend Operations::List
|
7
7
|
|
8
8
|
def self.resource_name
|
@@ -5,7 +5,7 @@ require 'lightspeed_restaurant/errors/invalid_request_error'
|
|
5
5
|
require 'lightspeed_restaurant/errors/not_found_error'
|
6
6
|
require 'uri'
|
7
7
|
|
8
|
-
module
|
8
|
+
module LightspeedRestaurantClient
|
9
9
|
class Request
|
10
10
|
def initialize(base_uri, path, token, body = {}, query = {})
|
11
11
|
@base_uri = base_uri || 'http://staging-exact-integration.posios.com'
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = '0.
|
1
|
+
module LightspeedRestaurantClient
|
2
|
+
VERSION = '1.0.0'.freeze
|
3
3
|
end
|
@@ -5,7 +5,7 @@ require 'lightspeed_restaurant/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'lightspeed_restaurant'
|
8
|
-
spec.version =
|
8
|
+
spec.version = LightspeedRestaurantClient::VERSION
|
9
9
|
spec.authors = ['Olivier Buffon']
|
10
10
|
spec.email = ['olivier@chronogolf.ca']
|
11
11
|
|