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
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'automation/api/version'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
require 'pact/tasks'
|
7
|
+
require 'pact_broker/client/tasks'
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
task default: :spec
|
12
|
+
|
13
|
+
# Run with `bundle exec rake pact:publish`
|
14
|
+
PactBroker::Client::PublicationTask.new do |task|
|
15
|
+
version = Automation::API::VERSION
|
16
|
+
git_commit = ENV.fetch('GIT_COMMIT')
|
17
|
+
git_branch = ENV.fetch('GIT_BRANCH')
|
18
|
+
|
19
|
+
task.consumer_version = "#{version}-#{git_commit}"
|
20
|
+
|
21
|
+
# optional, default value is 'spec/pacts/*.json'
|
22
|
+
# task.pattern = 'spec/pacts/*.json'
|
23
|
+
|
24
|
+
task.pact_broker_base_url = 'https://pact-broker.internal.staging.posrip.com/'
|
25
|
+
|
26
|
+
# Optional but STRONGLY RECOMMENDED as it will greatly assist with your
|
27
|
+
# pact workflow. Result will be merged with other specified task.tags
|
28
|
+
# However this is retrieving the branch name, it doesn't work
|
29
|
+
# task.tag_with_git_branch = true
|
30
|
+
|
31
|
+
# Optional
|
32
|
+
task.tags = [git_branch]
|
33
|
+
|
34
|
+
# # Optional
|
35
|
+
# task.pact_broker_basic_auth = { username: '', password: '' }
|
36
|
+
|
37
|
+
# # Optional
|
38
|
+
# task.pact_broker_token = '1234abcd' # Bearer token
|
39
|
+
|
40
|
+
# # This will merge the published pact into an existing pact rather than
|
41
|
+
# # overwriting it if one exists. Not recommended, as it makes a mulch of
|
42
|
+
# # the workflow on the broker.
|
43
|
+
# task.write_method = :merge
|
44
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
|
7
|
+
require 'automation/api/version'
|
8
|
+
|
9
|
+
# rubocop:disable Metrics/BlockLength
|
10
|
+
Gem::Specification.new do |spec|
|
11
|
+
spec.name = 'automation-api'
|
12
|
+
spec.version = Automation::API::VERSION
|
13
|
+
spec.authors = ['Marc Sangster']
|
14
|
+
spec.email = ['msangster@shopkeep.com']
|
15
|
+
spec.summary = 'Client for HTTP requests to BackOffice'
|
16
|
+
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
19
|
+
end
|
20
|
+
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'graphql-client', '~> 0.16.0'
|
26
|
+
spec.add_dependency 'json', '>= 1.8', '< 3'
|
27
|
+
spec.add_dependency 'rest-client', '~> 2.1'
|
28
|
+
spec.add_dependency 'thor', '~> 0.20'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
31
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
|
32
|
+
spec.add_development_dependency 'faker', '~> 2.4'
|
33
|
+
spec.add_development_dependency 'pact', '~> 1.42'
|
34
|
+
spec.add_development_dependency 'pact_broker-client', '~> 1.20'
|
35
|
+
spec.add_development_dependency 'pry', '~> 0.12.2'
|
36
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
38
|
+
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.2'
|
39
|
+
spec.add_development_dependency 'simplecov', '~> 0.13'
|
40
|
+
spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
|
41
|
+
end
|
42
|
+
# rubocop:enable Metrics/BlockLength
|
data/bin/console
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'automation/api'
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
10
|
+
# with your gem easier. You can also use a different console, if you like.
|
11
|
+
@uuid = '<insert store uuid>'
|
12
|
+
@client = Automation::API::Client.new(uuid: @uuid,
|
13
|
+
store: @store,
|
14
|
+
login: @login,
|
15
|
+
password: @password)
|
16
|
+
|
17
|
+
Pry.start
|
data/bin/setup
ADDED
data/config/basic.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
:account_owner:
|
2
|
+
:first_name: Test
|
3
|
+
:last_name: Basic
|
4
|
+
:phone: '9736928048'
|
5
|
+
:entitlements:
|
6
|
+
:activate:
|
7
|
+
- standard_care
|
8
|
+
- customer_recognition
|
9
|
+
- price_packaging
|
10
|
+
- point_of_sale
|
11
|
+
# Default: Here for reference
|
12
|
+
# - pocket
|
13
|
+
# - freemium_care
|
14
|
+
# - billing_management
|
15
|
+
:deactivate:
|
16
|
+
- freemium
|
@@ -0,0 +1,21 @@
|
|
1
|
+
:account_owner:
|
2
|
+
:first_name: Test
|
3
|
+
:last_name: Essential
|
4
|
+
:phone: '9736928048'
|
5
|
+
:entitlements:
|
6
|
+
:activate:
|
7
|
+
- standard_care
|
8
|
+
- sales_restrictions
|
9
|
+
- pocket_date_picker
|
10
|
+
- customer_recognition
|
11
|
+
- custom_permissions
|
12
|
+
- price_packaging
|
13
|
+
- online_ordering
|
14
|
+
- quickbooks
|
15
|
+
- gift_card
|
16
|
+
- mailchimp
|
17
|
+
- webstore
|
18
|
+
- advanced_reporting
|
19
|
+
- point_of_sale
|
20
|
+
:deactivate:
|
21
|
+
- freemium
|
data/config/loyalty.yml
ADDED
data/config/online.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
:account_owner:
|
2
|
+
:first_name: Test
|
3
|
+
:last_name: Online
|
4
|
+
:phone: '9736928048'
|
5
|
+
:settings:
|
6
|
+
:location_name: Online Ordering Test
|
7
|
+
:location_addr1: 1 Yemen Street
|
8
|
+
:location_addr2: Yemen
|
9
|
+
:location_city: Yemen
|
10
|
+
:location_postal_code: YM111
|
11
|
+
:location_phone: '1111111111'
|
12
|
+
:location_state: AK
|
13
|
+
:location_country: United States
|
14
|
+
:entitlements:
|
15
|
+
:activate:
|
16
|
+
- online_ordering
|
17
|
+
:online_ordering: true
|
@@ -0,0 +1,231 @@
|
|
1
|
+
# Below is an example configuration just to give an idea of what can be done,
|
2
|
+
# and the shape of the data. No validation is done this side, so if something
|
3
|
+
# isn't right the request to request will simply fail.
|
4
|
+
|
5
|
+
# Account owner information is required if you plan on using loyalty.
|
6
|
+
# I believe '9736928048' is the magic phone number that must be used in this case.
|
7
|
+
:account_owner:
|
8
|
+
# :login: ~
|
9
|
+
# :email: ~
|
10
|
+
:first_name: Test
|
11
|
+
:last_name: Example
|
12
|
+
:phone: '9736928048'
|
13
|
+
|
14
|
+
# Not required, but can help to dry up some of the configuration.
|
15
|
+
:customer: &customer
|
16
|
+
:last_name: Simpson
|
17
|
+
:address_line1: 742 Evergreen Terrace
|
18
|
+
# Additonal customer fields
|
19
|
+
# :first_name: ~
|
20
|
+
# :email: ~
|
21
|
+
# :address_line2: ~
|
22
|
+
# :city: ~
|
23
|
+
# :state: ~
|
24
|
+
# :zip: ~
|
25
|
+
# :phone: ~
|
26
|
+
# :account_code: ~
|
27
|
+
# :account_type: ~
|
28
|
+
# :tax_exempt: ~
|
29
|
+
# :sales_tax_number: ~
|
30
|
+
# :notes:
|
31
|
+
|
32
|
+
# An Array of customers to add
|
33
|
+
:customers:
|
34
|
+
- <<: *customer
|
35
|
+
:first_name: Homer
|
36
|
+
- <<: *customer
|
37
|
+
:first_name: Marge
|
38
|
+
- <<: *customer
|
39
|
+
:first_name: Bart
|
40
|
+
- <<: *customer
|
41
|
+
:first_name: Lisa
|
42
|
+
- <<: *customer
|
43
|
+
:first_name: Maggie
|
44
|
+
|
45
|
+
# :employee: &employee
|
46
|
+
# :first_name: ~
|
47
|
+
# :last_name: ~
|
48
|
+
# :phone: ~
|
49
|
+
# :email: ~
|
50
|
+
# :login: ~
|
51
|
+
# :register_name: ~
|
52
|
+
# :register_code: ~
|
53
|
+
# :manager: ~
|
54
|
+
# :password: ~
|
55
|
+
# :ipad_login_code:
|
56
|
+
# :register_manager_signin: ~
|
57
|
+
# :register_cashier_signin: ~
|
58
|
+
# :hourly_wage: ~
|
59
|
+
|
60
|
+
:employees:
|
61
|
+
- :first_name: Working
|
62
|
+
:last_name: Hard
|
63
|
+
:manager: false
|
64
|
+
:ipad_login_code: 9090
|
65
|
+
- :first_name: Hardly
|
66
|
+
:last_name: Working
|
67
|
+
:manager: true
|
68
|
+
:ipad_login_code: 3948
|
69
|
+
|
70
|
+
# Entitlements take an array of entitlements to 'activate' and another array to deactivate,
|
71
|
+
# though neither is required.
|
72
|
+
:entitlements:
|
73
|
+
:activate:
|
74
|
+
- standard_care
|
75
|
+
- price_packaging
|
76
|
+
- online_ordering
|
77
|
+
:deactivate:
|
78
|
+
- freemium
|
79
|
+
|
80
|
+
# Works just like entitlements. Feature flag names are always snake_cased versions of
|
81
|
+
# the backoffice admin list
|
82
|
+
:features:
|
83
|
+
:activate:
|
84
|
+
- validated_clockpunch_ios
|
85
|
+
- item_sales_restrictions
|
86
|
+
:deactivate:
|
87
|
+
- check_sync_and_backup
|
88
|
+
- register_push_notification
|
89
|
+
|
90
|
+
# Loyalty is not provisioned be default, so if you didn't want this
|
91
|
+
# you would just leave it out entirely
|
92
|
+
# :loyalty_provisioned: true
|
93
|
+
|
94
|
+
# Loyalty must be provisioned before being enabled. Order matters
|
95
|
+
:location_preferences:
|
96
|
+
:loyalty_enabled: false
|
97
|
+
:table_layout_enabled: true
|
98
|
+
:pinless_login_enabled: true
|
99
|
+
:guest_count_tracking: false
|
100
|
+
:guest_count_cashier_prompt: false
|
101
|
+
|
102
|
+
# On iOS the first register assigned to an account will have coach marks displayed,
|
103
|
+
# this can be a pain for automation. This option will discard the first register.
|
104
|
+
:burn_first_register: false
|
105
|
+
|
106
|
+
# Most of the settings are self explanatory. We've set the location information here
|
107
|
+
# as it's a requirement for setting up online ordering.
|
108
|
+
:settings:
|
109
|
+
# :publisher_name: ~
|
110
|
+
# :publisher_password: ~
|
111
|
+
# :merchant_location_code: ~
|
112
|
+
# :processor_name: ~
|
113
|
+
# :config_display_gratuity_line: ~
|
114
|
+
# :config_display_sig_line: ~
|
115
|
+
# :gift_card_processor_name: ~
|
116
|
+
# :gift_card_processor_url: ~
|
117
|
+
# :gift_card_processor_username: ~
|
118
|
+
# :gift_card_processor_password: ~
|
119
|
+
# :gift_card_enabled: ~
|
120
|
+
# :emv_enabled: ~
|
121
|
+
:location_name: Online Ordering Test
|
122
|
+
:location_addr1: 1 Yemen Street
|
123
|
+
:location_addr2: Yemen
|
124
|
+
:location_city: Yemen
|
125
|
+
:location_postal_code: YM111
|
126
|
+
:location_phone: '1111111111'
|
127
|
+
:location_state: AK
|
128
|
+
:location_country: United States
|
129
|
+
# :location_email: ~
|
130
|
+
# :location_website: ~
|
131
|
+
# :signature_on_paper_receipt: ~
|
132
|
+
# :tip_suggestions_on_paper: ~
|
133
|
+
# :combine_tip_and_signature_screens: ~
|
134
|
+
# :suggested_tip_1_value: ~
|
135
|
+
# :suggested_tip_1_type: ~
|
136
|
+
# :suggested_tip_2_value: ~
|
137
|
+
# :suggested_tip_2_type: ~
|
138
|
+
# :suggested_tip_3_value: ~
|
139
|
+
# :suggested_tip_3_type: ~
|
140
|
+
# :receipt_custom_text: ~
|
141
|
+
# :print_customer_delivery_on_tickets: ~
|
142
|
+
# :print_customer_delivery_on_checks: ~
|
143
|
+
# :print_customer_delivery_on_receipts: ~
|
144
|
+
# :show_receipt_logo: ~
|
145
|
+
# :config_display_powered_by: ~
|
146
|
+
# :apply_discounts_to_entire_subtotal: ~
|
147
|
+
# :require_manager_to_void: ~
|
148
|
+
# :tax_id: ~
|
149
|
+
# :default_home_screen: ~
|
150
|
+
# :auto_signout: ~
|
151
|
+
# :register_sync: ~
|
152
|
+
# :customer_facing_display_enabled: ~
|
153
|
+
|
154
|
+
# Departments are simple and only have a 'name' field
|
155
|
+
:departments:
|
156
|
+
- :name: Restricted
|
157
|
+
|
158
|
+
# If you reference a department, this will fetch the department by name and use the 'id'
|
159
|
+
:category: &category
|
160
|
+
:department: Restricted
|
161
|
+
|
162
|
+
:categories:
|
163
|
+
- :name: Age Restricted
|
164
|
+
<<: *category
|
165
|
+
- :name: Qty Restricted
|
166
|
+
<<: *category
|
167
|
+
|
168
|
+
# Again, reference the department/categories by name and the relevant 'id' will be fetched
|
169
|
+
# before making the request
|
170
|
+
:sales_restrictions:
|
171
|
+
- :name: Age Restriction
|
172
|
+
:age_minimum: 21
|
173
|
+
:department: Restricted
|
174
|
+
:category: Age Restricted
|
175
|
+
- :name: Qty Restriction
|
176
|
+
:item_maximum: 3
|
177
|
+
:department: Restricted
|
178
|
+
:category: Qty Restricted
|
179
|
+
|
180
|
+
:stock_item: &stock_item
|
181
|
+
:price_type: system
|
182
|
+
:price: 10.0
|
183
|
+
:department: Restricted
|
184
|
+
# :description:
|
185
|
+
# :department_id:
|
186
|
+
# :category_id:
|
187
|
+
# :register_data_status:
|
188
|
+
# :upc_code:
|
189
|
+
# :discountable:
|
190
|
+
# :taxable:
|
191
|
+
# :unit:
|
192
|
+
# :cost:
|
193
|
+
# :tax_id:
|
194
|
+
# :quantity_on_hand:
|
195
|
+
# :recommended_order:
|
196
|
+
# :order_trigger:
|
197
|
+
# :supplier_id:
|
198
|
+
# :select_modifiers_when_sold:
|
199
|
+
# :inventory_method:
|
200
|
+
# :assigned_cost:
|
201
|
+
# :printer_setting_id:
|
202
|
+
|
203
|
+
:stock_items:
|
204
|
+
- <<: *stock_item
|
205
|
+
:description: Age Restricted Item
|
206
|
+
:category: Age Restricted
|
207
|
+
- <<: *stock_item
|
208
|
+
:description: Qty Restricted Item
|
209
|
+
:category: Qty Restricted
|
210
|
+
|
211
|
+
:button_pages:
|
212
|
+
- :name: Restricted Items
|
213
|
+
:page_number: 0
|
214
|
+
|
215
|
+
:button: &button
|
216
|
+
:page: Restricted Items
|
217
|
+
:x_offset: 0
|
218
|
+
:y_offset: 0
|
219
|
+
:item_type: StockItem
|
220
|
+
|
221
|
+
:buttons:
|
222
|
+
- <<: *button
|
223
|
+
:item: Age Restricted Item
|
224
|
+
- <<: *button
|
225
|
+
:x_offset: 1
|
226
|
+
:item: Qty Restricted Item
|
227
|
+
|
228
|
+
# This step blocks the request until the user activates a register.
|
229
|
+
# For online orders to be received a register must be activated first, though
|
230
|
+
# this step can be skipped.
|
231
|
+
:online_ordering: true
|
@@ -0,0 +1,55 @@
|
|
1
|
+
:features:
|
2
|
+
:activate:
|
3
|
+
- item_sales_restrictions
|
4
|
+
|
5
|
+
:departments:
|
6
|
+
- :name: Restricted
|
7
|
+
|
8
|
+
:category: &category
|
9
|
+
:department: Restricted
|
10
|
+
|
11
|
+
:categories:
|
12
|
+
- :name: Age Restricted
|
13
|
+
<<: *category
|
14
|
+
- :name: Qty Restricted
|
15
|
+
<<: *category
|
16
|
+
|
17
|
+
:sales_restrictions:
|
18
|
+
- :name: Age Restriction
|
19
|
+
:age_minimum: 21
|
20
|
+
:department: Restricted
|
21
|
+
:category: Age Restricted
|
22
|
+
- :name: Qty Restriction
|
23
|
+
:item_maximum: 3
|
24
|
+
:department: Restricted
|
25
|
+
:category: Qty Restricted
|
26
|
+
|
27
|
+
:stock_item: &stock_item
|
28
|
+
:price_type: system
|
29
|
+
:price: 10.0
|
30
|
+
:department: Restricted
|
31
|
+
|
32
|
+
:stock_items:
|
33
|
+
- <<: *stock_item
|
34
|
+
:description: Age Restricted Item
|
35
|
+
:category: Age Restricted
|
36
|
+
- <<: *stock_item
|
37
|
+
:description: Qty Restricted Item
|
38
|
+
:category: Qty Restricted
|
39
|
+
|
40
|
+
:button_pages:
|
41
|
+
- :name: Restricted Items
|
42
|
+
:page_number: 0
|
43
|
+
|
44
|
+
:button: &button
|
45
|
+
:page: Restricted Items
|
46
|
+
:x_offset: 0
|
47
|
+
:y_offset: 0
|
48
|
+
:item_type: StockItem
|
49
|
+
|
50
|
+
:buttons:
|
51
|
+
- <<: *button
|
52
|
+
:item: Age Restricted Item
|
53
|
+
- <<: *button
|
54
|
+
:x_offset: 1
|
55
|
+
:item: Qty Restricted Item
|