automation-api 0.3.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 +7 -0
- data/.dependabot/config.yml +8 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELONG.md +13 -0
- data/Dockerfile +16 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +149 -0
- data/Jenkinsfile +31 -0
- data/README.md +176 -0
- data/Rakefile +44 -0
- data/automation-api.gemspec +42 -0
- data/bin/console +17 -0
- data/bin/setup +8 -0
- data/config/basic.yml +16 -0
- data/config/essential.yml +21 -0
- data/config/loyalty.yml +7 -0
- data/config/online.yml +17 -0
- data/config/profile.yml.example +231 -0
- data/config/restrictions.yml +55 -0
- data/config/starter.yml +11 -0
- data/docker-compose.yml +12 -0
- data/exe/store-gen +6 -0
- data/lib/automation/api.rb +17 -0
- data/lib/automation/api/cli.rb +320 -0
- data/lib/automation/api/client.rb +133 -0
- data/lib/automation/api/requests.rb +26 -0
- data/lib/automation/api/requests/account_owner.rb +22 -0
- data/lib/automation/api/requests/app_sync.rb +93 -0
- data/lib/automation/api/requests/button_pages.rb +34 -0
- data/lib/automation/api/requests/buttons.rb +34 -0
- data/lib/automation/api/requests/categories.rb +34 -0
- data/lib/automation/api/requests/collection.rb +32 -0
- data/lib/automation/api/requests/customers.rb +34 -0
- data/lib/automation/api/requests/departments.rb +34 -0
- data/lib/automation/api/requests/employees.rb +34 -0
- data/lib/automation/api/requests/entitlements.rb +33 -0
- data/lib/automation/api/requests/features.rb +33 -0
- data/lib/automation/api/requests/helper.rb +59 -0
- data/lib/automation/api/requests/location_preferences.rb +22 -0
- data/lib/automation/api/requests/loyalty_provisioning.rb +22 -0
- data/lib/automation/api/requests/matrix_products.rb +34 -0
- data/lib/automation/api/requests/modifiers.rb +34 -0
- data/lib/automation/api/requests/named_discounts.rb +34 -0
- data/lib/automation/api/requests/online_orders.rb +18 -0
- data/lib/automation/api/requests/registers.rb +30 -0
- data/lib/automation/api/requests/sales.rb +22 -0
- data/lib/automation/api/requests/sales_restrictions.rb +34 -0
- data/lib/automation/api/requests/settings.rb +22 -0
- data/lib/automation/api/requests/stock_items.rb +34 -0
- data/lib/automation/api/requests/tax_rate_service_taxes.rb +34 -0
- data/lib/automation/api/requests/taxes.rb +34 -0
- data/lib/automation/api/requests/tenders.rb +38 -0
- data/lib/automation/api/version.rb +7 -0
- metadata +321 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'collection'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Helper
|
9
|
+
module Helper
|
10
|
+
private
|
11
|
+
|
12
|
+
def get(url, headers: dev_headers)
|
13
|
+
parse_response(
|
14
|
+
RestClient.get(url, headers)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def post(url, headers: dev_headers, params: {})
|
19
|
+
parse_response(
|
20
|
+
RestClient.post(url, params.to_json, headers)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def patch(url, headers: dev_headers, params: {})
|
25
|
+
parse_response(
|
26
|
+
RestClient.patch(url, params.to_json, headers)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete(url, headers: dev_headers)
|
31
|
+
parse_response(
|
32
|
+
RestClient.delete(url, headers)
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete_with_payload(url, headers: dev_headers, params: {})
|
37
|
+
parse_response(
|
38
|
+
RestClient::Request.execute(method: :delete,
|
39
|
+
url: url,
|
40
|
+
payload: params.to_json,
|
41
|
+
headers: headers)
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_response(response)
|
46
|
+
body = JSON.parse(response.body)
|
47
|
+
|
48
|
+
if body.is_a?(Array)
|
49
|
+
body.map! { |record| OpenStruct.new(record) }
|
50
|
+
|
51
|
+
Collection.new(body)
|
52
|
+
else
|
53
|
+
OpenStruct.new(body)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::LocationPreferences
|
9
|
+
module LocationPreferences
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def location_preferences
|
13
|
+
get("#{@base_uri}/location_preferences")
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_location_preferences(params)
|
17
|
+
patch("#{@base_uri}/location_preferences", params: params)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::LoyaltyProvisioning
|
9
|
+
module LoyaltyProvisioning
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def provision
|
13
|
+
post("#{@base_uri}/loyalty_provisioning")
|
14
|
+
end
|
15
|
+
|
16
|
+
def deprovision
|
17
|
+
delete("#{@base_uri}/loyalty_provisioning")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::MatrixProducts
|
9
|
+
module MatrixProducts
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def matrix_products
|
13
|
+
get("#{@base_uri}/matrix_products")
|
14
|
+
end
|
15
|
+
|
16
|
+
def matrix_product(id:)
|
17
|
+
get("#{@base_uri}/matrix_products/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_matrix_product(matrix_product:)
|
21
|
+
post("#{@base_uri}/matrix_products", params: matrix_product)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_matrix_product(id:, matrix_product:)
|
25
|
+
patch("#{@base_uri}/matrix_products/#{id}", params: matrix_product)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_matrix_product(id:)
|
29
|
+
delete("#{@base_uri}/matrix_products/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Modifiers
|
9
|
+
module Modifiers
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def modifiers(stock_item_id:)
|
13
|
+
get("#{@base_uri}/stock_items/#{stock_item_id}/modifiers")
|
14
|
+
end
|
15
|
+
|
16
|
+
def modifier(stock_item_id:, id:)
|
17
|
+
get("#{@base_uri}/stock_items/#{stock_item_id}/modifiers/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_modifier(stock_item_id:, modifier:)
|
21
|
+
post("#{@base_uri}/stock_items/#{stock_item_id}/modifiers", params: modifier)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_modifier(stock_item_id:, id:, modifier:)
|
25
|
+
patch("#{@base_uri}/stock_items/#{stock_item_id}/modifiers/#{id}", params: modifier)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_modifier(stock_item_id:, id:)
|
29
|
+
delete("#{@base_uri}/stock_items/#{stock_item_id}/modifiers/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::NamedDiscounts
|
9
|
+
module NamedDiscounts
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def named_discounts
|
13
|
+
get("#{@base_uri}/named_discounts")
|
14
|
+
end
|
15
|
+
|
16
|
+
def named_discount(id:)
|
17
|
+
get("#{@base_uri}/named_discounts/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_named_discount(named_discount:)
|
21
|
+
post("#{@base_uri}/named_discounts", params: named_discount)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_named_discount(id:, named_discount:)
|
25
|
+
patch("#{@base_uri}/named_discounts/#{id}", params: named_discount)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_named_discount(id:)
|
29
|
+
delete("#{@base_uri}/named_discounts/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::OnlineOrders
|
9
|
+
module OnlineOrders
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def enable_online_ordering(params = {})
|
13
|
+
post("#{@base_uri}/online_orders", params: params)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Registers
|
9
|
+
module Registers
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def registers
|
13
|
+
get("#{@base_uri}/registers")
|
14
|
+
end
|
15
|
+
|
16
|
+
def register(id:)
|
17
|
+
get("#{@base_uri}/registers/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_register
|
21
|
+
post("#{@base_uri}/registers")
|
22
|
+
end
|
23
|
+
|
24
|
+
def deactivate_register(id:)
|
25
|
+
delete("#{@base_uri}/registers/#{id}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Sales
|
9
|
+
module Sales
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def sales(limit: 5)
|
13
|
+
get("#{@base_uri}/sales?limit=#{limit}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def sale(id:)
|
17
|
+
get("#{@base_uri}/sales/#{id}")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::SalesRestrictions
|
9
|
+
module SalesRestrictions
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def sales_restrictions(department_id:, category_id:)
|
13
|
+
get("#{@base_uri}/departments/#{department_id}/categories/#{category_id}/item_sales_restrictions")
|
14
|
+
end
|
15
|
+
|
16
|
+
def sales_restriction(department_id:, category_id:, id:)
|
17
|
+
get("#{@base_uri}/departments/#{department_id}/categories/#{category_id}/item_sales_restrictions/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_sales_restriction(department_id:, category_id:, sales_restriction:)
|
21
|
+
post("#{@base_uri}/departments/#{department_id}/categories/#{category_id}/item_sales_restrictions", params: sales_restriction)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_sales_restriction(department_id:, category_id:, id:, sales_restriction:)
|
25
|
+
patch("#{@base_uri}/departments/#{department_id}/categories/#{category_id}/item_sales_restrictions/#{id}", params: sales_restriction)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_sales_restriction(department_id:, category_id:, id:)
|
29
|
+
delete("#{@base_uri}/departments/#{department_id}/categories/#{category_id}/item_sales_restrictions/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Settings
|
9
|
+
module Settings
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def settings
|
13
|
+
get("#{@base_uri}/settings")
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_settings(params)
|
17
|
+
patch("#{@base_uri}/settings", params: params)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::StockItems
|
9
|
+
module StockItems
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def stock_items
|
13
|
+
get("#{@base_uri}/stock_items")
|
14
|
+
end
|
15
|
+
|
16
|
+
def stock_item(id:)
|
17
|
+
get("#{@base_uri}/stock_items/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_stock_item(stock_item:)
|
21
|
+
post("#{@base_uri}/stock_items", params: stock_item)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_stock_item(id:, stock_item:)
|
25
|
+
patch("#{@base_uri}/stock_items/#{id}", params: stock_item)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_stock_item(id:)
|
29
|
+
delete("#{@base_uri}/stock_items/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::TaxRateServiceTaxes
|
9
|
+
module TaxRateServiceTaxes
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def trs_taxes
|
13
|
+
get("#{@trs_uri}/taxes", headers: jwt_headers)
|
14
|
+
end
|
15
|
+
|
16
|
+
def trs_tax(id:)
|
17
|
+
get("#{@trs_uri}/taxes/#{id}", headers: jwt_headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def trs_create_tax(tax:)
|
21
|
+
post("#{@trs_uri}/taxes", headers: jwt_headers, params: tax)
|
22
|
+
end
|
23
|
+
|
24
|
+
def trs_update_tax(id:, tax:)
|
25
|
+
patch("#{@trs_uri}/taxes/#{id}", headers: jwt_headers, params: tax)
|
26
|
+
end
|
27
|
+
|
28
|
+
def trs_delete_tax(id:)
|
29
|
+
delete("#{@trs_uri}/taxes/#{id}", headers: jwt_headers)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
module Automation
|
6
|
+
module API
|
7
|
+
module Requests
|
8
|
+
# Automation::API::Requests::Taxes
|
9
|
+
module Taxes
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
def taxes
|
13
|
+
get("#{@base_uri}/taxes")
|
14
|
+
end
|
15
|
+
|
16
|
+
def tax(id:)
|
17
|
+
get("#{@base_uri}/taxes/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_tax(tax:)
|
21
|
+
post("#{@base_uri}/taxes", params: tax)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_tax(id:, tax:)
|
25
|
+
patch("#{@base_uri}/taxes/#{id}", params: tax)
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_tax(id:)
|
29
|
+
delete("#{@base_uri}/taxes/#{id}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|