voiceml 0.9.2 → 0.9.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -13
  3. data/lib/voiceml/client.rb +53 -13
  4. data/lib/voiceml/errors.rb +15 -2
  5. data/lib/voiceml/models/accounts.rb +47 -3
  6. data/lib/voiceml/models/applications.rb +6 -0
  7. data/lib/voiceml/models/assistants_v1.rb +40 -0
  8. data/lib/voiceml/models/calls.rb +4 -0
  9. data/lib/voiceml/models/common.rb +35 -4
  10. data/lib/voiceml/models/conferences.rb +8 -0
  11. data/lib/voiceml/models/conversations_v1.rb +131 -29
  12. data/lib/voiceml/models/diagnostics.rb +33 -12
  13. data/lib/voiceml/models/exports.rb +58 -0
  14. data/lib/voiceml/models/incoming_phone_numbers.rb +4 -0
  15. data/lib/voiceml/models/media.rb +4 -0
  16. data/lib/voiceml/models/messages.rb +29 -0
  17. data/lib/voiceml/models/messaging_v1.rb +35 -2
  18. data/lib/voiceml/models/monitor_v1.rb +54 -0
  19. data/lib/voiceml/models/notifications.rb +2 -0
  20. data/lib/voiceml/models/outgoing_caller_ids.rb +6 -0
  21. data/lib/voiceml/models/payments.rb +2 -0
  22. data/lib/voiceml/models/pricing.rb +38 -4
  23. data/lib/voiceml/models/queues.rb +8 -0
  24. data/lib/voiceml/models/recordings.rb +5 -1
  25. data/lib/voiceml/models/routes_v2.rb +6 -2
  26. data/lib/voiceml/models/sip.rb +34 -6
  27. data/lib/voiceml/models/sip_registrations.rb +49 -0
  28. data/lib/voiceml/models/siprec.rb +5 -17
  29. data/lib/voiceml/models/streams.rb +4 -16
  30. data/lib/voiceml/models/transcriptions.rb +35 -4
  31. data/lib/voiceml/models/usage_records.rb +48 -0
  32. data/lib/voiceml/models/user_defined_messages.rb +2 -0
  33. data/lib/voiceml/models/voice_v1.rb +29 -19
  34. data/lib/voiceml/request_validator.rb +125 -0
  35. data/lib/voiceml/resources/accounts.rb +75 -0
  36. data/lib/voiceml/resources/applications.rb +3 -1
  37. data/lib/voiceml/resources/assistants_v1.rb +53 -77
  38. data/lib/voiceml/resources/base.rb +138 -16
  39. data/lib/voiceml/resources/calls.rb +34 -49
  40. data/lib/voiceml/resources/conferences.rb +26 -5
  41. data/lib/voiceml/resources/conversations_v1.rb +147 -172
  42. data/lib/voiceml/resources/diagnostics.rb +20 -35
  43. data/lib/voiceml/resources/exports.rb +36 -0
  44. data/lib/voiceml/resources/incoming_phone_numbers.rb +53 -32
  45. data/lib/voiceml/resources/messages.rb +79 -15
  46. data/lib/voiceml/resources/messaging_v1.rb +47 -13
  47. data/lib/voiceml/resources/monitor_v1.rb +68 -0
  48. data/lib/voiceml/resources/notifications.rb +1 -1
  49. data/lib/voiceml/resources/outgoing_caller_ids.rb +77 -0
  50. data/lib/voiceml/resources/pricing.rb +13 -5
  51. data/lib/voiceml/resources/queues.rb +6 -5
  52. data/lib/voiceml/resources/recordings.rb +39 -5
  53. data/lib/voiceml/resources/routes_v2.rb +10 -4
  54. data/lib/voiceml/resources/sip.rb +30 -11
  55. data/lib/voiceml/resources/transcriptions.rb +40 -0
  56. data/lib/voiceml/resources/usage_records.rb +51 -0
  57. data/lib/voiceml/resources/voice_v1.rb +31 -38
  58. data/lib/voiceml/transport.rb +277 -230
  59. data/lib/voiceml/version.rb +1 -1
  60. data/lib/voiceml.rb +14 -15
  61. metadata +18 -6
@@ -17,21 +17,25 @@ module VoiceML
17
17
 
18
18
  # ConversationsV1Conversation — `CH...`.
19
19
  class ConversationsV1Conversation
