twi 0.3.1 → 0.3.2
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 +4 -0
- data/lib/twi/conversation.rb +6 -0
- data/lib/twi/delivery.rb +8 -0
- data/lib/twi/message.rb +6 -0
- 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: ad98e587f9dba0c2812169dfc04958634e683ebc2e2208b1d693e7de8f90b543
|
|
4
|
+
data.tar.gz: 1515528e3fcbe515f6831f21fa859214a8c2d274cb79ad4341db5808550d1a77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20029e35bb9768472e97be71146d350879ea694453e835f248892f78306e8aa41d4da8d8a497ee71144f62d6f3d0a82a537d0aa3647ba2d7d83697502a24dbd5
|
|
7
|
+
data.tar.gz: 3f766ce5571a8cc438ea37c2bc2aed10f92ea1aa5f12606fca36691a7ab86fb2486651f8d74478fc794bdf3187f67be5789b394b810ac86bf2dbcd52fd14cb50
|
data/CHANGELOG.md
CHANGED
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}/messages"
|
|
35
|
+
query = "currentFrameUrl=#{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.
|
data/lib/twi/version.rb
CHANGED