twi 0.3.1 → 0.3.3
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 +8 -0
- data/lib/twi/conversation.rb +6 -0
- data/lib/twi/delivery.rb +8 -0
- data/lib/twi/message.rb +7 -1
- data/lib/twi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01de6e0fa13c532bd02589db8ac03947a027b37776db9b28f09020708835e63f
|
|
4
|
+
data.tar.gz: c49292117c1c3ae70aef36df3992db51e12abef8dd834eb91c63bdc41ef3556d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 872ea7ff211920e04ab77040458f2f06bd669311e521b413716046dd04a3abca8e01fb9455d04662e37bb5faca5f30fb17433748be24c0ae25b3e797b483f614
|
|
7
|
+
data.tar.gz: 15d74809e032ea818a8fcee16a0a0fac26a55e0694aa9e49cd1bf7f0bc820a1bf41bf231a7893a208377b10bd2b7aa6a60563d7093a1280c2328fdf21d5a0f99
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.3.3] - 2026-06-01
|
|
2
|
+
|
|
3
|
+
- [Fix] Use newer console URL for Twi::Conversation.url
|
|
4
|
+
|
|
5
|
+
## [0.3.2] - 2026-06-01
|
|
6
|
+
|
|
7
|
+
- [New] Add Twi::Message.url_for, Twi::Delivery.url_for, Twi::Delivery.unsubscribed?
|
|
8
|
+
|
|
1
9
|
## [0.3.1] - 2026-06-01
|
|
2
10
|
|
|
3
11
|
- [New] Raise Twi::Error, not Twilio::REST::RestError
|
data/lib/twi/conversation.rb
CHANGED
|
@@ -30,6 +30,12 @@ module Twi
|
|
|
30
30
|
conversation.delete
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def url
|
|
34
|
+
url = "/console/conversations/services/#{Twi.lio.conversation_sid}/conversations/#{id}"
|
|
35
|
+
query = "frameUrl=#{CGI.escape url}"
|
|
36
|
+
"https://console.twilio.com/us1/develop/conversations/manage/services?#{query}"
|
|
37
|
+
end
|
|
38
|
+
|
|
33
39
|
def create_message(content:, image_ids: [])
|
|
34
40
|
conversation.messages.create **message_params_for(content, image_ids)
|
|
35
41
|
end
|
data/lib/twi/delivery.rb
CHANGED
|
@@ -12,6 +12,14 @@ module Twi
|
|
|
12
12
|
# @return [String, nil] error code
|
|
13
13
|
def code = @params['ErrorCode']
|
|
14
14
|
|
|
15
|
+
# @return [String] documentation URL for given error code.
|
|
16
|
+
def self.url_for(code)
|
|
17
|
+
"https://www.twilio.com/docs/api/errors/#{code}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @return [Boolean] whether the delivery failed because the recipient unsubscribed.
|
|
21
|
+
def self.unsubscribed?(code) = code.eql? '21610'
|
|
22
|
+
|
|
15
23
|
# @return [Hash] the shape of the payload send by Twilio to the callback URL.
|
|
16
24
|
def self.params_for(id:, status:, code: nil)
|
|
17
25
|
{ SmsSid: id, MessageStatus: status, ErrorCode: code }
|
data/lib/twi/message.rb
CHANGED
|
@@ -30,6 +30,12 @@ module Twi
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
# @return [String] log URL for given message.
|
|
34
|
+
def self.url_for(id)
|
|
35
|
+
account_sid = Twi.lio.account_sid
|
|
36
|
+
"https://console.twilio.com/us1/monitor/logs/sms/#{account_sid}/#{id}"
|
|
37
|
+
end
|
|
38
|
+
|
|
33
39
|
attr_reader :status
|
|
34
40
|
|
|
35
41
|
# Sends a message.
|
|
@@ -40,7 +46,7 @@ module Twi
|
|
|
40
46
|
@id = message.sid
|
|
41
47
|
@status = message.status
|
|
42
48
|
rescue Twilio::REST::RestError => error
|
|
43
|
-
raise Error, error
|
|
49
|
+
raise Error, code: error.code, message: error.error_message
|
|
44
50
|
end
|
|
45
51
|
|
|
46
52
|
# @return [Hash] the shape of the payload send by Twilio to the callback URL.
|
data/lib/twi/version.rb
CHANGED