20
+ include RawAttributes
20
21
  ATTRIBUTES = %w[
21
22
  account_sid chat_service_sid messaging_service_sid sid friendly_name
22
23
  unique_name attributes state date_created date_updated timers url links bindings
23
24
  ].freeze
24
25
  attr_reader(*ATTRIBUTES.map(&:to_sym))
25
26
  def initialize(attrs = {})
26
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
27
+ @raw_attributes = attrs
28
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
27
29
  end
28
30
  def self.from_hash(h); h.nil? ? nil : new(h); end
29
31
  end
30
32
 
31
33
  class ConversationsV1ConversationList
34
+ include RawAttributes
32
35
  include V1Pageable
33
36
  attr_reader :conversations
34
37
  def initialize(hash = {})
38
+ @raw_attributes = hash
35
39
  assign_meta_fields(hash)
36
40
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1Conversation.from_hash(h) }
37
41
  end
@@ -39,21 +43,25 @@ module VoiceML
39
43
 
40
44
  # ConversationsV1ConversationMessage — `IM...`.
41
45
  class ConversationsV1ConversationMessage
46
+ include RawAttributes
42
47
  ATTRIBUTES = %w[
43
48
  account_sid conversation_sid sid index author body media attributes
44
49
  participant_sid date_created date_updated url delivery links content_sid
45
50
  ].freeze
46
51
  attr_reader(*ATTRIBUTES.map(&:to_sym))
47
52
  def initialize(attrs = {})
48
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
53
+ @raw_attributes = attrs
54
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
49
55
  end
50
56
  def self.from_hash(h); h.nil? ? nil : new(h); end
51
57
  end
52
58
 
53
59
  class ConversationsV1ConversationMessageList
60
+ include RawAttributes
54
61
  include V1Pageable
55
62
  attr_reader :messages
56
63
  def initialize(hash = {})
64
+ @raw_attributes = hash
57
65
  assign_meta_fields(hash)
58
66
  @messages = (hash['messages'] || []).map { |h| ConversationsV1ConversationMessage.from_hash(h) }
59
67
  end
@@ -61,21 +69,25 @@ module VoiceML
61
69
 
62
70
  # ConversationsV1ConversationParticipant — `MB...`.
63
71
  class ConversationsV1ConversationParticipant
72
+ include RawAttributes
64
73
  ATTRIBUTES = %w[
65
74
  account_sid conversation_sid sid identity attributes messaging_binding
66
75
  role_sid date_created date_updated url last_read_message_index last_read_timestamp
67
76
  ].freeze
68
77
  attr_reader(*ATTRIBUTES.map(&:to_sym))
69
78
  def initialize(attrs = {})
70
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
79
+ @raw_attributes = attrs
80
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
71
81
  end
72
82
  def self.from_hash(h); h.nil? ? nil : new(h); end
73
83
  end
74
84
 
75
85
  class ConversationsV1ConversationParticipantList
86
+ include RawAttributes
76
87
  include V1Pageable
77
88
  attr_reader :participants
78
89
  def initialize(hash = {})
90
+ @raw_attributes = hash
79
91
  assign_meta_fields(hash)
80
92
  @participants = (hash['participants'] || []).map { |h| ConversationsV1ConversationParticipant.from_hash(h) }
81
93
  end
@@ -83,21 +95,25 @@ module VoiceML
83
95
 
84
96
  # ConversationsV1ConversationMessageReceipt — `DY...`.
85
97
  class ConversationsV1ConversationMessageReceipt
98
+ include RawAttributes
86
99
  ATTRIBUTES = %w[
87
100
  account_sid conversation_sid sid message_sid channel_message_sid
88
101
  participant_sid status error_code date_created date_updated url
89
102
  ].freeze
90
103
  attr_reader(*ATTRIBUTES.map(&:to_sym))
91
104
  def initialize(attrs = {})
92
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
105
+ @raw_attributes = attrs
106
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
93
107
  end
94
108
  def self.from_hash(h); h.nil? ? nil : new(h); end
95
109
  end
96
110
 
97
111
  class ConversationsV1ConversationMessageReceiptList
112
+ include RawAttributes
98
113
  include V1Pageable
99
114
  attr_reader :delivery_receipts
100
115
  def initialize(hash = {})
116
+ @raw_attributes = hash
101
117
  assign_meta_fields(hash)
102
118
  @delivery_receipts = (hash['delivery_receipts'] || []).map { |h| ConversationsV1ConversationMessageReceipt.from_hash(h) }
103
119
  end
@@ -105,20 +121,24 @@ module VoiceML
105
121
 
106
122
  # ConversationsV1ConversationScopedWebhook — `WH...`.
107
123
  class ConversationsV1ConversationScopedWebhook
124
+ include RawAttributes
108
125
  ATTRIBUTES = %w[
109
126
  sid account_sid conversation_sid target url configuration date_created date_updated
110
127
  ].freeze
111
128
  attr_reader(*ATTRIBUTES.map(&:to_sym))
112
129
  def initialize(attrs = {})
113
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
130
+ @raw_attributes = attrs
131
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
114
132
  end
115
133
  def self.from_hash(h); h.nil? ? nil : new(h); end
116
134
  end
117
135
 
118
136
  class ConversationsV1ConversationScopedWebhookList
137
+ include RawAttributes
119
138
  include V1Pageable
120
139
  attr_reader :webhooks
121
140
  def initialize(hash = {})
141
+ @raw_attributes = hash
122
142
  assign_meta_fields(hash)
123
143
  @webhooks = (hash['webhooks'] || []).map { |h| ConversationsV1ConversationScopedWebhook.from_hash(h) }
124
144
  end
@@ -126,21 +146,25 @@ module VoiceML
126
146
 
127
147
  # ConversationsV1Role — `RL...`.
128
148
  class ConversationsV1Role
149
+ include RawAttributes
129
150
  ATTRIBUTES = %w[
130
151
  sid account_sid chat_service_sid friendly_name type permissions
131
152
  date_created date_updated url
132
153
  ].freeze
133
154
  attr_reader(*ATTRIBUTES.map(&:to_sym))
134
155
  def initialize(attrs = {})
135
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
156
+ @raw_attributes = attrs
157
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
136
158
  end
137
159
  def self.from_hash(h); h.nil? ? nil : new(h); end
138
160
  end
139
161
 
140
162
  class ConversationsV1RoleList
163
+ include RawAttributes
141
164
  include V1Pageable
142
165
  attr_reader :roles
143
166
  def initialize(hash = {})
167
+ @raw_attributes = hash
144
168
  assign_meta_fields(hash)
145
169
  @roles = (hash['roles'] || []).map { |h| ConversationsV1Role.from_hash(h) }
146
170
  end
@@ -148,21 +172,25 @@ module VoiceML
148
172
 
149
173
  # ConversationsV1User — `US...`.
150
174
  class ConversationsV1User
175
+ include RawAttributes
151
176
  ATTRIBUTES = %w[
152
177
  sid account_sid chat_service_sid role_sid identity friendly_name attributes
153
178
  is_online is_notifiable date_created date_updated url links
154
179
  ].freeze
155
180
  attr_reader(*ATTRIBUTES.map(&:to_sym))
156
181
  def initialize(attrs = {})
157
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
182
+ @raw_attributes = attrs
183
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
158
184
  end
159
185
  def self.from_hash(h); h.nil? ? nil : new(h); end
160
186
  end
161
187
 
162
188
  class ConversationsV1UserList
189
+ include RawAttributes
163
190
  include V1Pageable
164
191
  attr_reader :users
165
192
  def initialize(hash = {})
193
+ @raw_attributes = hash
166
194
  assign_meta_fields(hash)
167
195
  @users = (hash['users'] || []).map { |h| ConversationsV1User.from_hash(h) }
168
196
  end
@@ -170,20 +198,24 @@ module VoiceML
170
198
 
171
199
  # ConversationsV1Credential — `CR...` (push Credential — distinct from SipCredential).
172
200
  class ConversationsV1Credential
201
+ include RawAttributes
173
202
  ATTRIBUTES = %w[
174
203
  sid account_sid friendly_name type sandbox date_created date_updated url
175
204
  ].freeze
176
205
  attr_reader(*ATTRIBUTES.map(&:to_sym))
177
206
  def initialize(attrs = {})
178
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
207
+ @raw_attributes = attrs
208
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
179
209
  end
180
210
  def self.from_hash(h); h.nil? ? nil : new(h); end
181
211
  end
182
212
 
183
213
  class ConversationsV1CredentialList
214
+ include RawAttributes
184
215
  include V1Pageable
185
216
  attr_reader :credentials
186
217
  def initialize(hash = {})
218
+ @raw_attributes = hash
187
219
  assign_meta_fields(hash)
188
220
  @credentials = (hash['credentials'] || []).map { |h| ConversationsV1Credential.from_hash(h) }
