hephaestus 0.8.16 → 0.8.17
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 +12 -0
- data/app/services/hephaestus/yetto_service.rb +11 -11
- data/config/initializers/environment.rb +5 -3
- data/config/initializers/slack_webhook_logger.rb +2 -0
- data/lib/hephaestus/support/hephaestus/webmocks/yetto_webmock.rb +23 -23
- data/lib/hephaestus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3933e43d607eed501525e333ac301e884b8c448d7554907e98a052bab40b02
|
4
|
+
data.tar.gz: 161019282e8a46aef3528f64ae5911ca02a088a2d8ac7671cb57c822e7cbbb7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f93eb058a032dc335f1b131a2399421d29aa18d0625b558f9045267909ac379235e91a4cf1f9dd54ac37aadd3d23a372b7fb3fd7d843c6ab44e2449c569687e8
|
7
|
+
data.tar.gz: 86627d4ab213a0d047e986721a77a67c947504a54d02ca8cc9c57f81e22e9980050e5a89f027685fec43b27464e56a7c97c50f57ba0e2ad70eef3f147a43c12b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# [v0.8.17] - 17-02-2025
|
2
|
+
## What's Changed
|
3
|
+
* Silence errors about being unable to log metrics by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/116
|
4
|
+
|
5
|
+
|
6
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.16.1...v0.8.17
|
7
|
+
# [v0.8.16.1] - 28-01-2025
|
8
|
+
## What's Changed
|
9
|
+
* correct API URL in test by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/114
|
10
|
+
|
11
|
+
|
12
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.16...v0.8.16.1
|
1
13
|
# [v0.8.16] - 26-01-2025
|
2
14
|
## What's Changed
|
3
15
|
* Point to new API url by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/105
|
@@ -17,7 +17,7 @@ end
|
|
17
17
|
module Hephaestus
|
18
18
|
class YettoService
|
19
19
|
# Version is set by the consuming plug
|
20
|
-
|
20
|
+
YETTO_API_VERSION_URL = "#{Hephaestus::YETTO_API_URL}/#{Rails.configuration.yetto_api_version}"
|
21
21
|
|
22
22
|
class << self
|
23
23
|
def yetto_client
|
@@ -29,14 +29,14 @@ module Hephaestus
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def perform_token_exchange(plug_installation_id)
|
32
|
-
response = yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).post("#{
|
32
|
+
response = yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).post("#{YETTO_API_VERSION_URL}/plug/installations/#{plug_installation_id}/access_tokens")
|
33
33
|
body = response.parsed_json_body
|
34
34
|
body["token"]
|
35
35
|
end
|
36
36
|
|
37
37
|
def get_plug_installation(plug_installation_id)
|
38
38
|
token = perform_token_exchange(plug_installation_id)
|
39
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).get("#{
|
39
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).get("#{YETTO_API_VERSION_URL}/installations/#{plug_installation_id}")
|
40
40
|
end
|
41
41
|
|
42
42
|
def update_plug_installation(plug_installation_id, params)
|
@@ -46,47 +46,47 @@ module Hephaestus
|
|
46
46
|
plug_installation[:credentials] = params.fetch(:credentials, {})
|
47
47
|
|
48
48
|
token = perform_token_exchange(plug_installation_id)
|
49
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).patch("#{
|
49
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).patch("#{YETTO_API_VERSION_URL}/installations/#{plug_installation_id}", json: plug_installation)
|
50
50
|
end
|
51
51
|
|
52
52
|
def get_messages_in_inbox(plug_installation_id, inbox_id, filter: {})
|
53
53
|
token = perform_token_exchange(plug_installation_id)
|
54
54
|
|
55
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).get("#{
|
55
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).get("#{YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/messages#{to_filter_query(filter)}")
|
56
56
|
end
|
57
57
|
|
58
58
|
def get_messages_in_conversation(plug_installation_id, conversation_id, filter: {})
|
59
59
|
token = perform_token_exchange(plug_installation_id)
|
60
60
|
|
61
|
-
yetto_client.with_headers("Authorization" => "Bearer #{token}").get("#{
|
61
|
+
yetto_client.with_headers("Authorization" => "Bearer #{token}").get("#{YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages#{to_filter_query(filter)}")
|
62
62
|
end
|
63
63
|
|
64
64
|
def update_message(plug_installation_id, message_id, params)
|
65
65
|
token = perform_token_exchange(plug_installation_id)
|
66
66
|
|
67
|
-
yetto_client.with_headers("Authorization" => "Bearer #{token}").patch("#{
|
67
|
+
yetto_client.with_headers("Authorization" => "Bearer #{token}").patch("#{YETTO_API_VERSION_URL}/messages/#{message_id}", json: params)
|
68
68
|
end
|
69
69
|
|
70
70
|
def create_conversation(plug_installation_id, inbox_id, params)
|
71
71
|
token = perform_token_exchange(plug_installation_id)
|
72
72
|
|
73
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).post("#{
|
73
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).post("#{YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/conversations", json: params)
|
74
74
|
end
|
75
75
|
|
76
76
|
def create_message_reply(plug_installation_id, message_id, params)
|
77
77
|
token = perform_token_exchange(plug_installation_id)
|
78
78
|
|
79
|
-
yetto_client.with_headers("Authorization" => "Bearer #{token}").post("#{
|
79
|
+
yetto_client.with_headers("Authorization" => "Bearer #{token}").post("#{YETTO_API_VERSION_URL}/messages/#{message_id}/replies", json: params)
|
80
80
|
end
|
81
81
|
|
82
82
|
def add_message_to_conversation(plug_installation_id, conversation_id, params)
|
83
83
|
token = perform_token_exchange(plug_installation_id)
|
84
84
|
|
85
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).post("#{
|
85
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{token}" }).post("#{YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages", json: params)
|
86
86
|
end
|
87
87
|
|
88
88
|
def get_plug_installations(filter: {})
|
89
|
-
yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).get("#{
|
89
|
+
yetto_client.with_headers({ "Authorization" => "Bearer #{encoded_jwt}" }).get("#{YETTO_API_VERSION_URL}/plug/installations#{to_filter_query(filter)}")
|
90
90
|
end
|
91
91
|
|
92
92
|
private def to_filter_query(hash)
|
@@ -94,10 +94,12 @@ module Hephaestus
|
|
94
94
|
"web.#{YETTO_DOMAIN}"
|
95
95
|
end
|
96
96
|
|
97
|
-
YETTO_API_URL = if Rails.env.
|
98
|
-
"localhost:3000/api"
|
97
|
+
YETTO_API_URL = if Rails.env.development?
|
98
|
+
"http://localhost:3000/api"
|
99
|
+
elsif Rails.env.test?
|
100
|
+
"http://#{YETTO_URL}/api"
|
99
101
|
else
|
100
|
-
"api.#{YETTO_DOMAIN}"
|
102
|
+
"https://api.#{YETTO_DOMAIN}"
|
101
103
|
end
|
102
104
|
|
103
105
|
YETTO_REDIRECT_URL = productionish? ? "#{PROTOCOL}#{YETTO_URL}" : "#{PROTOCOL}127.0.0.1:3000"
|
@@ -20,4 +20,6 @@ SlackWebhookLogger.setup do |config|
|
|
20
20
|
|
21
21
|
config.ignore_patterns = [/Can't verify CSRF token authenticity/, /is not a valid MIME type/]
|
22
22
|
config.ignore_patterns << "Fail claimed jobs" # random Solid Queue warning
|
23
|
+
|
24
|
+
config.ignore_patterns << /OpenTelemetry error/ # no need for opentelemetry errors
|
23
25
|
end
|
@@ -9,7 +9,7 @@ module Hephaestus
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def assert_requested_post_access_token(plug_installation_id, times: 1)
|
12
|
-
assert_requested(:post, "#{Hephaestus::YettoService::
|
12
|
+
assert_requested(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/plug/installations/#{plug_installation_id}/access_tokens", times: times)
|
13
13
|
end
|
14
14
|
|
15
15
|
def stub_post_access_token(plug_installation_id)
|
@@ -17,18 +17,18 @@ module Hephaestus
|
|
17
17
|
token: Faker::Alphanumeric.alphanumeric(number: 26).upcase,
|
18
18
|
}
|
19
19
|
|
20
|
-
stub_request(:post, "#{Hephaestus::YettoService::
|
20
|
+
stub_request(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/plug/installations/#{plug_installation_id}/access_tokens")
|
21
21
|
.to_return(
|
22
22
|
body: response.to_json,
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
26
|
def assert_requested_get_plug_installation(plug_installation_id, times: 1)
|
27
|
-
assert_requested(:get, "#{Hephaestus::YettoService::
|
27
|
+
assert_requested(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/installations/#{plug_installation_id}", times:)
|
28
28
|
end
|
29
29
|
|
30
30
|
def stub_get_plug_installation(plug_installation_id, response: {}, status: 200)
|
31
|
-
stub_request(:get, "#{Hephaestus::YettoService::
|
31
|
+
stub_request(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/installations/#{plug_installation_id}")
|
32
32
|
.to_return(
|
33
33
|
status: status,
|
34
34
|
headers: { content_type: "application/json; charset=utf-8" },
|
@@ -37,11 +37,11 @@ module Hephaestus
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def assert_requested_update_plug_installation(plug_installation_id)
|
40
|
-
assert_requested(:patch, "#{Hephaestus::YettoService::
|
40
|
+
assert_requested(:patch, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/installations/#{plug_installation_id}")
|
41
41
|
end
|
42
42
|
|
43
43
|
def assert_not_requested_update_plug_installation(plug_installation_id)
|
44
|
-
assert_requested(:patch, "#{Hephaestus::YettoService::
|
44
|
+
assert_requested(:patch, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/installations/#{plug_installation_id}", times: 0)
|
45
45
|
end
|
46
46
|
|
47
47
|
def stub_update_plug_installation(plug_installation_id, params, response: {}, status: 200)
|
@@ -49,7 +49,7 @@ module Hephaestus
|
|
49
49
|
|
50
50
|
response[:plug_installation] = { id: plug_installation_id }
|
51
51
|
|
52
|
-
stub_request(:patch, "#{Hephaestus::YettoService::
|
52
|
+
stub_request(:patch, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/installations/#{plug_installation_id}")
|
53
53
|
.with(
|
54
54
|
body: params,
|
55
55
|
)
|
@@ -61,7 +61,7 @@ module Hephaestus
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def assert_requested_create_conversation(plug_installation_id, inbox_id)
|
64
|
-
assert_requested(:post, "#{Hephaestus::YettoService::
|
64
|
+
assert_requested(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/conversations")
|
65
65
|
end
|
66
66
|
|
67
67
|
def stub_create_conversation(plug_installation_id, inbox_id, payload, response: {})
|
@@ -69,7 +69,7 @@ module Hephaestus
|
|
69
69
|
|
70
70
|
response[:plug_installation] = { id: plug_installation_id }
|
71
71
|
|
72
|
-
stub_request(:post, "#{Hephaestus::YettoService::
|
72
|
+
stub_request(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/conversations")
|
73
73
|
.with(
|
74
74
|
body: payload,
|
75
75
|
)
|
@@ -81,11 +81,11 @@ module Hephaestus
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def assert_requested_get_plug_installations(filter: "")
|
84
|
-
assert_requested(:get, "#{Hephaestus::YettoService::
|
84
|
+
assert_requested(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/plug/installations?#{filter}")
|
85
85
|
end
|
86
86
|
|
87
87
|
def stub_get_plug_installations(response, status: 200, filter: "")
|
88
|
-
stub_request(:get, "#{Hephaestus::YettoService::
|
88
|
+
stub_request(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/plug/installations?#{filter}")
|
89
89
|
.to_return(
|
90
90
|
status: status,
|
91
91
|
headers: { content_type: "application/json; charset=utf-8" },
|
@@ -94,12 +94,12 @@ module Hephaestus
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def assert_requested_get_messages_in_inbox(plug_installation_id, inbox_id, filter: "")
|
97
|
-
assert_requested(:get, "#{Hephaestus::YettoService::
|
97
|
+
assert_requested(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/messages?#{filter}")
|
98
98
|
end
|
99
99
|
|
100
100
|
def stub_get_messages_in_inbox(plug_installation_id, inbox_id, response, filter: "")
|
101
101
|
stub_post_access_token(plug_installation_id)
|
102
|
-
stub_request(:get, "#{Hephaestus::YettoService::
|
102
|
+
stub_request(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/inboxes/#{inbox_id}/messages?#{filter}")
|
103
103
|
.to_return(
|
104
104
|
status: 200,
|
105
105
|
body: response.to_json,
|
@@ -107,13 +107,13 @@ module Hephaestus
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def assert_requested_get_messages_in_conversation(plug_installation_id, conversation_id, filter: "")
|
110
|
-
assert_requested(:get, "#{::Hephaestus::YettoService::
|
110
|
+
assert_requested(:get, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages?#{filter}")
|
111
111
|
end
|
112
112
|
|
113
113
|
def stub_get_messages_in_conversation(plug_installation_id, conversation_id, response, status: 200, filter: "")
|
114
114
|
stub_post_access_token(plug_installation_id)
|
115
115
|
|
116
|
-
stub_request(:get, "#{::Hephaestus::YettoService::
|
116
|
+
stub_request(:get, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages?#{filter}")
|
117
117
|
.to_return(
|
118
118
|
status: status,
|
119
119
|
headers: { content_type: "application/json; charset=utf-8" },
|
@@ -126,7 +126,7 @@ module Hephaestus
|
|
126
126
|
|
127
127
|
response[:plug_installation] = { id: plug_installation_id }
|
128
128
|
|
129
|
-
stub_request(:post, "#{Hephaestus::YettoService::
|
129
|
+
stub_request(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages")
|
130
130
|
.with(
|
131
131
|
body: payload,
|
132
132
|
)
|
@@ -138,17 +138,17 @@ module Hephaestus
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def assert_requested_add_message_to_conversation(plug_installation_id, conversation_id)
|
141
|
-
assert_requested(:post, "#{Hephaestus::YettoService::
|
141
|
+
assert_requested(:post, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages")
|
142
142
|
end
|
143
143
|
|
144
144
|
def assert_requested_create_message(plug_installation_id, message_id)
|
145
|
-
assert_requested(:post, "#{::Hephaestus::YettoService::
|
145
|
+
assert_requested(:post, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/messages/#{message_id}/replies")
|
146
146
|
end
|
147
147
|
|
148
148
|
def stub_create_message(plug_installation_id, message_id, payload)
|
149
149
|
stub_post_access_token(plug_installation_id)
|
150
150
|
|
151
|
-
stub_request(:post, "#{::Hephaestus::YettoService::
|
151
|
+
stub_request(:post, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/messages/#{message_id}/replies")
|
152
152
|
.with(
|
153
153
|
body: payload,
|
154
154
|
)
|
@@ -160,12 +160,12 @@ module Hephaestus
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def assert_requested_update_message(plug_installation_id, message_id)
|
163
|
-
assert_requested(:patch, "#{::Hephaestus::YettoService::
|
163
|
+
assert_requested(:patch, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/messages/#{message_id}")
|
164
164
|
end
|
165
165
|
|
166
166
|
def stub_update_message(plug_installation_id, message_id, payload)
|
167
167
|
stub_post_access_token(plug_installation_id)
|
168
|
-
stub_request(:patch, "#{::Hephaestus::YettoService::
|
168
|
+
stub_request(:patch, "#{::Hephaestus::YettoService::YETTO_API_VERSION_URL}/messages/#{message_id}")
|
169
169
|
.with(
|
170
170
|
body: payload,
|
171
171
|
)
|
@@ -177,13 +177,13 @@ module Hephaestus
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def assert_requested_find_message_in_conversation_by_metadata(plug_installation_id, conversation_id)
|
180
|
-
assert_requested(:get, "#{Hephaestus::YettoService::
|
180
|
+
assert_requested(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages?#{filter}")
|
181
181
|
end
|
182
182
|
|
183
183
|
def stub_find_message_in_conversation(plug_installation_id, conversation_id, response, status: 200, filter: "")
|
184
184
|
stub_post_access_token(plug_installation_id)
|
185
185
|
|
186
|
-
stub_request(:get, "#{Hephaestus::YettoService::
|
186
|
+
stub_request(:get, "#{Hephaestus::YettoService::YETTO_API_VERSION_URL}/conversations/#{conversation_id}/messages?#{filter}")
|
187
187
|
.to_return(
|
188
188
|
status: status,
|
189
189
|
headers: { content_type: "application/json; charset=utf-8" },
|
data/lib/hephaestus/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|