tosuto 0.3.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +14 -4
- data/lib/tosuto/api.rb +1 -1
- data/lib/tosuto/applied_tax_rate.rb +9 -1
- data/lib/tosuto/check.rb +25 -5
- data/lib/tosuto/curbside_pickup_info.rb +19 -0
- data/lib/tosuto/dining_option.rb +21 -4
- data/lib/tosuto/menu_item_selection.rb +24 -5
- data/lib/tosuto/oauth_token.rb +13 -11
- data/lib/tosuto/order.rb +33 -7
- data/lib/tosuto/version.rb +1 -1
- data/tosuto.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65961f5a798b7c01bde52c6c3b02ae75fecefde2912342750e6bca9394c360d4
|
4
|
+
data.tar.gz: be149610b9018f33844d7bb2680d2bb50300f07dde80f37d531dcc75b31f857b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e1239cdb08e468a1652c5e6c99d7f2c58fb44c57485cca6b8c98927b70c4a2b6f0c97df859e811cf464324c99da4b360ca785191038967e310937929739165
|
7
|
+
data.tar.gz: f67c396d70b53d5e3984642ae42b25d5da4868f0576cfef5628cbc76598c4fe2f5802a157580297147b25e35d1eee44caa11996c0a679a4ec5031414472722f7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tosuto (0.3
|
4
|
+
tosuto (0.4.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
byebug (11.1.3)
|
10
|
+
coderay (1.1.3)
|
9
11
|
diff-lcs (1.3)
|
10
|
-
|
12
|
+
method_source (1.0.0)
|
13
|
+
pry (0.13.1)
|
14
|
+
coderay (~> 1.1)
|
15
|
+
method_source (~> 1.0)
|
16
|
+
pry-byebug (3.9.0)
|
17
|
+
byebug (~> 11.0)
|
18
|
+
pry (~> 0.13.0)
|
19
|
+
rake (13.0.1)
|
11
20
|
rspec (3.9.0)
|
12
21
|
rspec-core (~> 3.9.0)
|
13
22
|
rspec-expectations (~> 3.9.0)
|
@@ -27,9 +36,10 @@ PLATFORMS
|
|
27
36
|
|
28
37
|
DEPENDENCIES
|
29
38
|
bundler (~> 2.0)
|
30
|
-
|
39
|
+
pry-byebug
|
40
|
+
rake (~> 13.0)
|
31
41
|
rspec (~> 3.0)
|
32
42
|
tosuto!
|
33
43
|
|
34
44
|
BUNDLED WITH
|
35
|
-
2.
|
45
|
+
2.2.28
|
data/lib/tosuto/api.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module Tosuto
|
2
2
|
class AppliedTaxRate < Resource
|
3
|
-
attr_accessor :guid
|
3
|
+
attr_accessor :guid
|
4
|
+
|
5
|
+
attr_accessor(*%i[
|
6
|
+
name
|
7
|
+
rate
|
8
|
+
tax_amount
|
9
|
+
tax_rate
|
10
|
+
type
|
11
|
+
])
|
4
12
|
|
5
13
|
def initialize(hash)
|
6
14
|
set_attributes(hash)
|
data/lib/tosuto/check.rb
CHANGED
@@ -1,10 +1,30 @@
|
|
1
1
|
module Tosuto
|
2
2
|
class Check < Resource
|
3
|
-
attr_accessor :
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
attr_accessor :external_id, :guid
|
4
|
+
|
5
|
+
attr_accessor(*%i[
|
6
|
+
amount
|
7
|
+
applied_discounts
|
8
|
+
applied_loyalty_info
|
9
|
+
applied_service_charges
|
10
|
+
closed_date
|
11
|
+
customer
|
12
|
+
deleted
|
13
|
+
deleted_date
|
14
|
+
display_number
|
15
|
+
modified_date
|
16
|
+
opened_date
|
17
|
+
paid_date
|
18
|
+
payment_status
|
19
|
+
payments
|
20
|
+
tab_name
|
21
|
+
tax_amount
|
22
|
+
tax_exempt
|
23
|
+
total_amount
|
24
|
+
void_business_date
|
25
|
+
void_date
|
26
|
+
voided
|
27
|
+
])
|
8
28
|
|
9
29
|
attr_collections selections: MenuItemSelection
|
10
30
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tosuto/resource'
|
4
|
+
|
5
|
+
module Tosuto
|
6
|
+
class CurbsidePickupInfo < Resource
|
7
|
+
attr_accessor :entity_type, :guid
|
8
|
+
|
9
|
+
attr_accessor(*%i[
|
10
|
+
notes
|
11
|
+
transport_color
|
12
|
+
transport_description
|
13
|
+
])
|
14
|
+
|
15
|
+
def initialize(hash)
|
16
|
+
set_attributes(hash)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/tosuto/dining_option.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
module Tosuto
|
2
2
|
class DiningOption < Resource
|
3
|
-
ENDPOINT =
|
3
|
+
ENDPOINT = '/config/v2/diningOptions'.freeze
|
4
4
|
|
5
|
-
|
5
|
+
CARRYOUT_MATCH = %w[carryout].freeze
|
6
|
+
DSP_MATCH = %w[delivery door grub postmates uber].freeze
|
7
|
+
|
8
|
+
attr_accessor :entity_type, :external_id, :guid
|
9
|
+
|
10
|
+
attr_accessor(*%i[
|
11
|
+
behavior
|
12
|
+
curbside
|
13
|
+
name
|
14
|
+
])
|
6
15
|
|
7
16
|
def initialize(hash)
|
8
17
|
set_attributes(hash)
|
@@ -22,12 +31,20 @@ module Tosuto
|
|
22
31
|
self
|
23
32
|
end
|
24
33
|
|
34
|
+
def dsp?
|
35
|
+
DSP_MATCH.any? { |dsp| name&.downcase&.match?(dsp) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def carryout?
|
39
|
+
CARRYOUT_MATCH.any? { |carryout| name&.downcase&.match?(carryout) }
|
40
|
+
end
|
41
|
+
|
25
42
|
def take_out?
|
26
|
-
behavior ==
|
43
|
+
behavior == 'TAKE_OUT' && (carryout? || !dsp?)
|
27
44
|
end
|
28
45
|
|
29
46
|
def delivery?
|
30
|
-
behavior ==
|
47
|
+
behavior == 'DELIVERY' || (dsp? && !carryout?)
|
31
48
|
end
|
32
49
|
end
|
33
50
|
end
|
@@ -1,10 +1,29 @@
|
|
1
1
|
module Tosuto
|
2
2
|
class MenuItemSelection < Resource
|
3
|
-
attr_accessor :
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
attr_accessor :external_id, :guid
|
4
|
+
|
5
|
+
attr_accessor(*%i[
|
6
|
+
applied_discounts
|
7
|
+
created_date
|
8
|
+
deferred
|
9
|
+
display_name
|
10
|
+
fulfillment_status
|
11
|
+
modified_date
|
12
|
+
modifiers
|
13
|
+
option_group
|
14
|
+
pre_discount_price
|
15
|
+
pre_modifier
|
16
|
+
price
|
17
|
+
quantity
|
18
|
+
seat_number
|
19
|
+
selection_type
|
20
|
+
tax
|
21
|
+
unit_of_measure
|
22
|
+
void_business_date
|
23
|
+
void_date
|
24
|
+
void_reason
|
25
|
+
voided
|
26
|
+
])
|
8
27
|
|
9
28
|
attr_collections applied_taxes: AppliedTaxRate
|
10
29
|
|
data/lib/tosuto/oauth_token.rb
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
module Tosuto
|
2
2
|
class OauthToken < Resource
|
3
|
-
ENDPOINT = "/
|
3
|
+
ENDPOINT = "/authentication/v1/authentication/login".freeze
|
4
4
|
|
5
5
|
attr_accessor :access_token, :token_type, :expires_in, :expires_at, :scope
|
6
6
|
|
7
|
-
def self.create(client_id, client_secret,
|
7
|
+
def self.create(client_id, client_secret, user_access_type: "TOAST_MACHINE_CLIENT", api: API.new)
|
8
8
|
body = {
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
userAccessType: user_access_type,
|
10
|
+
clientId: client_id,
|
11
|
+
clientSecret: client_secret,
|
12
12
|
}
|
13
|
-
response = api.request(:post, ENDPOINT, body:
|
13
|
+
response = api.request(:post, ENDPOINT, body: body)
|
14
14
|
raise response.error unless response.success?
|
15
15
|
|
16
|
-
return
|
16
|
+
return new(response.json_body)
|
17
17
|
end
|
18
18
|
|
19
19
|
def initialize(attributes = {})
|
20
|
-
|
21
|
-
|
20
|
+
return unless (token = attributes['token'])
|
21
|
+
|
22
|
+
self.access_token = token['accessToken']
|
23
|
+
self.expires_in = token['expiresIn'].to_i
|
22
24
|
self.expires_at = Time.now + expires_in
|
23
|
-
self.token_type =
|
24
|
-
self.scope =
|
25
|
+
self.token_type = token['tokenType']
|
26
|
+
self.scope = token['scope']
|
25
27
|
end
|
26
28
|
|
27
29
|
def expired?
|
data/lib/tosuto/order.rb
CHANGED
@@ -1,17 +1,43 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
|
+
require 'tosuto/curbside_pickup_info'
|
4
|
+
|
3
5
|
module Tosuto
|
4
6
|
class Order < Resource
|
5
|
-
ENDPOINT = "/orders/v2/orders"
|
7
|
+
ENDPOINT = "/orders/v2/orders".freeze
|
8
|
+
|
9
|
+
attr_accessor :external_id, :guid
|
6
10
|
|
7
|
-
attr_accessor
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
attr_accessor(*%i[
|
12
|
+
approval_status
|
13
|
+
business_date
|
14
|
+
closed_date
|
15
|
+
deleted
|
16
|
+
deleted_date
|
17
|
+
delivery_info
|
18
|
+
duration
|
19
|
+
estimated_fulfillment_date
|
20
|
+
modified_date
|
21
|
+
number_of_guests
|
22
|
+
opened_date
|
23
|
+
paid_date
|
24
|
+
pricing_features
|
25
|
+
promised_date
|
26
|
+
required_prep_time
|
27
|
+
restaurant_id
|
28
|
+
restaurant_service
|
29
|
+
revenue_center
|
30
|
+
server
|
31
|
+
service_area
|
32
|
+
source
|
33
|
+
table
|
34
|
+
void_business_date
|
35
|
+
void_date
|
36
|
+
voided
|
37
|
+
])
|
13
38
|
|
14
39
|
attr_collections checks: Check
|
40
|
+
attr_objects curbside_pickup_info: CurbsidePickupInfo
|
15
41
|
attr_objects dining_option: DiningOption
|
16
42
|
|
17
43
|
def self.all(restaurant_id:, token:, date_range: nil, business_date: nil, api: API.new)
|
data/lib/tosuto/version.rb
CHANGED
data/tosuto.gemspec
CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tosuto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Yoder
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
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: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/tosuto/api.rb
|
76
76
|
- lib/tosuto/applied_tax_rate.rb
|
77
77
|
- lib/tosuto/check.rb
|
78
|
+
- lib/tosuto/curbside_pickup_info.rb
|
78
79
|
- lib/tosuto/dining_option.rb
|
79
80
|
- lib/tosuto/menu_item_selection.rb
|
80
81
|
- lib/tosuto/oauth_token.rb
|
@@ -89,7 +90,7 @@ metadata:
|
|
89
90
|
homepage_uri: https://github.com/RadiusNetworks/tosuto
|
90
91
|
source_code_uri: https://github.com/RadiusNetworks/tosuto
|
91
92
|
changelog_uri: https://github.com/RadiusNetworks/tosuto
|
92
|
-
post_install_message:
|
93
|
+
post_install_message:
|
93
94
|
rdoc_options: []
|
94
95
|
require_paths:
|
95
96
|
- lib
|
@@ -104,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
|
-
|
108
|
-
|
109
|
-
signing_key:
|
108
|
+
rubygems_version: 3.0.8
|
109
|
+
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: A gem for accessing Toast's API
|
112
112
|
test_files: []
|