hephaestus 0.8.13 → 0.8.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/hephaestus +9 -1
  4. data/lib/hephaestus/app_name.rb +4 -4
  5. data/lib/hephaestus/generators/app_generator.rb +19 -10
  6. data/lib/hephaestus/version.rb +1 -1
  7. data/{templates/script → script}/edit-credentials +3 -3
  8. data/script/setup-vault +29 -0
  9. data/script/vault.json +68 -0
  10. data/templates/app/controllers/concerns/authable.rb.tt +0 -1
  11. data/templates/app/jobs/application_job.rb +3 -6
  12. data/templates/config/locales/en.yml.tt +5 -0
  13. data/templates/config/locales/settings/en.yml.tt +6 -0
  14. data/templates/root/Procfile +1 -0
  15. data/templates/root/README.md.tt +4 -0
  16. data/templates/root/Rakefile +8 -0
  17. metadata +8 -16
  18. data/templates/config/locales/en.yml +0 -6
  19. data/templates/config/locales/settings/en.yml +0 -5
  20. data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json +0 -42
  21. data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json +0 -12
  22. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json +0 -9
  23. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/responses.json +0 -64
  24. data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +0 -116
  25. data/templates/lib/plug_app/schemas/api/2023-03-06/openapi.json +0 -30
  26. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json +0 -90
  27. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/message_created.json +0 -51
  28. data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json +0 -51
  29. data/templates/script/ci +0 -7
  30. data/templates/script/test +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f10ca0de88c450f5e8febca532d785bb3e0b9ae1392e84a89e5bc69822936bf4
4
- data.tar.gz: 5558246e1b43416722c74d86f35527b39894834524bb863c9cc7380233b661c5
3
+ metadata.gz: c6f1564007f86900d81b992b6df2f93428859cb5a8c6c22a15a5cef29eb7d198
4
+ data.tar.gz: bd340377613e44ea895a03871835863cc059cd740c9800c64e56e19b481ecc4a
5
5
  SHA512:
6
- metadata.gz: c38a22b9ac3409157e42f26aea6b82ea3b488c984b43e18918c8d4cf12aee16ec446fad81aa0d04cecad9ad5676130e4cc0990605d8502f2131af37e3d44d152
7
- data.tar.gz: 04aa1224bad239a6f7ef662d1f00a61ffb0a560ab882472e7afcad07f820600f7f3e6f2aa70ef639338abfa5264f6544b99e096f75f0b4922c79425a77598ed9
6
+ metadata.gz: 4b1399f84f3bb750c0b8de78a729d3e2b47c43bfb8abf5d6f611928162dd2a9c61b7044a39c4348626e2ff819f0eb9b4ff0e67f6dcb78a3c318616a3b42e452c
7
+ data.tar.gz: 855af63634afe1b2e6a6cb1af37358270f7508c2e8720426c512f0abb7c8b6e6b7eeae661b8237149906c3f86e806e08aeb53b7896f9eaff50c11b5ce4720d20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.8.14] - 19-12-2024
2
+ ## What's Changed
3
+ * Add scripting logic to Hephaestus by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/102
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.13...v0.8.14
1
7
  # [v0.8.13] - 17-12-2024
2
8
  ## What's Changed
3
9
  * Move content to clio by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/99
data/bin/hephaestus CHANGED
@@ -97,4 +97,12 @@ config.keys.each do |key|
97
97
  config.delete(key) if delete_keys
98
98
  end
99
99
 
100
- Hephaestus::AppGenerator.start
100
+
101
+ case ARGV[0]
102
+ when "run"
103
+ ENV["HEPHAESTUS_CAPITAL_PLUG_NAME"] = `grep 'module Plug\S*' config/application.rb | sed -E 's/module Plug//'`.strip
104
+ script_dir = File.join(ENGINE_ROOT, "script")
105
+ puts `#{File.join(script_dir, ARGV[1..-1].join(' '))}`
106
+ else
107
+ Hephaestus::AppGenerator.start
108
+ end
@@ -10,22 +10,22 @@ module Hephaestus
10
10
  "plug-#{Rails.application.class.module_parent.name.underscore[5..-1]}"
