hephaestus 0.5.1 → 0.6.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 +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/hephaestus/version.rb +1 -1
- data/templates/.github/dependabot.yml +1 -1
- data/templates/app/controllers/settings_controller.rb +1 -1
- data/templates/app/controllers/yetto_controller.rb +0 -11
- data/templates/app/jobs/update_yetto_job.rb +1 -3
- data/templates/app/lib/body_parameter/yetto_parameters.rb +1 -1
- data/templates/app/services/yetto_service.rb +0 -7
- data/templates/test/support/webmocks/yetto_webmock.rb +0 -19
- data/templates/vendor/fly/fly-staging.toml +1 -1
- metadata +3 -4
- data/templates/app/lib/plug_app/switches/message_created.jsonc +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a51ee122f0ef70262525ad38d2c72f2ef5d88b522d83dcecb0a5f0387ff022b
|
4
|
+
data.tar.gz: 5a14c44ec5775bbceebb5d7742612168a9f294dc1d47540c6bc058a8daf818f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a5e7f11040e4365121b47b285e8f059c1887565eaea052b00d8c041509703dc52e748dfe9d3dd6fc366a72d5c5e506744cc370805b1324103d4996c8c26bc9c
|
7
|
+
data.tar.gz: '0931cbcbffc5b40ada651d49093181906024a856d78d65ac2118ca3a6cfaf066699f6b1251db116d99cae6a3b16fa51054403a39494463338486e3a2dfa37f07'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## [v0.5.2] - 13-11-2023
|
2
|
+
## What's Changed
|
3
|
+
* Fix RAILS_ENV in fly-staging.toml by @balevine in https://github.com/yettoapp/hephaestus/pull/13
|
4
|
+
* Change dependabot checking to by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/14
|
5
|
+
|
6
|
+
|
7
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.5.1...v0.5.2
|
8
|
+
## [v0.5.1] - 31-10-2023
|
9
|
+
## What's Changed
|
10
|
+
* Remove excess :// characters from PROTOCOL by @balevine in https://github.com/yettoapp/hephaestus/pull/12
|
11
|
+
|
12
|
+
## New Contributors
|
13
|
+
* @balevine made their first contribution in https://github.com/yettoapp/hephaestus/pull/12
|
14
|
+
|
15
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.5.0...v0.5.1
|
1
16
|
## [v0.5.0] - 13-10-2023
|
2
17
|
## What's Changed
|
3
18
|
* More edits by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/11
|
data/lib/hephaestus/version.rb
CHANGED
@@ -31,7 +31,7 @@ class SettingsController < ApplicationController
|
|
31
31
|
return not_acceptable
|
32
32
|
end
|
33
33
|
|
34
|
-
plug_installation = response.
|
34
|
+
plug_installation = response.parsed_json_body
|
35
35
|
access_token = plug_installation.fetch("credentials", {}).fetch("access_token", "")
|
36
36
|
|
37
37
|
if access_token.blank?
|
@@ -11,22 +11,11 @@ class YettoController < ApplicationController
|
|
11
11
|
|
12
12
|
before_action :from_yetto?
|
13
13
|
|
14
|
-
AFTER_CREATE_MESSAGE_SWITCH = JSON.parse(Rails.root.join("app/lib/plug_app/switches/message_created.jsonc").read)
|
15
|
-
|
16
14
|
def event
|
17
15
|
case pparam_yetto_event
|
18
16
|
when Headers::Yetto::EVENT_AFTER_CREATE
|
19
17
|
case pparam_yetto_record_type
|
20
18
|
when Headers::Yetto::RECORD_TYPE_PLUG_INSTALLATION
|
21
|
-
create_inbox_switch_data = {
|
22
|
-
type: "create_inbox_switch",
|
23
|
-
inbox: { id: bparam_inbox_id },
|
24
|
-
plug_installation: { id: bparam_plug_installation_id },
|
25
|
-
payload: AFTER_CREATE_MESSAGE_SWITCH,
|
26
|
-
}
|
27
|
-
|
28
|
-
UpdateYettoJob.perform_later(create_inbox_switch_data)
|
29
|
-
|
30
19
|
no_content
|
31
20
|
when Headers::Yetto::RECORD_TYPE_MESSAGE
|
32
21
|
|
@@ -10,15 +10,13 @@ class UpdateYettoJob < ApplicationJob
|
|
10
10
|
def perform(params)
|
11
11
|
type = params.delete(:type)
|
12
12
|
|
13
|
-
|
13
|
+
params.fetch(:inbox, {}).fetch(:id, nil)
|
14
14
|
plug_installation_id = params.fetch(:plug_installation, {}).fetch(:id, nil)
|
15
15
|
message_id = params.fetch(:message, {}).fetch(:id, nil)
|
16
16
|
|
17
17
|
case type
|
18
18
|
when "update_plug_installation"
|
19
19
|
YettoService.update_installation(plug_installation_id, params)
|
20
|
-
when "create_inbox_switch"
|
21
|
-
YettoService.create_inbox_switch(inbox_id, plug_installation_id, params)
|
22
20
|
when "create_message_reply"
|
23
21
|
YettoService.create_message_reply(message_id, plug_installation_id, params)
|
24
22
|
when "add_message_metadata"
|
@@ -101,7 +101,7 @@ module BodyParameter
|
|
101
101
|
title = conversation.fetch(:title, "")
|
102
102
|
created_by_user = message.fetch(:created_by_user, {})
|
103
103
|
created_by_plug = message.fetch(:created_by_plug, {})
|
104
|
-
author =
|
104
|
+
author = created_by_user.presence || created_by_plug
|
105
105
|
name = author.fetch(:name, "")
|
106
106
|
metadata = message.fetch(:metadata, {}).to_unsafe_hash
|
107
107
|
|
@@ -34,13 +34,6 @@ class YettoService
|
|
34
34
|
yetto_client.with_headers("Authorization" => "Bearer #{token}").patch("#{YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}", json: plug_installation)
|
35
35
|
end
|
36
36
|
|
37
|
-
def create_inbox_switch(inbox_id, plug_installation_id, params)
|
38
|
-
payload = params[:payload]
|
39
|
-
token = perform_token_exchange(plug_installation_id)
|
40
|
-
|
41
|
-
yetto_client.with_headers("Authorization" => "Bearer #{token}").post("#{YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/switches", json: payload)
|
42
|
-
end
|
43
|
-
|
44
37
|
def update_message(message_id, plug_installation_id, params)
|
45
38
|
payload = params[:payload]
|
46
39
|
token = perform_token_exchange(plug_installation_id)
|
@@ -115,24 +115,5 @@ module Webmocks
|
|
115
115
|
body: {}.to_json,
|
116
116
|
)
|
117
117
|
end
|
118
|
-
|
119
|
-
def assert_requested_create_inbox_switch(inbox_id, plug_installation_id)
|
120
|
-
assert_requested_post_access_token(plug_installation_id)
|
121
|
-
assert_requested(:post, "#{::YettoService::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/switches")
|
122
|
-
end
|
123
|
-
|
124
|
-
def stub_create_inbox_switch(inbox_id, plug_installation_id, payload)
|
125
|
-
stub_post_access_token(plug_installation_id)
|
126
|
-
|
127
|
-
stub_request(:post, "#{::YettoService::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/switches")
|
128
|
-
.with(
|
129
|
-
body: payload,
|
130
|
-
)
|
131
|
-
.to_return(
|
132
|
-
status: 200,
|
133
|
-
headers: { content_type: "application/json; charset=utf-8" },
|
134
|
-
body: {}.to_json,
|
135
|
-
)
|
136
|
-
end
|
137
118
|
end
|
138
119
|
end
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -171,7 +171,6 @@ files:
|
|
171
171
|
- templates/app/lib/plug_app/middleware/not_found.rb
|
172
172
|
- templates/app/lib/plug_app/middleware/openapi_validation.rb
|
173
173
|
- templates/app/lib/plug_app/middleware/tracing_attributes.rb
|
174
|
-
- templates/app/lib/plug_app/switches/message_created.jsonc
|
175
174
|
- templates/app/lib/query_parameter.rb
|
176
175
|
- templates/app/serializers/error_serializer.rb
|
177
176
|
- templates/app/services/http_service.rb
|
@@ -251,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
250
|
- !ruby/object:Gem::Version
|
252
251
|
version: 3.4.7
|
253
252
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
253
|
+
rubygems_version: 3.5.1
|
255
254
|
signing_key:
|
256
255
|
specification_version: 4
|
257
256
|
summary: Generate a Rails app that can be used to create plugs for Yetto.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "Send internal comments to App",
|
3
|
-
"configuration": {
|
4
|
-
"version": "2023-03-06",
|
5
|
-
"events": {
|
6
|
-
"message.created": {
|
7
|
-
"conditions": {
|
8
|
-
"if": "{% data.message.visibility == 'internal' and data.message.text_content contains '@App' %}"
|
9
|
-
},
|
10
|
-
"actions": [
|
11
|
-
{
|
12
|
-
"name": "Send to App",
|
13
|
-
"uses": "send_to_plug",
|
14
|
-
"with": {
|
15
|
-
"plug_id": "{{ data.switch.created_by_plug.id }}",
|
16
|
-
"message": "{{ data.message }}",
|
17
|
-
"plug_installation": "{{ data.plug_installation }}",
|
18
|
-
"inbox": "{{ data.inbox }}"
|
19
|
-
}
|
20
|
-
}
|
21
|
-
]
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|