hephaestus 0.8.16 → 0.8.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f141bfecf20df190360c8c07e940e02c2a9e3a9273e2b9c3a3acb3bf0cb35cd5
4
- data.tar.gz: 44feab3fcbf8e863111293651bb1e87c75ae24af25f1563b61256b8e154141de
3
+ metadata.gz: 3f26ad9b636b27e03c625f6fec30d2c52b6ae050dd48de9159cf9c415689c8b0
4
+ data.tar.gz: 4be4cbe1c5bc93f2088d02e02609961ffc11e63eeba3e22069729bd21a2de16b
5
5
  SHA512:
6
- metadata.gz: ccb5ea73b4707487c46242394367680a8488dbf77180597f016771e3d4d89990b123ace277cf8414a10729d849dbe1939538310d179cd4037db190adda3d9963
7
- data.tar.gz: dcc54b5a9195f4e4955b2450c7e1c08c930dc38ffaa7b47fa27792589a354f4a67bfcc82ddd8b2bd5b8c3d71923269a5eb857140f7e3ca37b87b964bd2292c9b
6
+ metadata.gz: b9d65aae9cea6fc9b54c51ff92f2b1d286519b2df0bd2cb3485898eca695036d37150a364ef3d836ea59b26c25efaca4a6b96ab636f2c80e6ab50b33ae644532
7
+ data.tar.gz: 218bc243b86df4b8e73a943df816a3bbd462311972e79e309136206bf01e95f89f64e5104dd9e5b5b758b22c40e7ed29b505c9b6a5b099b0823efe60ba0f45aa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.8.16.1] - 28-01-2025
2
+ ## What's Changed
3
+ * correct API URL in test by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/114
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.16...v0.8.16.1
1
7
  # [v0.8.16] - 26-01-2025
2
8
  ## What's Changed
3
9
  * 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
- YETTO_API_VERSION_TLD = "#{Hephaestus::PROTOCOL}#{Hephaestus::YETTO_API_URL}/#{Rails.configuration.yetto_api_version}"
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("#{YETTO_API_VERSION_TLD}/plug/installations/#{plug_installation_id}/access_tokens")
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("#{YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}")
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("#{YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}", json: plug_installation)
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("#{YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/messages#{to_filter_query(filter)}")
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("#{YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages#{to_filter_query(filter)}")
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("#{YETTO_API_VERSION_TLD}/messages/#{message_id}", json: params)
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("#{YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/conversations", json: params)
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("#{YETTO_API_VERSION_TLD}/messages/#{message_id}/replies", json: params)
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("#{YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages", json: params)
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("#{YETTO_API_VERSION_TLD}/plug/installations#{to_filter_query(filter)}")
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.local?
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"
@@ -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::YETTO_API_VERSION_TLD}/plug/installations/#{plug_installation_id}/access_tokens", times: times)
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::YETTO_API_VERSION_TLD}/plug/installations/#{plug_installation_id}/access_tokens")
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::YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}", times:)
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::YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}")
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::YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}")
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::YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}", times: 0)
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::YETTO_API_VERSION_TLD}/installations/#{plug_installation_id}")
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::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/conversations")
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::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/conversations")
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::YETTO_API_VERSION_TLD}/plug/installations?#{filter}")
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::YETTO_API_VERSION_TLD}/plug/installations?#{filter}")
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::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/messages?#{filter}")
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::YETTO_API_VERSION_TLD}/inboxes/#{inbox_id}/messages?#{filter}")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages?#{filter}")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages?#{filter}")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages")
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::YETTO_API_VERSION_TLD}/messages/#{message_id}/replies")
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::YETTO_API_VERSION_TLD}/messages/#{message_id}/replies")
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::YETTO_API_VERSION_TLD}/messages/#{message_id}")
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::YETTO_API_VERSION_TLD}/messages/#{message_id}")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages?#{filter}")
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::YETTO_API_VERSION_TLD}/conversations/#{conversation_id}/messages?#{filter}")
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" },
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.16"
5
+ VERSION = "0.8.16.1"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
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.16
4
+ version: 0.8.16.1
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-01-26 00:00:00.000000000 Z
11
+ date: 2025-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap