twi 0.3.8 → 0.5.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 +12 -0
- data/lib/twi/conversation.rb +10 -13
- data/lib/twi/delivery.rb +3 -0
- data/lib/twi/mock/conversation.rb +1 -1
- data/lib/twi/mock/message.rb +2 -2
- 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: 727c9e8147c7ff29da2287c0a8df35be3bcf750e697baddba487605a99357e6e
|
|
4
|
+
data.tar.gz: b4fd8d8854d21d652649ba542aa578319421900f61d2d17c88b24daea365912f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc4539e765dd8d5d4426cff34b94e8222ba846422462c964c9e48e93f57dba29ef09490a816c628ac63209e701799191dbabd4fd39b1087129fac00f7925ac4b
|
|
7
|
+
data.tar.gz: 2b0a73db81a391abaa10b89b31073a31617fcc18864ea3413b708726b6c2c878d7c7fc03af34ab3fc1f0f8eaa2657ca00cfbbc5d7b0668fa4ffc729940ee334c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.5.0] - 2026-07-27
|
|
2
|
+
|
|
3
|
+
- [New] Add Twi::Delivery#sender
|
|
4
|
+
|
|
5
|
+
## [0.4.0] - 2026-06-15
|
|
6
|
+
|
|
7
|
+
- [Fix] Include proxy_address in conversation participant
|
|
8
|
+
|
|
9
|
+
## [0.3.9] - 2026-06-08
|
|
10
|
+
|
|
11
|
+
- [Fix] Make Twi::Mock::Message.id not null
|
|
12
|
+
|
|
1
13
|
## [0.3.8] - 2026-06-02
|
|
2
14
|
|
|
3
15
|
- [Fix] Make Twi::Message.id not null
|
data/lib/twi/conversation.rb
CHANGED
|
@@ -4,8 +4,8 @@ module Twi
|
|
|
4
4
|
class Conversation < Resource
|
|
5
5
|
attr_reader :id, :status
|
|
6
6
|
|
|
7
|
-
def create_with(
|
|
8
|
-
params = create_params_for
|
|
7
|
+
def create_with(host:, participant_phones:)
|
|
8
|
+
params = create_params_for host, participant_phones
|
|
9
9
|
conversation = conversation_service.conversation_with_participants.create **params
|
|
10
10
|
|
|
11
11
|
@params = { id: conversation.sid, status: conversation.state }
|
|
@@ -65,22 +65,19 @@ module Twi
|
|
|
65
65
|
conversation_service.conversations id
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def create_params_for(
|
|
68
|
+
def create_params_for(host, participant_phones)
|
|
69
69
|
{
|
|
70
70
|
messaging_service_sid: Twi.lio.messaging_sid, x_twilio_webhook_enabled: 'true',
|
|
71
|
-
friendly_name: @params[:friendly_name], participant: participant_params_for(
|
|
71
|
+
friendly_name: @params[:friendly_name], participant: participant_params_for(host, participant_phones),
|
|
72
72
|
}
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
def participant_params_for(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{ messaging_binding: { address: phone } }
|
|
82
|
-
end
|
|
83
|
-
end.map(&:to_json)
|
|
75
|
+
def participant_params_for(host, participant_phones)
|
|
76
|
+
params = [{ messaging_binding: { projected_address: "+1#{host[:phone]}" }, identity: host[:identity] }]
|
|
77
|
+
participant_phones.map do |participant_phone|
|
|
78
|
+
params << { messaging_binding: { address: "+1#{participant_phone}", proxy_address: "+1#{host[:phone]}" } }
|
|
79
|
+
end
|
|
80
|
+
params.map(&:to_json)
|
|
84
81
|
end
|
|
85
82
|
|
|
86
83
|
def message_params_for(content, image_ids)
|
data/lib/twi/delivery.rb
CHANGED
|
@@ -12,6 +12,9 @@ module Twi
|
|
|
12
12
|
# @return [String, nil] error code
|
|
13
13
|
def code = @params['ErrorCode']
|
|
14
14
|
|
|
15
|
+
# @return [String] phone number that delivered the message.
|
|
16
|
+
def sender = @params['From']
|
|
17
|
+
|
|
15
18
|
# @return [String] documentation URL for given error code.
|
|
16
19
|
def self.url_for(code)
|
|
17
20
|
"https://www.twilio.com/docs/api/errors/#{code}"
|
data/lib/twi/mock/message.rb
CHANGED
|
@@ -11,10 +11,10 @@ module Twi
|
|
|
11
11
|
Twi.mock.message_error = nil
|
|
12
12
|
raise Error, error
|
|
13
13
|
elsif Twi.mock.message
|
|
14
|
-
@id = Twi.mock.message[:id]
|
|
14
|
+
@params[:id] = Twi.mock.message[:id]
|
|
15
15
|
@status = Twi.mock.message[:status]
|
|
16
16
|
else
|
|
17
|
-
@id = "SM#{rand}"
|
|
17
|
+
@params[:id] = "SM#{rand}"
|
|
18
18
|
@status = 'delivered'
|
|
19
19
|
end
|
|
20
20
|
end
|
data/lib/twi/version.rb
CHANGED