automation-api 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.dependabot/config.yml +8 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +3 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +7 -0
  8. data/CHANGELONG.md +13 -0
  9. data/Dockerfile +16 -0
  10. data/Gemfile +6 -0
  11. data/Gemfile.lock +149 -0
  12. data/Jenkinsfile +31 -0
  13. data/README.md +176 -0
  14. data/Rakefile +44 -0
  15. data/automation-api.gemspec +42 -0
  16. data/bin/console +17 -0
  17. data/bin/setup +8 -0
  18. data/config/basic.yml +16 -0
  19. data/config/essential.yml +21 -0
  20. data/config/loyalty.yml +7 -0
  21. data/config/online.yml +17 -0
  22. data/config/profile.yml.example +231 -0
  23. data/config/restrictions.yml +55 -0
  24. data/config/starter.yml +11 -0
  25. data/docker-compose.yml +12 -0
  26. data/exe/store-gen +6 -0
  27. data/lib/automation/api.rb +17 -0
  28. data/lib/automation/api/cli.rb +320 -0
  29. data/lib/automation/api/client.rb +133 -0
  30. data/lib/automation/api/requests.rb +26 -0
  31. data/lib/automation/api/requests/account_owner.rb +22 -0
  32. data/lib/automation/api/requests/app_sync.rb +93 -0
  33. data/lib/automation/api/requests/button_pages.rb +34 -0
  34. data/lib/automation/api/requests/buttons.rb +34 -0
  35. data/lib/automation/api/requests/categories.rb +34 -0
  36. data/lib/automation/api/requests/collection.rb +32 -0
  37. data/lib/automation/api/requests/customers.rb +34 -0
  38. data/lib/automation/api/requests/departments.rb +34 -0
  39. data/lib/automation/api/requests/employees.rb +34 -0
  40. data/lib/automation/api/requests/entitlements.rb +33 -0
  41. data/lib/automation/api/requests/features.rb +33 -0
  42. data/lib/automation/api/requests/helper.rb +59 -0
  43. data/lib/automation/api/requests/location_preferences.rb +22 -0
  44. data/lib/automation/api/requests/loyalty_provisioning.rb +22 -0
  45. data/lib/automation/api/requests/matrix_products.rb +34 -0
  46. data/lib/automation/api/requests/modifiers.rb +34 -0
  47. data/lib/automation/api/requests/named_discounts.rb +34 -0
  48. data/lib/automation/api/requests/online_orders.rb +18 -0
  49. data/lib/automation/api/requests/registers.rb +30 -0
  50. data/lib/automation/api/requests/sales.rb +22 -0
  51. data/lib/automation/api/requests/sales_restrictions.rb +34 -0
  52. data/lib/automation/api/requests/settings.rb +22 -0
  53. data/lib/automation/api/requests/stock_items.rb +34 -0
  54. data/lib/automation/api/requests/tax_rate_service_taxes.rb +34 -0
  55. data/lib/automation/api/requests/taxes.rb +34 -0
  56. data/lib/automation/api/requests/tenders.rb +38 -0
  57. data/lib/automation/api/version.rb +7 -0
  58. metadata +321 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b5c379106726417528c8660c525662b6657259cc4b9e6b7065e29b5ed729cb7d