189
221
  end
@@ -191,46 +223,54 @@ module VoiceML
191
223
 
192
224
  # ConversationsV1Configuration — account-level Conversations defaults.
193
225
  class ConversationsV1Configuration
226
+ include RawAttributes
194
227
  ATTRIBUTES = %w[
195
228
  account_sid default_chat_service_sid default_messaging_service_sid
196
229
  default_inactive_timer default_closed_timer url links
197
230
  ].freeze
198
231
  attr_reader(*ATTRIBUTES.map(&:to_sym))
199
232
  def initialize(attrs = {})
200
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
233
+ @raw_attributes = attrs
234
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
201
235
  end
202
236
  def self.from_hash(h); h.nil? ? nil : new(h); end
203
237
  end
204
238
 
205
239
  # ConversationsV1ConfigurationWebhook — account-global webhook config.
206
240
  class ConversationsV1ConfigurationWebhook
241
+ include RawAttributes
207
242
  ATTRIBUTES = %w[
208
243
  account_sid method filters pre_webhook_url post_webhook_url target url
209
244
  ].freeze
210
245
  attr_reader(*ATTRIBUTES.map(&:to_sym))
211
246
  def initialize(attrs = {})
212
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
247
+ @raw_attributes = attrs
248
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
213
249
  end
214
250
  def self.from_hash(h); h.nil? ? nil : new(h); end
215
251
  end
216
252
 
217
253
  # ConversationsV1ConfigAddress — `IG...`.
218
254
  class ConversationsV1ConfigAddress
255
+ include RawAttributes
219
256
  ATTRIBUTES = %w[
220
257
  sid account_sid type address friendly_name auto_creation
221
258
  date_created date_updated url address_country
222
259
  ].freeze
223
260
  attr_reader(*ATTRIBUTES.map(&:to_sym))
224
261
  def initialize(attrs = {})
225
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
262
+ @raw_attributes = attrs
263
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
226
264
  end
227
265
  def self.from_hash(h); h.nil? ? nil : new(h); end
228
266
  end
229
267
 
230
268
  class ConversationsV1ConfigAddressList
269
+ include RawAttributes
231
270
  include V1Pageable
232
271
  attr_reader :addresses
233
272
  def initialize(hash = {})
273
+ @raw_attributes = hash
234
274
  assign_meta_fields(hash)
235
275
  @addresses = (hash['addresses'] || []).map { |h| ConversationsV1ConfigAddress.from_hash(h) }
236
276
  end
@@ -238,6 +278,7 @@ module VoiceML
238
278
 
239
279
  # ConversationsV1ParticipantConversation — read-only join of Participant + Conversation.
240
280
  class ConversationsV1ParticipantConversation
281
+ include RawAttributes
241
282
  ATTRIBUTES = %w[
242
283
  account_sid chat_service_sid participant_sid participant_user_sid
243
284
  participant_identity participant_messaging_binding conversation_sid
@@ -247,15 +288,18 @@ module VoiceML
247
288
  ].freeze
248
289
  attr_reader(*ATTRIBUTES.map(&:to_sym))
249
290
  def initialize(attrs = {})
250
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
291
+ @raw_attributes = attrs
292
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
251
293
  end
252
294
  def self.from_hash(h); h.nil? ? nil : new(h); end
253
295
  end
254
296
 
255
297
  class ConversationsV1ParticipantConversationList
298
+ include RawAttributes
256
299
  include V1Pageable
257
300
  attr_reader :conversations
258
301
  def initialize(hash = {})
302
+ @raw_attributes = hash
259
303
  assign_meta_fields(hash)
260
304
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1ParticipantConversation.from_hash(h) }
261
305
  end
@@ -264,19 +308,22 @@ module VoiceML
264
308
  # ConversationsV1ConversationWithParticipants — single-call conversation + initial participants.
265
309
  # Returned by POST /v1/ConversationWithParticipants; field-identical to ConversationsV1Conversation.
266
310
  class ConversationsV1ConversationWithParticipants
311
+ include RawAttributes
267
312
  ATTRIBUTES = %w[
268
313
  account_sid chat_service_sid messaging_service_sid sid friendly_name
269
314
  unique_name attributes state date_created date_updated timers links bindings url
270
315
  ].freeze
271
316
  attr_reader(*ATTRIBUTES.map(&:to_sym))
272
317
  def initialize(attrs = {})
