twi 0.5.0 → 0.6.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 +4 -0
- data/lib/twi/conversation.rb +13 -10
- data/lib/twi/mock/conversation.rb +1 -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: 6f15688c986ff6cfb45fb8f72e76934b1c02ea597ee7925c9bf832fd00e3adef
|
|
4
|
+
data.tar.gz: 8ed7d2d7baca898202a9b030c1b6d493dd1a11ac7fd25671f41268322a4a4a9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab513b054afb8ca7d41d891d6de3faf0d004af9487b6d288cfd4fe80c2c29570c3f897b7b118be789d679ba5af139df69657baba9476ee6ac462e6b43442d490
|
|
7
|
+
data.tar.gz: 4361b2fded185f6456fef30b71da30a14dfde0a17032586fd81a58155d27f87a43aadbf0c7943c5b2c5eef7f3c5b294cf591abcdacf86ee961f49deac9d84d40
|
data/CHANGELOG.md
CHANGED
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(participants:)
|
|
8
|
+
params = create_params_for participants
|
|
9
9
|
conversation = conversation_service.conversation_with_participants.create **params
|
|
10
10
|
|
|
11
11
|
@params = { id: conversation.sid, status: conversation.state }
|
|
@@ -65,19 +65,22 @@ module Twi
|
|
|
65
65
|
conversation_service.conversations id
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def create_params_for(
|
|
68
|
+
def create_params_for(participants)
|
|
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(participants),
|
|
72
72
|
}
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
def participant_params_for(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
def participant_params_for(participants)
|
|
76
|
+
participants.map do |participant|
|
|
77
|
+
phone = "+1#{participant[:phone]}"
|
|
78
|
+
if participant[:identity]
|
|
79
|
+
{ messaging_binding: { projected_address: phone }, identity: participant[:identity] }
|
|
80
|
+
else
|
|
81
|
+
{ messaging_binding: { address: phone } }
|
|
82
|
+
end
|
|
83
|
+
end.map(&:to_json)
|
|
81
84
|
end
|
|
82
85
|
|
|
83
86
|
def message_params_for(content, image_ids)
|
data/lib/twi/version.rb
CHANGED