twilio-ruby 5.41.0 → 5.45.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +99 -0
  3. data/{LICENSE.md → LICENSE} +0 -0
  4. data/PULL_REQUEST_TEMPLATE.md +3 -3
  5. data/README.md +18 -2
  6. data/lib/twilio-ruby.rb +1 -1
  7. data/lib/twilio-ruby/jwt/access_token.rb +7 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +201 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +13 -1
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +6 -1
  12. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +5 -22
  13. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +25 -40
  14. data/lib/twilio-ruby/rest/client.rb +29 -3
  15. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +32 -2
  16. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +17 -2
  17. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +32 -2
  18. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +8 -1
  19. data/lib/twilio-ruby/rest/conversations/v1/user.rb +8 -1
  20. data/lib/twilio-ruby/rest/events/v1/subscription.rb +12 -5
  21. data/lib/twilio-ruby/rest/flex_api.rb +1 -1
  22. data/lib/twilio-ruby/rest/flex_api/v1.rb +1 -1
  23. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +5 -5
  24. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +88 -76
  25. data/lib/twilio-ruby/rest/flex_api/v1/web_channel.rb +2 -2
  26. data/lib/twilio-ruby/rest/insights.rb +8 -0
  27. data/lib/twilio-ruby/rest/insights/v1.rb +15 -0
  28. data/lib/twilio-ruby/rest/insights/v1/room.rb +487 -0
  29. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +378 -0
  30. data/lib/twilio-ruby/rest/ip_messaging.rb +8 -10
  31. data/lib/twilio-ruby/rest/ip_messaging/v1.rb +6 -8
  32. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +29 -68
  33. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +198 -313
  34. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +32 -59
  35. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +23 -55
  36. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +28 -71
  37. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +31 -59
  38. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +19 -39
  39. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +29 -51
  40. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +12 -18
  41. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +6 -6
  42. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +29 -66
  43. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +116 -205
  44. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +23 -50
  45. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +41 -91
  46. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +23 -50
  47. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +42 -118
  48. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +46 -100
  49. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +36 -89
  50. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +19 -41
  51. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +29 -53
  52. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +23 -53
  53. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +27 -56
  54. data/lib/twilio-ruby/rest/preview.rb +0 -21
  55. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +5 -22
  56. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +21 -39
  57. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -30
  58. data/lib/twilio-ruby/rest/serverless/v1/service.rb +5 -5
  59. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +4 -4
  60. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +4 -4
  62. data/lib/twilio-ruby/rest/serverless/v1/service/build/build_status.rb +4 -4
  63. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +4 -4
  64. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +4 -4
  65. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +4 -4
  66. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +4 -4
  67. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  68. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +4 -4
  69. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +4 -4
  70. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +15 -5
  71. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +15 -5
  72. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +28 -5
  73. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +15 -5
  74. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +28 -5
  75. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +15 -5
  76. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +12 -9
  77. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +16 -16
  78. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +21 -24
  79. data/lib/twilio-ruby/rest/verify/v2/form.rb +4 -4
  80. data/lib/twilio-ruby/rest/verify/v2/service.rb +3 -3
  81. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +3 -3
  82. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +23 -35
  83. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +27 -49
  84. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +24 -42
  85. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +4 -4
  86. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +6 -6
  87. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +6 -6
  88. data/lib/twilio-ruby/rest/video/v1/room.rb +20 -0
  89. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +150 -0
  90. data/lib/twilio-ruby/twiml/voice_response.rb +8 -4
  91. data/lib/twilio-ruby/util/configuration.rb +5 -1
  92. data/lib/twilio-ruby/version.rb +1 -1
  93. data/spec/integration/api/v2010/account/call/event_spec.rb +102 -0
  94. data/spec/integration/api/v2010/account/call/recording_spec.rb +4 -0
  95. data/spec/integration/api/v2010/account/call_spec.rb +20 -10
  96. data/spec/integration/api/v2010/account/conference/participant_spec.rb +30 -0
  97. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +4 -2
  98. data/spec/integration/conversations/v1/conversation/participant_spec.rb +30 -10
  99. data/spec/integration/conversations/v1/service/configuration_spec.rb +2 -0
  100. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +30 -10
  101. data/spec/integration/conversations/v1/service/user_spec.rb +9 -4
  102. data/spec/integration/conversations/v1/user_spec.rb +9 -4
  103. data/spec/integration/events/v1/sink/sink_test_spec.rb +1 -1
  104. data/spec/integration/events/v1/subscription_spec.rb +49 -0
  105. data/spec/integration/insights/v1/room/participant_spec.rb +147 -0
  106. data/spec/integration/insights/v1/room_spec.rb +164 -0
  107. data/spec/integration/ip_messaging/v1/credential_spec.rb +13 -13
  108. data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +11 -11
  109. data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +14 -14
  110. data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +14 -14
  111. data/spec/integration/ip_messaging/v1/service/channel_spec.rb +25 -25
  112. data/spec/integration/ip_messaging/v1/service/role_spec.rb +13 -13
  113. data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +7 -7
  114. data/spec/integration/ip_messaging/v1/service/user_spec.rb +17 -17
  115. data/spec/integration/ip_messaging/v1/service_spec.rb +9 -9
  116. data/spec/integration/ip_messaging/v2/credential_spec.rb +13 -13
  117. data/spec/integration/ip_messaging/v2/service/binding_spec.rb +11 -11
  118. data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +11 -11
  119. data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +13 -13
  120. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +17 -17
  121. data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +15 -15
  122. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +29 -29
  123. data/spec/integration/ip_messaging/v2/service/role_spec.rb +13 -13
  124. data/spec/integration/ip_messaging/v2/service/user/user_binding_spec.rb +9 -9
  125. data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +20 -20
  126. data/spec/integration/ip_messaging/v2/service/user_spec.rb +21 -21
  127. data/spec/integration/ip_messaging/v2/service_spec.rb +29 -29
  128. data/spec/integration/lookups/v1/phone_number_spec.rb +7 -7
  129. data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +4 -2
  130. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +1 -1
  131. data/spec/integration/trunking/v1/trunk/recording_spec.rb +2 -6
  132. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +4 -12
  133. data/spec/integration/verify/v2/service/entity/factor_spec.rb +5 -15
  134. data/spec/integration/verify/v2/service/entity_spec.rb +4 -12
  135. data/spec/integration/video/v1/room/room_recording_rule_spec.rb +89 -0
  136. data/spec/integration/video/v1/room_spec.rb +10 -5
  137. data/spec/jwt/access_token_spec.rb +9 -1
  138. data/spec/rest/client_spec.rb +24 -2
  139. data/twilio-ruby.gemspec +2 -1
  140. metadata +30 -19
  141. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +0 -243
  142. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +0 -213
  143. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +0 -108
  144. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights/impressions_rate.rb +0 -260
  145. data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +0 -342
  146. data/spec/integration/preview/trusted_comms/branded_call_spec.rb +0 -59
  147. data/spec/integration/preview/trusted_comms/business/insights/impressions_rate_spec.rb +0 -56
  148. data/spec/integration/preview/trusted_comms/business/insights_spec.rb +0 -12
  149. data/spec/integration/preview/trusted_comms/business_spec.rb +0 -45
  150. data/spec/integration/preview/trusted_comms/phone_call_spec.rb +0 -59