273
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
318
+ @raw_attributes = attrs
319
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
274
320
  end
275
321
  def self.from_hash(h); h.nil? ? nil : new(h); end
276
322
  end
277
323
 
278
324
  # ConversationsV1UserConversation — a user's view of a conversation they belong to.
279
325
  class ConversationsV1UserConversation
326
+ include RawAttributes
280
327
  ATTRIBUTES = %w[
281
328
  account_sid chat_service_sid conversation_sid unread_messages_count
282
329
  last_read_message_index participant_sid user_sid friendly_name conversation_state
@@ -285,15 +332,18 @@ module VoiceML
285
332
  ].freeze
286
333
  attr_reader(*ATTRIBUTES.map(&:to_sym))
287
334
  def initialize(attrs = {})
288
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
335
+ @raw_attributes = attrs
336
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
289
337
  end
290
338
  def self.from_hash(h); h.nil? ? nil : new(h); end
291
339
  end
292
340
 
293
341
  class ConversationsV1UserConversationList
342
+ include RawAttributes
294
343
  include V1Pageable
295
344
  attr_reader :conversations
296
345
  def initialize(hash = {})
346
+ @raw_attributes = hash
297
347
  assign_meta_fields(hash)
298
348
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1UserConversation.from_hash(h) }
299
349
  end
@@ -301,20 +351,24 @@ module VoiceML
301
351
 
302
352
  # ConversationsV1Service — `IS...`. Conversation service.
303
353
  class ConversationsV1Service
354
+ include RawAttributes
304
355
  ATTRIBUTES = %w[
305
356
  sid account_sid friendly_name date_created date_updated url links
306
357
  ].freeze
307
358
  attr_reader(*ATTRIBUTES.map(&:to_sym))
308
359
  def initialize(attrs = {})
309
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
360
+ @raw_attributes = attrs
361
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
310
362
  end
311
363
  def self.from_hash(h); h.nil? ? nil : new(h); end
312
364
  end
313
365
 
314
366
  class ConversationsV1ServiceList
367
+ include RawAttributes
315
368
  include V1Pageable
316
369
  attr_reader :services
317
370
  def initialize(hash = {})
371
+ @raw_attributes = hash
318
372
  assign_meta_fields(hash)
319
373
  @services = (hash['services'] || []).map { |h| ConversationsV1Service.from_hash(h) }
320
374
  end
@@ -323,21 +377,25 @@ module VoiceML
323
377
  # ConversationsV1ServiceConversation — service-scoped Conversation; field-identical to
324
378
  # ConversationsV1Conversation. Twilio's service_conversation mirrors conversation.
325
379
  class ConversationsV1ServiceConversation
380
+ include RawAttributes
326
381
  ATTRIBUTES = %w[
327
382
  account_sid chat_service_sid messaging_service_sid sid friendly_name
328
383
  unique_name attributes state date_created date_updated timers url links bindings
329
384
  ].freeze
330
385
  attr_reader(*ATTRIBUTES.map(&:to_sym))
331
386
  def initialize(attrs = {})
332
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
387
+ @raw_attributes = attrs
388
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
333
389
  end
334
390
  def self.from_hash(h); h.nil? ? nil : new(h); end
335
391
  end
336
392
 
337
393
  class ConversationsV1ServiceConversationList
394
+ include RawAttributes
338
395
  include V1Pageable
339
396
  attr_reader :conversations
340
397
  def initialize(hash = {})
398
+ @raw_attributes = hash
341
399
  assign_meta_fields(hash)
342
400
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1ServiceConversation.from_hash(h) }
343
401
  end
@@ -351,21 +409,25 @@ module VoiceML
351
409
 
352
410
  # ConversationsV1ServiceConversationMessage — `IM...`, scoped to a Service.
353
411
  class ConversationsV1ServiceConversationMessage
412
+ include RawAttributes
354
413
  ATTRIBUTES = %w[
355
414
  account_sid chat_service_sid conversation_sid sid index author body media
356
415
  attributes participant_sid date_created date_updated url delivery links content_sid
357
416
  ].freeze
358
417
  attr_reader(*ATTRIBUTES.map(&:to_sym))
359
418
  def initialize(attrs = {})
360
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
419
+ @raw_attributes = attrs
420
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
361
421
  end
362
422
  def self.from_hash(h); h.nil? ? nil : new(h); end
363
423
  end
364
424
 
365
425
  class ConversationsV1ServiceConversationMessageList
