Automation::API
Gem for making HTTP requests to BackOffice Staging
Installation
Add this line to your application's Gemfile:
source 'https://5a8e458f6acf55f1543dc82e924301613c8f8cfba0fd5949:@packagecloud.io/shopkeep/ruby' do
gem 'automation-api'
end
And then execute:
$ bundle
Or install it yourself as:
$ gem install --source 'https://5a8e458f6acf55f1543dc82e924301613c8f8cfba0fd5949:@packagecloud.io/shopkeep/ruby' automation-api
Usage
Help
$ store-gen help
Commands:
store-gen create [PROFILE] # Create store of using specified profile
store-gen help [COMMAND] # Describe available commands or one specific command
store-gen list # List of predifined store profiles
store-gen new_profile [NAME] # Start creating a new custom profile
store-gen view [PROFILE] # View config file for requested profile
So for detailed 'help' for 'create'.
$ store-gen help create
Listing
$ store-gen list
basic
essential
loyalty
online
profile
restrictions
starter
List of predifined store porfiles.
Additional Options
--path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
If you choose to create your own custom profile(s), use this flag to point to the correct directory.
View configuration
$ store-gen view [PROFILE]
:account_owner:
:first_name: Test
:last_name: Basic
:phone: '9736928048'
:entitlements:
:activate:
- standard_care
- customer_recognition
- price_packaging
- point_of_sale
# Default: Here for reference
# - pocket
# - freemium_care
# - billing_management
:deactivate:
- freemium
View config file for requested profile(basic in the example above). Used for reference, or if creating a custom profile that extends an existing.
Additional Options
--path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
If you choose to create your own custom profile(s), use this flag to point to the correct directory.
Generating a store
$ store-gen create [PROFILE]
{"email"=>"gen+841r25@shopkeep.com",
"subdomain"=>"test-auto-thor-7a6a0b03",
"password"=>"password",
"ok"=>true,
"uuid"=>"6DC1E24C-99EF-4F86-9ECD-139E0B29403E",
"login"=>"gen+841r25@shopkeep.com",
"register_id"=>1,
"register_number"=>1,
"manager_signin"=>"8997"}
Updating account owner information...done
Create store of using specified profile(basic in the example above). By default this will create an 'empty' and then use the porfile configuration provided to make further changes.
Additional Options
-a, [--archetype=ARCHETYPE]
Store archetype - the base upon which the profile is built. By default it creates an 'empty' store. Typically we use 'complex' stores during automation as they have a number of items, customers, tax groups whatnot, pre-baked. The final option is 'coffee_shop'. These 'archetypes' correspond with those visible when creating a test account through the brower.
-l, [--license-count=N]
Number of register license available. When running automation it's usually the case that the app state is reset between tests. Every test uses a new licens. When you run use them up you'll need to deactivate registers or create a new store. The default here is 100
-s, [--subdomain=SUBDOMAIN]
Store subdomain - randomly generated if not given. If you are supplying your own specific subdomain it should start with 'test'. eg 'test-97422cfe', 'test-romantic-adventerous-cows'
-e, [--email=EMAIL]
Email address associated with account - randomly generated if not given
-p, [--password=PASSWORD]
Password for account owner. Default is 'password
-t, [--time-zone=TIME_ZONE]
Store time zone. Default is 'Eastern Time (US & Canada)'. Any validation is happening elsewhere, so if you are changing this, best to check it's validity first.
-x, [--sk-expert=SK_EXPERT]
-e, [--sk-employee=SK_EMPLOYEE]
TODO: find out what these are for.
-c, [--processor=PROCESSOR]
Credit card processor. One of the few abstractions, this option makes a number of changes to the store settings to allow card payments to be processed. # Possible values: tgate_dev(default), tgate_prod, tgate_mock, clover, freedompay_uat, tgate_emulator_uat, broken, none.
--path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
If you choose to create your own custom profile(s), use this flag to point to the correct directory.
Creating a custom profile
$ store-gen new_profile [NAME]
This will create a copy of the example profile config using the provided NAME. From there you can write your own confifguration.
Additional Options
--path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
If you choose to create your own custom profile(s), use this flag to point to the correct directory. By default it will create the new profile in your current directory. If you then want to create a store using this configuration, you'll have to supply the --path
to the create
command.
Disclaimer
There's plenty here subject to change so I appologise for any mistakes or omissions in the documentaion. Any querries? Post on Slack - #testengineering or #reflektor