4
+ data.tar.gz: c6f63c3fc5e93cafd8e53eb38b980740b9d8270a8708e88cc74351ead25f2d85
5
+ SHA512:
6
+ metadata.gz: 1d6f9001ca6e399270b8ae2adf832606657bea8c5fd7b65985f4d4364367882fa71742a68d3099d7e2ec2f02c5db9ef8894b35a26c5a0ae90cee0a69c2c5c837
7
+ data.tar.gz: dc6537d24579e74bcb602b0acb8b848987c11f6cd32722ee9a1ed14070d63cfc4375a2671a772db1cb17926b87bc67e6d0dd3d07221c7f12da2271b2587b2a87
@@ -0,0 +1,8 @@
1
+ version: 1
2
+ update_configs:
3
+ - package_manager: "ruby:bundler"
4
+ directory: "/"
5
+ update_schedule: "live"
6
+ allowed_updates:
7
+ - match:
8
+ update_type: "security"
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /log/
7
+ /pkg/
8
+ /spec/pacts/
9
+ /spec/reports/
10
+ /tmp/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'spec/**/*.rb'
@@ -0,0 +1 @@
1
+ ruby-2.5.5
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.5
7
+ before_install: gem install bundler -v 1.16.6
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.3.0] - 11/01/2021
9
+
10
+ ### Added
11
+
12
+ - CHANGELOG.md added.
13
+ - Appsync
@@ -0,0 +1,16 @@
1
+ FROM ruby:2.5.5
2
+
3
+ LABEL DevOps <devops@shopkeep.com>
4
+
5
+ RUN mkdir -p /usr/src/app
6
+ WORKDIR /usr/src/app
7
+
8
+ RUN gem install bundler
9
+
10
+ RUN mkdir -p /lib/automation
11
+ COPY Gemfile* ./
12
+ COPY *.gemspec ./
13
+ COPY lib/automation/api/version.rb ./lib/automation/api/
14
+ RUN bundle install --binstubs --jobs 4 --retry 3
15
+
16
+ COPY . ./
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in automation-api.gemspec
6
+ gemspec
@@ -0,0 +1,149 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ automation-api (0.3.0)
5
+ graphql-client (~> 0.16.0)
6
+ json (>= 1.8, < 3)
7
+ rest-client (~> 2.1)
8
+ thor (~> 0.20)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activesupport (6.1.1)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ zeitwerk (~> 2.3)
19
+ awesome_print (1.8.0)
20
+ codeclimate-test-reporter (1.0.7)
21
+ simplecov
22
+ coderay (1.1.2)
23
+ concurrent-ruby (1.1.6)
24
+ diff-lcs (1.3)
25
+ docile (1.3.2)
26
+ domain_name (0.5.20190701)
27
+ unf (>= 0.0.5, < 1.0.0)
28
+ faker (2.10.1)
29
+ i18n (>= 1.6, < 2)
30
+ filelock (1.1.1)
31
+ find_a_port (1.0.1)
32
+ graphql (1.11.6)
33
+ graphql-client (0.16.0)
34
+ activesupport (>= 3.0)
35
+ graphql (~> 1.8)
36
+ http-accept (1.7.0)
37
+ http-cookie (1.0.3)
38
+ domain_name (~> 0.5)
39
+ httparty (0.17.3)
40
+ mime-types (~> 3.0)
41
+ multi_xml (>= 0.5.2)
42
+ i18n (1.8.2)
43
+ concurrent-ruby (~> 1.0)
44
+ json (2.3.0)
45
+ method_source (0.9.2)
46
+ mime-types (3.3.1)
47
+ mime-types-data (~> 3.2015)
48
+ mime-types-data (3.2019.1009)
49
+ minitest (5.14.3)
50
+ multi_xml (0.6.0)
51
+ netrc (0.11.0)
52
+ pact (1.47.0)
53
+ pact-mock_service (~> 3.0, >= 3.3.1)
54
+ pact-support (~> 1.9)
55
+ rack-test (>= 0.6.3, < 2.0.0)
56
+ rspec (~> 3.0)
57
+ term-ansicolor (~> 1.0)
58
+ thor (~> 0.20)
59
+ webrick (~> 1.3)
60
+ pact-mock_service (3.5.0)
61
+ filelock (~> 1.1)
62
+ find_a_port (~> 1.0.1)
63
+ json
64
+ pact-support (~> 1.12, >= 1.12.0)
65
+ rack (~> 2.0)
66
+ rspec (>= 2.14)
67
+ term-ansicolor (~> 1.0)
68
+ thor (~> 0.19)
69
+ webrick (~> 1.3)
70
+ pact-support (1.13.0)
71
+ awesome_print (~> 1.1)
72
+ randexp (~> 0.1.7)
73
+ rspec (>= 2.14)
74
+ term-ansicolor (~> 1.0)
75
+ pact_broker-client (1.23.0)
76
+ httparty
77
+ json
78
+ rake
79
+ table_print (~> 1.5)
80
+ term-ansicolor
81
+ thor (~> 0.20)
82
+ pry (0.12.2)
83
+ coderay (~> 1.1.0)
84
+ method_source (~> 0.9.0)
85
+ rack (2.2.2)
86
+ rack-test (1.1.0)
87
+ rack (>= 1.0, < 3)
88
+ rake (12.3.3)
89
+ randexp (0.1.7)
90
+ rest-client (2.1.0)
91
+ http-accept (>= 1.7.0, < 2.0)
92
+ http-cookie (>= 1.0.2, < 2.0)
93
+ mime-types (>= 1.16, < 4.0)
94
+ netrc (~> 0.8)
95
+ rspec (3.9.0)
96
+ rspec-core (~> 3.9.0)
97
+ rspec-expectations (~> 3.9.0)
98
+ rspec-mocks (~> 3.9.0)
99
+ rspec-core (3.9.1)
100
+ rspec-support (~> 3.9.1)
101
+ rspec-expectations (3.9.0)
102
+ diff-lcs (>= 1.2.0, < 2.0)
103
+ rspec-support (~> 3.9.0)
104
+ rspec-mocks (3.9.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.9.0)
107
+ rspec-support (3.9.2)
108
+ rspec_junit_formatter (0.4.1)
109
+ rspec-core (>= 2, < 4, != 2.12.0)
110
+ simplecov (0.18.1)
111
+ docile (~> 1.1)
112
+ simplecov-html (~> 0.11.0)
113
+ simplecov-html (0.11.0)
114
+ simplecov-rcov (0.2.3)
115
+ simplecov (>= 0.4.1)
116
+ sync (0.5.0)
117
+ table_print (1.5.6)
118
+ term-ansicolor (1.7.1)
119
+ tins (~> 1.0)
120
+ thor (0.20.3)
121
+ tins (1.24.1)
122
+ sync
123
+ tzinfo (2.0.4)
124
+ concurrent-ruby (~> 1.0)
125
+ unf (0.1.4)
126
+ unf_ext
127
+ unf_ext (0.0.7.7)
128
+ webrick (1.6.0)
129
+ zeitwerk (2.4.2)
130
+
131
+ PLATFORMS
132
+ ruby
133
+
134
+ DEPENDENCIES
135
+ automation-api!
136
+ bundler (~> 1.16)
137
+ codeclimate-test-reporter (~> 1.0)
138
+ faker (~> 2.4)
139
+ pact (~> 1.42)
140
+ pact_broker-client (~> 1.20)
141
+ pry (~> 0.12.2)
142
+ rake (~> 12.3, >= 12.3.3)
143
+ rspec (~> 3.8)
144
+ rspec_junit_formatter (~> 0.2)
145
+ simplecov (~> 0.13)
146
+ simplecov-rcov (~> 0.2)
147
+
148
+ BUNDLED WITH
149
+ 1.17.3
@@ -0,0 +1,31 @@
1
+ @Library('shared-pipelines@master') _
2
+
3
+ pipeline {
4
+ agent { label 'docker-slave-staging' }
5
+
6
+ stages {
7
+ stage('Test') {
8
+ environment { COVERAGE = true }
9
+
10
+ steps {
11
+ runTests results: '/usr/artifacts/rspec.xml'
12
+ }
13
+ }
14
+ stage('Build Package') {
15
+ steps {
16
+ buildPackage language: 'ruby'
17
+ }
18
+ }
19
+ stage('Publish Package') {
20
+ when { branch 'master' }
21
+ steps {
22
+ publishPackage language: 'ruby'
23
+ }
24
+ }
25
+ }
26
+ post {
27
+ always {
28
+ cleanWs()
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,176 @@
1
+ # Automation::API
2
+
3
+ Gem for making HTTP requests to BackOffice Staging
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ source 'https://5a8e458f6acf55f1543dc82e924301613c8f8cfba0fd5949:@packagecloud.io/shopkeep/ruby' do
11
+ gem 'automation-api'
12
+ end
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install --source 'https://5a8e458f6acf55f1543dc82e924301613c8f8cfba0fd5949:@packagecloud.io/shopkeep/ruby' automation-api
22
+
23
+ ## Usage
24
+
25
+
26
+ ### Help
27
+
28
+ $ store-gen help
29
+
30
+ Commands:
31
+ store-gen create [PROFILE] # Create store of using specified profile
32
+ store-gen help [COMMAND] # Describe available commands or one specific command
33
+ store-gen list # List of predifined store profiles
34
+ store-gen new_profile [NAME] # Start creating a new custom profile
35
+ store-gen view [PROFILE] # View config file for requested profile
36
+
37
+ So for detailed 'help' for 'create'.
38
+
39
+ $ store-gen help create
40
+
41
+
42
+ ### Listing
43
+
44
+ $ store-gen list
45
+
46
+ basic
47
+ essential
48
+ loyalty
49
+ online
50
+ profile
51
+ restrictions
52
+ starter
53
+
54
+ List of predifined store porfiles.
55
+
56
+
57
+ #### Additional Options
58
+
59
+ --path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
60
+
61
+ If you choose to create your own custom profile(s), use this flag to point to the correct directory.
62
+
63
+
64
+ ### View configuration
65
+
66
+ $ store-gen view [PROFILE]
67
+
68
+ :account_owner:
69
+ :first_name: Test
70
+ :last_name: Basic
71
+ :phone: '9736928048'
72
+ :entitlements:
73
+ :activate:
74
+ - standard_care
75
+ - customer_recognition
76
+ - price_packaging
77
+ - point_of_sale
78
+ # Default: Here for reference
79
+ # - pocket
80
+ # - freemium_care
81
+ # - billing_management
82
+ :deactivate:
83
+ - freemium
84
+
85
+ View config file for requested profile(basic in the example above). Used for reference, or if creating a custom profile that extends an existing.
86
+
87
+
88
+ #### Additional Options
89
+
90
+ --path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
91
+
92
+ If you choose to create your own custom profile(s), use this flag to point to the correct directory.
93
+
94
+
95
+ ### Generating a store
96
+
97
+ $ store-gen create [PROFILE]
98
+
99
+ {"email"=>"gen+841r25@shopkeep.com",
100
+ "subdomain"=>"test-auto-thor-7a6a0b03",
101
+ "password"=>"password",
102
+ "ok"=>true,
103
+ "uuid"=>"6DC1E24C-99EF-4F86-9ECD-139E0B29403E",
104
+ "login"=>"gen+841r25@shopkeep.com",
105
+ "register_id"=>1,
106
+ "register_number"=>1,
107
+ "manager_signin"=>"8997"}
108
+ Updating account owner information...done
109
+
110
+ 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.
111
+
112
+
113
+ #### Additional Options
114
+
115
+ -a, [--archetype=ARCHETYPE]
116
+
117
+ 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.
118
+
119
+
120
+ -l, [--license-count=N]
121
+
122
+ 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
123
+
124
+
125
+ -s, [--subdomain=SUBDOMAIN]
126
+
127
+ 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'
128
+
129
+
130
+ -e, [--email=EMAIL]
131
+
132
+ Email address associated with account - randomly generated if not given
133
+
134
+
135
+ -p, [--password=PASSWORD]
136
+
137
+ Password for account owner. Default is 'password
138
+
139
+
140
+ -t, [--time-zone=TIME_ZONE]
141
+
142
+ 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.
143
+
144
+
145
+ -x, [--sk-expert=SK_EXPERT]
146
+ -e, [--sk-employee=SK_EMPLOYEE]
147
+
148
+ TODO: find out what these are for.
149
+
150
+
151
+ -c, [--processor=PROCESSOR]
152
+
153
+ 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.
154
+
155
+ --path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
156
+
157
+ If you choose to create your own custom profile(s), use this flag to point to the correct directory.
158
+
159
+
160
+ ### Creating a custom profile
161
+
162
+ $ store-gen new_profile [NAME]
163
+
164
+ This will create a copy of the example profile config using the provided NAME. From there you can write your own confifguration.
165
+
166
+
167
+ #### Additional Options
168
+
169
+ --path, [--profile-path=PROFILE_PATH] # Specify a path to the directory containing the profile configuration
170
+
171
+ 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.
172
+
173
+
174
+ ### Disclaimer
175
+
176
+ 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