426
+ include RawAttributes
366
427
  include V1Pageable
367
428
  attr_reader :messages
368
429
  def initialize(hash = {})
430
+ @raw_attributes = hash
369
431
  assign_meta_fields(hash)
370
432
  @messages = (hash['messages'] || []).map { |h| ConversationsV1ServiceConversationMessage.from_hash(h) }
371
433
  end
@@ -373,6 +435,7 @@ module VoiceML
373
435
 
374
436
  # ConversationsV1ServiceConversationParticipant — `MB...`, scoped to a Service.
375
437
  class ConversationsV1ServiceConversationParticipant
438
+ include RawAttributes
376
439
  ATTRIBUTES = %w[
377
440
  account_sid chat_service_sid conversation_sid sid identity attributes
378
441
  messaging_binding role_sid date_created date_updated url
@@ -380,15 +443,18 @@ module VoiceML
380
443
  ].freeze
381
444
  attr_reader(*ATTRIBUTES.map(&:to_sym))
382
445
  def initialize(attrs = {})
383
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
446
+ @raw_attributes = attrs
447
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
384
448
  end
385
449
  def self.from_hash(h); h.nil? ? nil : new(h); end
386
450
  end
387
451
 
388
452
  class ConversationsV1ServiceConversationParticipantList
453
+ include RawAttributes
389
454
  include V1Pageable
390
455
  attr_reader :participants
391
456
  def initialize(hash = {})
457
+ @raw_attributes = hash
392
458
  assign_meta_fields(hash)
393
459
  @participants = (hash['participants'] || []).map { |h| ConversationsV1ServiceConversationParticipant.from_hash(h) }
394
460
  end
@@ -396,6 +462,7 @@ module VoiceML
396
462
 
397
463
  # ConversationsV1ServiceConversationMessageReceipt — `DY...`, scoped to a Service.
398
464
  class ConversationsV1ServiceConversationMessageReceipt
465
+ include RawAttributes
399
466
  ATTRIBUTES = %w[
400
467
  account_sid chat_service_sid conversation_sid sid message_sid
401
468
  channel_message_sid participant_sid status error_code
@@ -403,15 +470,18 @@ module VoiceML
403
470
  ].freeze
404
471
  attr_reader(*ATTRIBUTES.map(&:to_sym))
405
472
  def initialize(attrs = {})
406
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
473
+ @raw_attributes = attrs
474
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
407
475
  end
408
476
  def self.from_hash(h); h.nil? ? nil : new(h); end
409
477
  end
410
478
 
411
479
  class ConversationsV1ServiceConversationMessageReceiptList
480
+ include RawAttributes
412
481
  include V1Pageable
413
482
  attr_reader :delivery_receipts
414
483
  def initialize(hash = {})
484
+ @raw_attributes = hash
415
485
  assign_meta_fields(hash)
416
486
  @delivery_receipts = (hash['delivery_receipts'] || []).map { |h| ConversationsV1ServiceConversationMessageReceipt.from_hash(h) }
417
487
  end
@@ -419,21 +489,25 @@ module VoiceML
419
489
 
420
490
  # ConversationsV1ServiceConversationScopedWebhook — `WH...`, scoped to a Service.
421
491
  class ConversationsV1ServiceConversationScopedWebhook
492
+ include RawAttributes
422
493
  ATTRIBUTES = %w[
423
494
  sid account_sid chat_service_sid conversation_sid target url configuration
424
495
  date_created date_updated
425
496
  ].freeze
426
497
  attr_reader(*ATTRIBUTES.map(&:to_sym))
427
498
  def initialize(attrs = {})
428
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
499
+ @raw_attributes = attrs
500
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
429
501
  end
430
502
  def self.from_hash(h); h.nil? ? nil : new(h); end
431
503
  end
432
504
 
433
505
  class ConversationsV1ServiceConversationScopedWebhookList
506
+ include RawAttributes
434
507
  include V1Pageable
435
508
  attr_reader :webhooks
436
509
  def initialize(hash = {})
510
+ @raw_attributes = hash
437
511
  assign_meta_fields(hash)
438
512
  @webhooks = (hash['webhooks'] || []).map { |h| ConversationsV1ServiceConversationScopedWebhook.from_hash(h) }
439
513
  end
@@ -442,19 +516,22 @@ module VoiceML
442
516
  # ConversationsV1ServiceConversationWithParticipants — service-scoped
443
517
  # single-call conv + participants; field-identical to ServiceConversation.