11
11
  end
12
12
 
13
- # like, `slack`
13
+ # like, `slack`, github, or `html_proofer`
14
14
  def plug_name
15
15
  app_name.split("-", 2).last
16
16
  end
17
17
 
18
- # like, `Slack`, or `html_proofer => HtmlProofer`
18
+ # like, `Slack`, `GitHub`, or `html_proofer
19
19
  def capital_plug_name
20
20
  plug_name.camelcase
21
21
  end
22
22
 
23
- # like, `SLACK`
23
+ # like, `SLACK` `GITHUB`, or `HTML_PROOFER`
24
24
  def upcase_plug_name
25
25
  plug_name.upcase
26
26
  end
27
27
 
28
- # like, `slack`, or `HTMLProofer => html_proofer``
28
+ # like, `slack`, `github`, or `html_proofer`
29
29
  def underscore_plug_name
30
30
  plug_name.underscore
31
31
  end
@@ -142,7 +142,7 @@ module Hephaestus
142
142
  directory(source, "test", force: true)
143
143
 
144
144
  # This must be here, rather than a generator, because generators are run in a Rails environment,
145
- # and the OpenAPI middleware, which is loaded when the app boots, requires the schema files to be present.
145
+ # and the OpenAPI middleware, which is loaded when the app boots, requires the lib/schemas files to be present.
146
146
  directory("lib/schemas/api/2023-03-06", "lib/schemas/api/2023-03-06")
147
147
 
148
148
  # we do this to specify the template source, otherwise the generator wants to use Rails own `bin` dir
@@ -151,7 +151,7 @@ module Hephaestus
151
151
  chmod_dir("bin")
152
152
 
153
153
  # we do this to specify the template source, otherwise the generator wants to use Rails' own dir
154
- ["controllers", "jobs", "services", "views"].each do |dir|
154
+ ["controllers", "jobs", "lib", "services", "views"].each do |dir|
155
155
  source = File.join(Hephaestus::Engine.root, "templates", "app", dir)
156
156
  directory(source, "app/#{dir}", force: true)
157
157
  end
@@ -182,7 +182,9 @@ module Hephaestus
182
182
  File.rename(File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "app.json"), File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "#{plug_name}.json"))
183
183
 
184
184
  Dir.chdir(shell.base.result_dir) do
185
- unless ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
185
+ if ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
186
+ say(set_color("Not installing gems...", :yellow))
187
+ else
186
188
  say(set_color("Installing gems...", :cyan))
187
189
  capture_stdout do
188
190
  run("bundle install", abort_on_failure: false)
@@ -232,15 +234,22 @@ module Hephaestus
232
234
  def first_commit
233
235
  say(set_color("Creating first commit...", :cyan))
234
236
 
237
+ result = nil
235
238
  Dir.chdir(shell.base.result_dir) do
236
- capture_stdout do
237
- run("git init")
238
- run("git remote add origin https://github.com/yettoapp/#{app_name}.git")
239
- run("git branch -m production")
239
+ # capture_stdout do
240
+ run("git init")
241
+ run("git branch -m production")
240
242
 
241
- run("git add .")
242
- run("git commit -m 'Initial commit'", capture: true)
243
- end
243
+ run("git add .")
244
+ run("git commit -m 'Initial commit'", capture: true)
245
+
246
+ result = run("gh repo create yettoapp/#{app_name} --private --source . --push")
247
+ # end
248
+ end
249
+
250
+ unless result
251
+ say(set_color("Could not create repository on GitHub! Do you have the `gh` cli installed? ", :red))
252
+ sleep(3)
244
253
  end
245
254
  end
246
255
 
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.13"
5
+ VERSION = "0.8.14"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
@@ -27,11 +27,11 @@ do
27
27
  done
28
28
 
29
29
  if [[ $development == true ]]; then
30
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Development Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e development
30
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Development Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e development
31
31
  elif [[ $staging == true ]]; then
32
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Staging Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e staging
32
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Staging Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e staging
33
33
  elif [[ $production == true ]]; then