@@ -105,7 +105,7 @@ module Twilio
105
105
 
106
106
  ##
107
107
  # Create the WebChannelInstance
108
- # @param [String] flex_flow_sid The SID of the FlexFlow.
108
+ # @param [String] flex_flow_sid The SID of the Flex Flow.
109
109
  # @param [String] identity The chat identity.
110
110
  # @param [String] customer_friendly_name The chat participant's friendly name.
111
111
  # @param [String] chat_friendly_name The chat channel's friendly name.
@@ -268,7 +268,7 @@ module Twilio
268
268
  end
269
269
 
270
270
  ##
271
- # @return [String] The SID of the FlexFlow
271
+ # @return [String] The SID of the Flex Flow
272
272
  def flex_flow_sid
273
273
  @properties['flex_flow_sid']
274
274
  end
@@ -36,6 +36,14 @@ module Twilio
36
36
  self.v1.calls(sid)
37
37
  end
38
38
 
39
+ ##
40
+ # @param [String] room_sid The room_sid
41
+ # @return [Twilio::REST::Insights::V1::RoomInstance] if room_sid was passed.
42
+ # @return [Twilio::REST::Insights::V1::RoomList]
43
+ def rooms(room_sid=:unset)
44
+ self.v1.rooms(room_sid)
45
+ end
46
+
39
47
  ##