444
518
  class ConversationsV1ServiceConversationWithParticipants
519
+ include RawAttributes
445
520
  ATTRIBUTES = %w[
446
521
  account_sid chat_service_sid messaging_service_sid sid friendly_name
447
522
  unique_name attributes state date_created date_updated timers links bindings url
448
523
  ].freeze
449
524
  attr_reader(*ATTRIBUTES.map(&:to_sym))
450
525
  def initialize(attrs = {})
451
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
526
+ @raw_attributes = attrs
527
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
452
528
  end
453
529
  def self.from_hash(h); h.nil? ? nil : new(h); end
454
530
  end
455
531
 
456
532
  # ConversationsV1ServiceParticipantConversation — read-only join, service-scoped.
457
533
  class ConversationsV1ServiceParticipantConversation
534
+ include RawAttributes
458
535
  ATTRIBUTES = %w[
459
536
  account_sid chat_service_sid participant_sid participant_user_sid
460
537
  participant_identity participant_messaging_binding conversation_sid
@@ -464,15 +541,18 @@ module VoiceML
464
541
  ].freeze
465
542
  attr_reader(*ATTRIBUTES.map(&:to_sym))
466
543
  def initialize(attrs = {})
467
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
544
+ @raw_attributes = attrs
545
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
468
546
  end
469
547
  def self.from_hash(h); h.nil? ? nil : new(h); end
470
548
  end
471
549
 
472
550
  class ConversationsV1ServiceParticipantConversationList
551
+ include RawAttributes
473
552
  include V1Pageable
474
553
  attr_reader :conversations
475
554
  def initialize(hash = {})
555
+ @raw_attributes = hash
476
556
  assign_meta_fields(hash)
477
557
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1ServiceParticipantConversation.from_hash(h) }
478
558
  end
@@ -480,6 +560,7 @@ module VoiceML
480
560
 
481
561
  # ConversationsV1ServiceUserConversation — a user's view of a service-scoped conversation.
482
562
  class ConversationsV1ServiceUserConversation
563
+ include RawAttributes
483
564
  ATTRIBUTES = %w[
484
565
  account_sid chat_service_sid conversation_sid unread_messages_count
485
566
  last_read_message_index participant_sid user_sid friendly_name
@@ -488,15 +569,18 @@ module VoiceML
488
569
  ].freeze
489
570
  attr_reader(*ATTRIBUTES.map(&:to_sym))
490
571
  def initialize(attrs = {})
491
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
572
+ @raw_attributes = attrs
573
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
492
574
  end
493
575
  def self.from_hash(h); h.nil? ? nil : new(h); end
494
576
  end
495
577
 
496
578
  class ConversationsV1ServiceUserConversationList
579
+ include RawAttributes
497
580
  include V1Pageable
498
581
  attr_reader :conversations
499
582
  def initialize(hash = {})
583
+ @raw_attributes = hash
500
584
  assign_meta_fields(hash)
501
585
  @conversations = (hash['conversations'] || []).map { |h| ConversationsV1ServiceUserConversation.from_hash(h) }
502
586
  end
@@ -504,21 +588,25 @@ module VoiceML
504
588
 
505
589
  # ConversationsV1ServiceRole — `RL...`, scoped to a Service.
506
590
  class ConversationsV1ServiceRole
591
+ include RawAttributes
507
592
  ATTRIBUTES = %w[
508
593
  sid account_sid chat_service_sid friendly_name type permissions
509
594
  date_created date_updated url
510
595
  ].freeze
511
596
  attr_reader(*ATTRIBUTES.map(&:to_sym))
512
597
  def initialize(attrs = {})
513
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
598
+ @raw_attributes = attrs
599
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
514
600
  end
515
601
  def self.from_hash(h); h.nil? ? nil : new(h); end
516
602
  end
517
603
 
518
604
  class ConversationsV1ServiceRoleList
605
+ include RawAttributes
519
606
  include V1Pageable
520
607
  attr_reader :roles
521
608
  def initialize(hash = {})
609
+ @raw_attributes = hash
522
610
  assign_meta_fields(hash)
523
611
  @roles = (hash['roles'] || []).map { |h| ConversationsV1ServiceRole.from_hash(h) }
524
612
  end
@@ -526,21 +614,25 @@ module VoiceML
526
614
 
527
615
  # ConversationsV1ServiceUser — `US...`, scoped to a Service.
528
616
  class ConversationsV1ServiceUser