34
- RAILS_MASTER_KEY=$(op read "op://Plug-Email/Production Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e production
34
+ RAILS_MASTER_KEY=$(op read "op://Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME/Production Secrets/Common/RAILS_MASTER_KEY") bin/rails credentials:edit -e production
35
35
  else
36
36
  echo "Please specify a target environment with one of the following flags: --development, --staging, --production"
37
37
  exit 1
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+
6
+ # Get the current file location and its parent directory
7
+ current_file_location=$(realpath "$0")
8
+ parent_dir=$(dirname "$current_file_location")
9
+
10
+ vault_name="Plug-$HEPHAESTUS_CAPITAL_PLUG_NAME"
11
+ op vault create "$vault_name"
12
+
13
+ op item create \
14
+ --template="$parent_dir/vault.json" \
15
+ --vault "$vault_name" \
16
+ --title "Development secrets" \
17
+ --tags 'development'
18
+
19
+ op item create \
20
+ --template="$parent_dir/vault.json" \
21
+ --vault "$vault_name" \
22
+ --title "Staging secrets" \
23
+ --tags 'staging'
24
+
25
+ op item create \
26
+ --template="$parent_dir/vault.json" \
27
+ --vault "$vault_name" \
28
+ --title "Production secrets" \
29
+ --tags 'production'
data/script/vault.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "title": "",
3
+ "vault": {
4
+ "name": ""
5
+ },
6
+ "category": "SECURE_NOTE",
7
+ "sections": [
8
+ {
9
+ "id": "Yetto",
10
+ "label": "Yetto"
11
+ },
12
+ {
13
+ "id": "Unique",
14
+ "label": "Unique"
15
+ },
16
+ {
17
+ "id": "Common",
18
+ "label": "Common"
19
+ }
20
+ ],
21
+ "fields": [
22
+ {
23
+ "id": "YETTO_SIGNING_SECRET",
24
+ "section": {
25
+ "id": "Yetto"
26
+ },
27
+ "type": "CONCEALED",
28
+ "label": "YETTO_SIGNING_SECRET",
29
+ "value": "xxx"
30
+ },
31
+ {
32
+ "id": "YETTO_PLUG_PEM",
33
+ "section": {
34
+ "id": "Yetto"
35
+ },
36
+ "type": "CONCEALED",
37
+ "label": "YETTO_PLUG_PEM",
38
+ "value": "xxx"
39
+ },
40
+ {
41
+ "id": "YETTO_PLUG_ID",
42
+ "section": {
43
+ "id": "Yetto"
44
+ },
45
+ "type": "CONCEALED",
46
+ "label": "YETTO_PLUG_ID",
47
+ "value": "xxx"
48
+ },
49
+ {
50
+ "id": "NONCE",
51
+ "section": {
52
+ "id": "Unique"
53
+ },
54
+ "type": "CONCEALED",
55
+ "label": "NONCE",
56
+ "value": "xxx"
57
+ },
58
+ {
59
+ "id": "RAILS_MASTER_KEY",
60
+ "section": {
61
+ "id": "Common"
62
+ },
63
+ "type": "CONCEALED",
64
+ "label": "RAILS_MASTER_KEY",
65
+ "value": "xxx"
66
+ }
67
+ ]
68
+ }
@@ -15,7 +15,6 @@ module Authable
15
15
  sig { void }
16
16
  def <%= plug_name %>_calling_back?
17
17
  state = params.fetch(:state, "")
18
- state = params.fetch(:state, "")
19
18
 
20
19
  state_obj = parse_state(state)
21
20
  nonce = state_obj.fetch(:nonce, "")
@@ -1,10 +1,7 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- class ApplicationJob < ActiveJob::Base
5
- # Automatically retry jobs that encountered a deadlock
6
- # retry_on ActiveRecord::Deadlocked
7
-
8
- # Most jobs are safe to ignore if the underlying records are no longer available
9
- # discard_on ActiveJob::DeserializationError
4
+ class ApplicationJob < Hephaestus::ApplicationJob
5
+ # TODO: Add whatever configuration you need here;
6
+ # note that Hephaestus sets some defaults for you already.
10
7
  end