40
48
  # Provide a user friendly representation
41
49
  def to_s
@@ -16,6 +16,7 @@ module Twilio
16
16
  super
17
17
  @version = 'v1'
18
18
  @calls = nil
19
+ @rooms = nil
19
20
  end
20
21
 
21
22
  ##
@@ -32,6 +33,20 @@ module Twilio
32
33
  end
33
34
  end
34
35
 
36
+ ##
37
+ # @param [String] room_sid The room_sid
38
+ # @return [Twilio::REST::Insights::V1::RoomContext] if room_sid was passed.
39
+ # @return [Twilio::REST::Insights::V1::RoomList]
40
+ def rooms(room_sid=:unset)
41
+ if room_sid.nil?
42
+ raise ArgumentError, 'room_sid cannot be nil'
43
+ elsif room_sid == :unset
44
+ @rooms ||= RoomList.new self
45
+ else
46
+ RoomContext.new(self, room_sid)
47
+ end
48
+ end
49
+
35
50
  ##
36
51
  # Provide a user friendly representation
37
52
  def to_s
@@ -0,0 +1,487 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Insights < Domain
12
+ class V1 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class RoomList < ListResource
16
+ ##
17
+ # Initialize the RoomList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [RoomList] RoomList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Video/Rooms"
26
+ end
27
+
28
+ ##
29
+ # Lists RoomInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [room.RoomType] room_type The room_type
33
+ # @param [room.Codec] codec The codec
34
+ # @param [String] room_name The room_name
35
+ # @param [Time] created_after The created_after
36
+ # @param [Time] created_before The created_before
37
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
38
+ # guarantees to never return more than limit. Default is no limit
39
+ # @param [Integer] page_size Number of records to fetch per request, when
40
+ # not set will use the default value of 50 records. If no page_size is defined
41
+ # but a limit is defined, stream() will attempt to read the limit with the most
42
+ # efficient page size, i.e. min(limit, 1000)
43
+ # @return [Array] Array of up to limit results
44
+ def list(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil)
45
+ self.stream(
46
+ room_type: room_type,
47
+ codec: codec,
48
+ room_name: room_name,
49
+ created_after: created_after,
50
+ created_before: created_before,
51
+ limit: limit,
52
+ page_size: page_size
53
+ ).entries
54
+ end
55
+
56
+ ##
57
+ # Streams RoomInstance records from the API as an Enumerable.
58
+ # This operation lazily loads records as efficiently as possible until the limit
59
+ # is reached.
60
+ # @param [room.RoomType] room_type The room_type
61
+ # @param [room.Codec] codec The codec
62
+ # @param [String] room_name The room_name
63
+ # @param [Time] created_after The created_after
64
+ # @param [Time] created_before The created_before
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(
76
+ room_type: room_type,
77
+ codec: codec,
78
+ room_name: room_name,
79
+ created_after: created_after,
80
+ created_before: created_before,
81
+ page_size: limits[:page_size],
82
+ )
83
+
84
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
85
+ end
86
+
87
+ ##
88
+ # When passed a block, yields RoomInstance records from the API.
89
+ # This operation lazily loads records as efficiently as possible until the limit
90
+ # is reached.
91
+ def each
92
+ limits = @version.read_limits
93
+
94
+ page = self.page(page_size: limits[:page_size], )
95
+
96
+ @version.stream(page,
97
+ limit: limits[:limit],
98
+ page_limit: limits[:page_limit]).each {|x| yield x}
99
+ end
100
+
101
+ ##
102
+ # Retrieve a single page of RoomInstance records from the API.
103
+ # Request is executed immediately.
104
+ # @param [room.RoomType] room_type The room_type
105
+ # @param [room.Codec] codec The codec
106
+ # @param [String] room_name The room_name
107
+ # @param [Time] created_after The created_after
108
+ # @param [Time] created_before The created_before
109
+ # @param [String] page_token PageToken provided by the API
110
+ # @param [Integer] page_number Page Number, this value is simply for client state
111
+ # @param [Integer] page_size Number of records to return, defaults to 50
112
+ # @return [Page] Page of RoomInstance
113
+ def page(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114
+ params = Twilio::Values.of({
115
+ 'RoomType' => Twilio.serialize_list(room_type) { |e| e },
116
+ 'Codec' => Twilio.serialize_list(codec) { |e| e },
117
+ 'RoomName' => room_name,
118
+ 'CreatedAfter' => Twilio.serialize_iso8601_datetime(created_after),
119
+ 'CreatedBefore' => Twilio.serialize_iso8601_datetime(created_before),
120
+ 'PageToken' => page_token,
121
+ 'Page' => page_number,
122
+ 'PageSize' => page_size,
123
+ })
124
+
125
+ response = @version.page('GET', @uri, params: params)
126
+
127
+ RoomPage.new(@version, response, @solution)
128
+ end
129
+
130
+ ##
131
+ # Retrieve a single page of RoomInstance records from the API.
132
+ # Request is executed immediately.
133
+ # @param [String] target_url API-generated URL for the requested results page
134
+ # @return [Page] Page of RoomInstance
135
+ def get_page(target_url)
136
+ response = @version.domain.request(
137
+ 'GET',
138
+ target_url
139
+ )
140
+ RoomPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Provide a user friendly representation
145
+ def to_s
146
+ '#<Twilio.Insights.V1.RoomList>'
147
+ end
148
+ end
149
+
150
+ ##
151
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
152
+ class RoomPage < Page
153
+ ##
154
+ # Initialize the RoomPage
155
+ # @param [Version] version Version that contains the resource
156
+ # @param [Response] response Response from the API
157
+ # @param [Hash] solution Path solution for the resource
158
+ # @return [RoomPage] RoomPage
159
+ def initialize(version, response, solution)
160
+ super(version, response)
161
+
162
+ # Path Solution
163
+ @solution = solution
164
+ end
165
+
166
+ ##
167
+ # Build an instance of RoomInstance
168
+ # @param [Hash] payload Payload response from the API
169
+ # @return [RoomInstance] RoomInstance
170
+ def get_instance(payload)
171
+ RoomInstance.new(@version, payload, )
172
+ end
173
+
174
+ ##
175
+ # Provide a user friendly representation
176
+ def to_s
177
+ '<Twilio.Insights.V1.RoomPage>'
178
+ end
179
+ end
180
+
181
+ ##
182
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
183
+ class RoomContext < InstanceContext
184
+ ##
185
+ # Initialize the RoomContext
186
+ # @param [Version] version Version that contains the resource
187
+ # @param [String] room_sid The room_sid
188
+ # @return [RoomContext] RoomContext
189
+ def initialize(version, room_sid)
190
+ super(version)
191
+
192
+ # Path Solution
193
+ @solution = {room_sid: room_sid, }
194
+ @uri = "/Video/Rooms/#{@solution[:room_sid]}"
195
+
196
+ # Dependents
197
+ @participants = nil
198
+ end
199
+
200
+ ##
201
+ # Fetch the RoomInstance
202
+ # @return [RoomInstance] Fetched RoomInstance
203
+ def fetch
204
+ payload = @version.fetch('GET', @uri)
205
+
206
+ RoomInstance.new(@version, payload, room_sid: @solution[:room_sid], )
207
+ end
208
+
209
+ ##
210
+ # Access the participants
211
+ # @return [ParticipantList]
212
+ # @return [ParticipantContext] if participant_sid was passed.
213
+ def participants(participant_sid=:unset)
214
+ raise ArgumentError, 'participant_sid cannot be nil' if participant_sid.nil?
215
+
216
+ if participant_sid != :unset
217
+ return ParticipantContext.new(@version, @solution[:room_sid], participant_sid, )
218
+ end
219
+
220
+ unless @participants
221
+ @participants = ParticipantList.new(@version, room_sid: @solution[:room_sid], )
222
+ end
223
+
224
+ @participants
225
+ end
226
+
227
+ ##
228
+ # Provide a user friendly representation
229
+ def to_s
230
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231
+ "#<Twilio.Insights.V1.RoomContext #{context}>"
232
+ end
233
+
234
+ ##
235
+ # Provide a detailed, user friendly representation
236
+ def inspect
237
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
238
+ "#<Twilio.Insights.V1.RoomContext #{context}>"
239
+ end
240
+ end
241
+
242
+ ##
243
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
244
+ class RoomInstance < InstanceResource
245
+ ##
246
+ # Initialize the RoomInstance
247
+ # @param [Version] version Version that contains the resource
248
+ # @param [Hash] payload payload that contains response from Twilio
249
+ # @param [String] room_sid The room_sid
250
+ # @return [RoomInstance] RoomInstance
251
+ def initialize(version, payload, room_sid: nil)
252
+ super(version)
253
+
254
+ # Marshaled Properties
255
+ @properties = {
256
+ 'account_sid' => payload['account_sid'],
257
+ 'room_sid' => payload['room_sid'],
258
+ 'room_name' => payload['room_name'],
259
+ 'create_time' => Twilio.deserialize_iso8601_datetime(payload['create_time']),
260
+ 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
261
+ 'room_type' => payload['room_type'],
262
+ 'room_status' => payload['room_status'],
263
+ 'status_callback' => payload['status_callback'],
264
+ 'status_callback_method' => payload['status_callback_method'],
265
+ 'created_method' => payload['created_method'],
266
+ 'end_reason' => payload['end_reason'],
267
+ 'max_participants' => payload['max_participants'] == nil ? payload['max_participants'] : payload['max_participants'].to_i,
268
+ 'unique_participants' => payload['unique_participants'] == nil ? payload['unique_participants'] : payload['unique_participants'].to_i,
269
+ 'unique_participant_identities' => payload['unique_participant_identities'] == nil ? payload['unique_participant_identities'] : payload['unique_participant_identities'].to_i,
270
+ 'concurrent_participants' => payload['concurrent_participants'] == nil ? payload['concurrent_participants'] : payload['concurrent_participants'].to_i,
271
+ 'max_concurrent_participants' => payload['max_concurrent_participants'] == nil ? payload['max_concurrent_participants'] : payload['max_concurrent_participants'].to_i,
272
+ 'codecs' => payload['codecs'],
273
+ 'media_region' => payload['media_region'],
274
+ 'duration_sec' => payload['duration_sec'].to_i,
275
+ 'total_participant_duration_sec' => payload['total_participant_duration_sec'].to_i,
276
+ 'total_recording_duration_sec' => payload['total_recording_duration_sec'].to_i,
277
+ 'processing_state' => payload['processing_state'],
278
+ 'recording_enabled' => payload['recording_enabled'],
279
+ 'edge_location' => payload['edge_location'],
280
+ 'url' => payload['url'],
281
+ 'links' => payload['links'],
282
+ }
283
+
284
+ # Context
285
+ @instance_context = nil
286
+ @params = {'room_sid' => room_sid || @properties['room_sid'], }
287
+ end
288
+
289
+ ##
290
+ # Generate an instance context for the instance, the context is capable of
291
+ # performing various actions. All instance actions are proxied to the context
292
+ # @return [RoomContext] RoomContext for this RoomInstance
293
+ def context
294
+ unless @instance_context
295
+ @instance_context = RoomContext.new(@version, @params['room_sid'], )
296
+ end
297
+ @instance_context
298
+ end
299
+
300
+ ##
301
+ # @return [String] The account_sid
302
+ def account_sid
303
+ @properties['account_sid']
304
+ end
305
+
306
+ ##
307
+ # @return [String] The room_sid
308
+ def room_sid
309
+ @properties['room_sid']
310
+ end
311
+
312
+ ##
313
+ # @return [String] The room_name
314
+ def room_name
315
+ @properties['room_name']
316
+ end
317
+
318
+ ##
319
+ # @return [Time] The create_time
320
+ def create_time
321
+ @properties['create_time']
322
+ end
323
+
324
+ ##
325
+ # @return [Time] The end_time
326
+ def end_time
327
+ @properties['end_time']
328
+ end
329
+
330
+ ##
331
+ # @return [room.RoomType] The room_type
332
+ def room_type
333
+ @properties['room_type']
334
+ end
335
+
336
+ ##
337
+ # @return [room.RoomStatus] The room_status
338
+ def room_status
339
+ @properties['room_status']
340
+ end
341
+
342
+ ##
343
+ # @return [String] The status_callback
344
+ def status_callback
345
+ @properties['status_callback']
346
+ end
347
+
348
+ ##
349
+ # @return [String] The status_callback_method
350
+ def status_callback_method
351
+ @properties['status_callback_method']
352
+ end
353
+
354
+ ##
355
+ # @return [room.CreatedMethod] The created_method
356
+ def created_method
357
+ @properties['created_method']
358
+ end
359
+
360
+ ##
361
+ # @return [room.EndReason] The end_reason
362
+ def end_reason
363
+ @properties['end_reason']
364
+ end
365
+
366
+ ##
367
+ # @return [String] The max_participants
368
+ def max_participants
369
+ @properties['max_participants']
370
+ end
371
+
372
+ ##
373
+ # @return [String] The unique_participants
374
+ def unique_participants
375
+ @properties['unique_participants']
376
+ end
377
+
378
+ ##
379
+ # @return [String] The unique_participant_identities
380
+ def unique_participant_identities
381
+ @properties['unique_participant_identities']
382
+ end
383
+
384
+ ##
385
+ # @return [String] The concurrent_participants
386
+ def concurrent_participants
387
+ @properties['concurrent_participants']
388
+ end
389
+
390
+ ##
391
+ # @return [String] The max_concurrent_participants
392
+ def max_concurrent_participants
393
+ @properties['max_concurrent_participants']
394
+ end
395
+
396
+ ##
397
+ # @return [room.Codec] The codecs
398
+ def codecs
399
+ @properties['codecs']
400
+ end
401
+
402
+ ##
403
+ # @return [room.TwilioRealm] The media_region
404
+ def media_region
405
+ @properties['media_region']
406
+ end
407
+
408
+ ##
409
+ # @return [String] The duration_sec
410
+ def duration_sec
411
+ @properties['duration_sec']
412
+ end
413
+
414
+ ##
415
+ # @return [String] The total_participant_duration_sec
416
+ def total_participant_duration_sec
417
+ @properties['total_participant_duration_sec']
418
+ end
419
+
420
+ ##
421
+ # @return [String] The total_recording_duration_sec
422
+ def total_recording_duration_sec
423
+ @properties['total_recording_duration_sec']
424
+ end
425
+
426
+ ##
427
+ # @return [room.ProcessingState] The processing_state
428
+ def processing_state
429
+ @properties['processing_state']
430
+ end
431
+
432
+ ##
433
+ # @return [Boolean] The recording_enabled
434
+ def recording_enabled
435
+ @properties['recording_enabled']
436
+ end
437
+
438
+ ##
439
+ # @return [room.EdgeLocation] The edge_location
440
+ def edge_location
441
+ @properties['edge_location']
442
+ end
443
+
444
+ ##
445
+ # @return [String] The url
446
+ def url
447
+ @properties['url']
448
+ end
449
+
450
+ ##
451
+ # @return [String] The links
452
+ def links
453
+ @properties['links']
454
+ end
455
+
456
+ ##
457
+ # Fetch the RoomInstance
458
+ # @return [RoomInstance] Fetched RoomInstance
459
+ def fetch
460
+ context.fetch
461
+ end
462
+
463
+ ##
464
+ # Access the participants
465
+ # @return [participants] participants
466
+ def participants
467
+ context.participants
468
+ end
469
+
470
+ ##
471
+ # Provide a user friendly representation
472
+ def to_s
473
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
474
+ "<Twilio.Insights.V1.RoomInstance #{values}>"
475
+ end
476
+
477
+ ##
478
+ # Provide a detailed, user friendly representation
479
+ def inspect
480
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
481
+ "<Twilio.Insights.V1.RoomInstance #{values}>"
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end