617
+ include RawAttributes
529
618
  ATTRIBUTES = %w[
530
619
  sid account_sid chat_service_sid role_sid identity friendly_name attributes
531
620
  is_online is_notifiable date_created date_updated url links
532
621
  ].freeze
533
622
  attr_reader(*ATTRIBUTES.map(&:to_sym))
534
623
  def initialize(attrs = {})
535
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
624
+ @raw_attributes = attrs
625
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
536
626
  end
537
627
  def self.from_hash(h); h.nil? ? nil : new(h); end
538
628
  end
539
629
 
540
630
  class ConversationsV1ServiceUserList
631
+ include RawAttributes
541
632
  include V1Pageable
542
633
  attr_reader :users
543
634
  def initialize(hash = {})
635
+ @raw_attributes = hash
544
636
  assign_meta_fields(hash)
545
637
  @users = (hash['users'] || []).map { |h| ConversationsV1ServiceUser.from_hash(h) }
546
638
  end
@@ -548,21 +640,25 @@ module VoiceML
548
640
 
549
641
  # ConversationsV1ServiceBinding — `BS...`, push-notification binding (read/delete only).
550
642
  class ConversationsV1ServiceBinding
643
+ include RawAttributes
551
644
  ATTRIBUTES = %w[
552
645
  sid account_sid chat_service_sid credential_sid date_created date_updated
553
646
  endpoint identity binding_type message_types url
554
647
  ].freeze
555
648
  attr_reader(*ATTRIBUTES.map(&:to_sym))
556
649
  def initialize(attrs = {})
557
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
650
+ @raw_attributes = attrs
651
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
558
652
  end
559
653
  def self.from_hash(h); h.nil? ? nil : new(h); end
560
654
  end
561
655
 
562
656
  class ConversationsV1ServiceBindingList
657
+ include RawAttributes
563
658
  include V1Pageable
564
659
  attr_reader :bindings
565
660
  def initialize(hash = {})
661
+ @raw_attributes = hash
566
662
  assign_meta_fields(hash)
567
663
  @bindings = (hash['bindings'] || []).map { |h| ConversationsV1ServiceBinding.from_hash(h) }
568
664
  end
@@ -570,6 +666,7 @@ module VoiceML
570
666
 
571
667
  # ConversationsV1ServiceConfiguration — per-service singleton (fetch+update).
572
668
  class ConversationsV1ServiceConfiguration
669
+ include RawAttributes
573
670
  ATTRIBUTES = %w[
574
671
  chat_service_sid default_conversation_creator_role_sid
575
672
  default_conversation_role_sid default_chat_service_role_sid
@@ -577,33 +674,38 @@ module VoiceML
577
674
  ].freeze
578
675
  attr_reader(*ATTRIBUTES.map(&:to_sym))
579
676
  def initialize(attrs = {})
580
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
677
+ @raw_attributes = attrs
678
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
581
679
  end
582
680
  def self.from_hash(h); h.nil? ? nil : new(h); end
583
681
  end
584
682
 
585
683
  # ConversationsV1ServiceNotification — per-service push-notification config singleton.
586
684
  class ConversationsV1ServiceNotification
685
+ include RawAttributes
587
686
  ATTRIBUTES = %w[
588
687
  account_sid chat_service_sid new_message added_to_conversation
589
688
  removed_from_conversation log_enabled url
590
689
  ].freeze
591
690
  attr_reader(*ATTRIBUTES.map(&:to_sym))
592
691
  def initialize(attrs = {})
593
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
692
+ @raw_attributes = attrs
693
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
594
694
  end
595
695
  def self.from_hash(h); h.nil? ? nil : new(h); end
596
696
  end
597
697
 
598
698
  # ConversationsV1ServiceWebhookConfiguration — per-service webhook config singleton.
599
699
  class ConversationsV1ServiceWebhookConfiguration
700
+ include RawAttributes
600
701
  ATTRIBUTES = %w[
601
702
  account_sid chat_service_sid pre_webhook_url post_webhook_url
602
703
  filters method url
603
704
  ].freeze
604
705
  attr_reader(*ATTRIBUTES.map(&:to_sym))
605
706
  def initialize(attrs = {})
606
- ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs[f] || attrs[f.to_sym]) }
707
+ @raw_attributes = attrs
708
+ ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
607
709
  end
608
710
  def self.from_hash(h); h.nil? ? nil : new(h); end
609
711
  end