@@ -0,0 +1,5 @@
1
+ # Files in the config/locales directory are used for internationalization and
2
+ # are automatically loaded by Rails. If you want to use locales other than
3
+ # English, add the necessary files in this directory.
4
+
5
+ en:
@@ -0,0 +1,6 @@
1
+ en:
2
+ new_step_one_heading: "Before you continue..."
3
+ new_step_one_text: "This plug will ask you if the Yetto app can authorize with your <%= capital_plug_name %> account. Make sure you're an admin who is able to install apps."
4
+ new_step_two_heading: "Authenticate with Yetto's <%= capital_plug_name %> app"
5
+ new_step_two_text: "This will connect our <%= capital_plug_name %> app with your Yetto org"
6
+ new_step_two_oauth_button: "Click to auth with <%= capital_plug_name %>"
@@ -1,2 +1,3 @@
1
1
  web: $SERVER_CMD # defined in script/server
2
2
  supervisor: bin/jobs -c "$(bundle show hephaestus)/config/queue.yml"
3
+ ngrok: script/ngrok
@@ -1 +1,5 @@
1
1
  # <%= app_name.titlecase %>
2
+
3
+ Start your server with `script/server`, or `script/server --debug` to enable debugging.
4
+
5
+ Your plug is available at `${hostname}-plug-<%= plug_name %>.ngrok.io:6661`.
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative "config/application"
7
+
8
+ Rails.application.load_tasks
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hephaestus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.13
4
+ version: 0.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -445,6 +445,9 @@ files:
445
445
  - lib/hephaestus/version.rb
446
446
  - lib/tasks/hephaestus_tasks.rake
447
447
  - lib/tasks/rubocop.rake
448
+ - script/edit-credentials
449
+ - script/setup-vault
450
+ - script/vault.json
448
451
  - templates/app/controllers/app_controller.rb.tt
449
452
  - templates/app/controllers/application_controller.rb
450
453
  - templates/app/controllers/concerns/authable.rb.tt
@@ -470,8 +473,8 @@ files:
470
473
  - templates/config/environment.rb
471
474
  - templates/config/environments/blank.rb
472
475
  - templates/config/initializers/environment.rb
473
- - templates/config/locales/en.yml
474
- - templates/config/locales/settings/en.yml
476
+ - templates/config/locales/en.yml.tt
477
+ - templates/config/locales/settings/en.yml.tt
475
478
  - templates/config/puma.rb
476
479
  - templates/config/routes.rb.tt
477
480
  - templates/db/queue_schema.rb
@@ -488,15 +491,6 @@ files:
488
491
  - templates/hephaestus_vscode/extensions.json
489
492
  - templates/hephaestus_vscode/launch.json
490
493
  - templates/hephaestus_vscode/settings.json
491
- - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json
492
- - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json
493
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json
494
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/responses.json
495
- - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json
496
- - templates/lib/plug_app/schemas/api/2023-03-06/openapi.json
497
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json
498
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/message_created.json
499
- - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json
500
494
  - templates/lib/schemas/api/2023-03-06/components/parameters/headers/yetto.json
501
495
  - templates/lib/schemas/api/2023-03-06/components/parameters/plugInstallation.json
502
496
  - templates/lib/schemas/api/2023-03-06/components/schemas/plug.json
@@ -511,6 +505,7 @@ files:
511
505
  - templates/root/Gemfile
512
506
  - templates/root/Procfile
513
507
  - templates/root/README.md.tt
508
+ - templates/root/Rakefile
514
509
  - templates/root/compose.yml
515
510
  - templates/root/config.ru
516
511
  - templates/root/hephaestus_dockerignore
@@ -520,16 +515,13 @@ files:
520
515
  - templates/root/hephaestus_licensed.yml
521
516
  - templates/root/hephaestus_rubocop.yml
522
517
  - templates/root/hephaestus_ruby-version
523
- - templates/script/ci
524
518
  - templates/script/docker-build-prod.tt
525
519
  - templates/script/docker-run.tt
526
- - templates/script/edit-credentials
527
520
  - templates/script/hmac_text
528
521
  - templates/script/licenses
529
522
  - templates/script/ngrok.tt
530
523
  - templates/script/server
531
524
  - templates/script/sorbet
532
- - templates/script/test
533
525
  - templates/sorbet/custom.rbi
534
526
  - templates/test/controllers/app_controller_test.rb.tt
535
527
  - templates/test/controllers/application_controller_test.rb
@@ -1,6 +0,0 @@
1
- en:
2
- new_step_one_heading: "Before you continue..."
3
- new_step_one_text: "This plug can only be installed"
4
- new_step_two_heading: "Authenticate"
5
- new_step_two_text: "This will connect your previously installed app with your Yetto org"
6
- new_step_two_oauth_button: "Click to auth with"
@@ -1,5 +0,0 @@
1
- en:
2
- some_example_heading: "From name"
3
- some_example_label: "Some example"
4
- another_example_heading: "Reply-to email address"
5
- another_example_label: "Another example"
@@ -1,42 +0,0 @@
1
- {
2
- "Event": {
3
- "name": "X-Yetto-Event",
4
- "in": "header",
5
- "description": "The event from Yetto",
6
- "required": true,
7
- "schema": {
8
- "type": "string",
9
- "pattern": "^{created|updated|destroyed}$"
10
- }
11
- },
12
- "RecordType": {
13
- "name": "X-Yetto-RecordType",
14
- "in": "header",
15
- "description": "The record type from Yetto",
16
- "required": true,
17
- "schema": {
18
- "type": "string",
19
- "pattern": "^[a-z_]+$"
20
- }
21
- },
22
- "DeliveryID": {
23
- "name": "X-Yetto-DeliveryID",
24
- "in": "header",
25
- "description": "The delivery ID from Yetto",
26
- "required": true,
27
- "schema": {
28
- "type": "string",
29
- "pattern": "^[a-z0-9-]+$"
30
- }
31
- },
32
- "Signature": {
33
- "name": "X-Yetto-Signature",
34
- "in": "header",
35
- "description": "The signature from Yetto",
36
- "required": true,
37
- "schema": {
38
- "type": "string",
39
- "pattern": "^sha256=[a-f0-9]{64}$"
40
- }
41
- }
42
- }
@@ -1,12 +0,0 @@
1
- {
2
- "plugInstallationId": {
3
- "name": "plugInstallationId",
4
- "in": "path",
5
- "description": "The plug installation's unique ID",
6
- "required": true,
7
- "schema": {
8
- "type": "string",
9
- "pattern": "^pli_[A-Z0-9]{26}$"
10
- }
11
- }
12
- }
@@ -1,9 +0,0 @@
1
- {
2
- "InboundWebhook": {
3
- "type": "object",
4
- "required": [
5
- "From"
6
- ],
7
- "properties": {}
8
- }
9
- }
@@ -1,64 +0,0 @@
1
- {
2
- "202": {
3
- "type": "object",
4
- "required": [
5
- "message"
6
- ],
7
- "properties": {
8
- "message": {
9
- "type": "string",
10
- "value": "Accepted"
11
- }
12
- }
13
- },
14
- "204": {
15
- "type": "object",
16
- "required": [
17
- "message"
18
- ],
19
- "properties": {
20
- "message": {
21
- "type": "string",
22
- "value": "No Content"
23
- }
24
- }
25
- },
26
- "400": {
27
- "type": "object",
28
- "required": [
29
- "errors"
30
- ],
31
- "properties": {
32
- "errors": {
33
- "type": "array",
34
- "items": {
35
- "type": "object",
36
- "properties": {
37
- "message": {
38
- "type": "string"
39
- }
40
- }
41
- }
42
- }
43
- }
44
- },
45
- "404": {
46
- "type": "object",
47
- "required": [
48
- "errors"
49
- ],
50
- "properties": {
51
- "errors": {
52
- "type": "array",
53
- "items": {
54
- "type": "object",
55
- "properties": {
56
- "message": {
57
- "type": "string"
58
- }
59
- }
60
- }
61
- }
62
- }
63
- }
64
- }
@@ -1,116 +0,0 @@
1
- {
2
- "CreateAppMessage": {
3
- "type": "object",
4
- "required": [
5
- "yetto"
6
- ],
7
- "properties": {
8
- "yetto": {
9
- "type": "object",
10
- "required": [
11
- "plug_installation",
12
- "message"
13
- ],
14
- "properties": {
15
- "plug_installation": {
16
- "type": "object",
17
- "required": [
18
- "id",
19
- "settings"
20
- ],
21
- "properties": {
22
- "id": {
23
- "type": "string",
24
- "pattern": "^(?:pli)_[A-Z0-9]{26}$"
25
- },
26
- "settings": {
27
- "type": "object",
28
- "required": [],
29
- "properties": {}
30
- }
31
- }
32
- },
33
- "message": {
34
- "type": "object",
35
- "required": [
36
- "id",
37
- "conversation",
38
- "text_content",
39
- "metadata"
40
- ],
41
- "properties": {
42
- "id": {
43
- "type": "string",
44
- "pattern": "^(?:msg)_[A-Z0-9]{26}$"
45
- },
46
- "text_content": {
47
- "type": "string"
48
- },
49
- "metadata": {
50
- "type": "object"
51
- },
52
- "conversation": {
53
- "type": "object",
54
- "required": [
55
- "id",
56
- "title",
57
- "metadata"
58
- ],
59
- "properties": {
60
- "id": {
61
- "type": "string",
62
- "pattern": "^(?:cnv)_[A-Z0-9]{26}$"
63
- },
64
- "title": {
65
- "type": "string"
66
- },
67
- "metadata": {
68
- "type": "object"
69
- }
70
- }
71
- }
72
- }
73
- }
74
- },
75
- "additionalProperties": false
76
- }
77
- },
78
- "additionalProperties": false
79
- },
80
- "ConfigureApp": {
81
- "type": "object",
82
- "required": [
83
- "yetto"
84
- ],
85
- "properties": {
86
- "yetto": {
87
- "type": "object",
88
- "required": [
89
- "plug_installation",
90
- ],
91
- "properties": {
92
- "plug_installation": {
93
- "type": "object",
94
- "required": [
95
- "id",
96
- "settings"
97
- ],
98
- "properties": {
99
- "id": {
100
- "type": "string",
101
- "pattern": "^(?:pli)_[A-Z0-9]{26}$"
102
- },
103
- "settings": {
104
- "type": "object",
105
- "required": [],
106
- "properties": {}
107
- }
108
- }
109
- }
110
- },
111
- "additionalProperties": false
112
- }
113
- },
114
- "additionalProperties": false
115
- }
116
- }
@@ -1,30 +0,0 @@
1
- {
2
- "openapi": "3.0.0",
3
- "info": {
4
- "title": "App Plug API",
5
- "description": "An OpenAPI definition for the App Plug REST API.",
6
- "version": "2023-03-06",
7
- "termsOfService": "https://yetto.app/terms/",
8
- "license": {
9
- "name": "Apache 2.0",
10
- "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
11
- }
12
- },
13
- "servers": [
14
- {
15
- "url": "https://yetto.app/2023-03-06",
16
- "description": "Production basepath"
17
- }
18
- ],
19
- "paths": {
20
- "/api/2023-03-06/plug_installation/created": {
21
- "$ref": "paths/yetto/plug_installation_created.json"
22
- },
23
- "/api/2023-03-06/message/created": {
24
- "$ref": "paths/yetto/message_created.json"
25
- },
26
- "/app/2023-03-06/{plugInstallationId}": {
27
- "$ref": "paths/app.json"
28
- }
29
- }
30
- }
@@ -1,90 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Inbound",
5
- "App"
6
- ],
7
- "description": "This represents something",
8
- "operationId": "Post a Yetto message",
9
- "parameters": [
10
- {
11
- "$ref": "../components/parameters/plugInstallation.json#/plugInstallationId"
12
- }
13
- ],
14
- "requestBody": {
15
- "required": true,
16
- "content": {
17
- "application/json": {
18
- "schema": {
19
- "$ref": "../components/schemas/plug.json#/something"
20
- }
21
- },
22
- "example": {
23
- "message": {
24
- "text_content": "Hello _World_",
25
- "is_public": true,
26
- "author": {
27
- "name": "John Doe"
28
- },
29
- "metadata": {}
30
- },
31
- "creator": {
32
- "id": "usr_1234567890"
33
- }
34
- }
35
- }
36
- },
37
- "responses": {
38
- "202": {
39
- "description": "Accepted",
40
- "content": {
41
- "application/json": {
42
- "schema": {
43
- "$ref": "../components/schemas/responses.json#/202"
44
- }
45
- }
46
- }
47
- },
48
- "204": {
49
- "description": "No Content",
50
- "content": {
51
- "application/json": {
52
- "schema": {
53
- "$ref": "../components/schemas/responses.json#/204"
54
- }
55
- }
56
- }
57
- },
58
- "400": {
59
- "description": "Bad Request",
60
- "content": {
61
- "application/json": {
62
- "schema": {
63
- "$ref": "../components/schemas/responses.json#/400"
64
- }
65
- }
66
- }
67
- },
68
- "403": {
69
- "description": "Forbidden",
70
- "content": {
71
- "application/json": {
72
- "schema": {
73
- "$ref": "../components/schemas/responses.json#/403"
74
- }
75
- }
76
- }
77
- },
78
- "503": {
79
- "description": "Service Unavailable",
80
- "content": {
81
- "application/json": {
82
- "schema": {
83
- "$ref": "../components/schemas/responses.json#/502"
84
- }
85
- }
86
- }
87
- }
88
- }
89
- }
90
- }
@@ -1,51 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Yetto"
5
- ],
6
- "description": "After a message is created in Yetto, this delivers it.",
7
- "operationId": "Create a new message",
8
- "requestBody": {
9
- "required": true,
10
- "content": {
11
- "application/json": {
12
- "schema": {
13
- "$ref": "../../components/schemas/yetto.json#/CreateAppMessage"
14
- }
15
- }
16
- }
17
- },
18
- "responses": {
19
- "204": {
20
- "description": "No Content",
21
- "content": {
22
- "application/json": {
23
- "schema": {
24
- "$ref": "../../components/schemas/responses.json#/204"
25
- }
26
- }
27
- }
28
- },
29
- "400": {
30
- "description": "Bad Request",
31
- "content": {
32
- "application/json": {
33
- "schema": {
34
- "$ref": "../../components/schemas/responses.json#/400"
35
- }
36
- }
37
- }
38
- },
39
- "404": {
40
- "description": "Not Found",
41
- "content": {
42
- "application/json": {
43
- "schema": {
44
- "$ref": "../../components/schemas/responses.json#/404"
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
@@ -1,51 +0,0 @@
1
- {
2
- "post": {
3
- "tags": [
4
- "Yetto"
5
- ],
6
- "description": "After a plug installation is created, this executes",
7
- "operationId": "Post a plug installation",
8
- "requestBody": {
9
- "required": true,
10
- "content": {
11
- "application/json": {
12
- "schema": {
13
- "$ref": "../../components/schemas/yetto.json#/ConfigureApp"
14
- }
15
- }
16
- }
17
- },
18
- "responses": {
19
- "204": {
20
- "description": "No Content",
21
- "content": {
22
- "application/json": {
23
- "schema": {
24
- "$ref": "../../components/schemas/responses.json#/204"
25
- }
26
- }
27
- }
28
- },
29
- "400": {
30
- "description": "Bad Request",
31
- "content": {
32
- "application/json": {
33
- "schema": {
34
- "$ref": "../../components/schemas/responses.json#/400"
35
- }
36
- }
37
- }
38
- },
39
- "404": {
40
- "description": "Not Found",
41
- "content": {
42
- "application/json": {
43
- "schema": {
44
- "$ref": "../../components/schemas/responses.json#/404"
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
data/templates/script/ci DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- export CI=true
6
-
7
- script/test
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- bin/rails test "$@"