twilio-ruby 5.39.1 → 5.40.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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +101 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/Makefile +1 -1
  7. data/PULL_REQUEST_TEMPLATE.md +1 -1
  8. data/README.md +4 -3
  9. data/lib/twilio-ruby/framework/version.rb +2 -7
  10. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +3 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +79 -60
  13. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  14. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  15. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  16. data/lib/twilio-ruby/rest/client.rb +7 -0
  17. data/lib/twilio-ruby/rest/conversations.rb +52 -0
  18. data/lib/twilio-ruby/rest/conversations/v1.rb +88 -1
  19. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +258 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +15 -4
  21. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +19 -10
  22. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +12 -2
  23. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  24. data/lib/twilio-ruby/rest/conversations/v1/notification.rb +310 -0
  25. data/lib/twilio-ruby/rest/conversations/v1/role.rb +372 -0
  26. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  27. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +385 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +259 -0
  29. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  30. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +546 -0
  31. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +388 -0
  32. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +513 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +454 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +393 -0
  35. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  36. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  37. data/lib/twilio-ruby/rest/events.rb +63 -0
  38. data/lib/twilio-ruby/rest/events/v1.rb +74 -0
  39. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  40. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  41. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  42. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  43. data/lib/twilio-ruby/rest/events/v1/subscription.rb +363 -0
  44. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +322 -0
  45. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  46. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  47. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  48. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  49. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  50. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  51. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  52. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  53. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  54. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  55. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  56. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  57. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  58. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  59. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  60. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  62. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  63. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  64. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +39 -9
  65. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  66. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  67. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +25 -3
  68. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  69. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  70. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -1
  71. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  72. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  73. data/lib/twilio-ruby/version.rb +1 -1
  74. data/spec/framework/version_spec.rb +42 -0
  75. data/spec/holodeck/holodeck.rb +3 -3
  76. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  77. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  78. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  79. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  80. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  81. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  82. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  83. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  84. data/spec/integration/conversations/v1/configuration_spec.rb +85 -0
  85. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  86. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  87. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  88. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  89. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  90. data/spec/integration/conversations/v1/notification_spec.rb +107 -0
  91. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  92. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  93. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  94. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  95. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  96. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  97. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  98. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  99. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  100. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  101. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  102. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  103. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  104. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  105. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  106. data/spec/integration/events/v1/sink_spec.rb +217 -0
  107. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +212 -0
  108. data/spec/integration/events/v1/subscription_spec.rb +205 -0
  109. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  110. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  111. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  112. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  113. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  114. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  115. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  116. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  117. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  118. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  119. data/spec/integration/video/v1/room_spec.rb +37 -0
  120. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  121. data/spec/spec_helper.rb +1 -1
  122. metadata +70 -2
@@ -322,6 +322,7 @@ module Twilio
322
322
  'status_callback_method' => payload['status_callback_method'],
323
323
  'trunk_sid' => payload['trunk_sid'],
324
324
  'uri' => payload['uri'],
325
+ 'voice_receive_mode' => payload['voice_receive_mode'],
325
326
  'voice_application_sid' => payload['voice_application_sid'],
326
327
  'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
327
328
  'voice_fallback_method' => payload['voice_fallback_method'],
@@ -331,6 +332,7 @@ module Twilio
331
332
  'emergency_status' => payload['emergency_status'],
332
333
  'emergency_address_sid' => payload['emergency_address_sid'],
333
334
  'bundle_sid' => payload['bundle_sid'],
335
+ 'status' => payload['status'],
334
336
  }
335
337
  end
336
338
 
@@ -466,6 +468,12 @@ module Twilio
466
468
  @properties['uri']
467
469
  end
468
470
 
471
+ ##
472
+ # @return [local.VoiceReceiveMode] The voice_receive_mode
473
+ def voice_receive_mode
474
+ @properties['voice_receive_mode']
475
+ end
476
+
469
477
  ##
470
478
  # @return [String] The SID of the application that handles calls to the phone number
471
479
  def voice_application_sid
@@ -520,6 +528,12 @@ module Twilio
520
528
  @properties['bundle_sid']
521
529
  end
522
530
 
531
+ ##
532
+ # @return [String] The status
533
+ def status
534
+ @properties['status']
535
+ end
536
+
523
537
  ##
524
538
  # Provide a user friendly representation
525
539
  def to_s
@@ -321,6 +321,7 @@ module Twilio
321
321
  'status_callback_method' => payload['status_callback_method'],
322
322
  'trunk_sid' => payload['trunk_sid'],
323
323
  'uri' => payload['uri'],
324
+ 'voice_receive_mode' => payload['voice_receive_mode'],
324
325
  'voice_application_sid' => payload['voice_application_sid'],
325
326
  'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
326
327
  'voice_fallback_method' => payload['voice_fallback_method'],
@@ -330,6 +331,7 @@ module Twilio
330
331
  'emergency_status' => payload['emergency_status'],
331
332
  'emergency_address_sid' => payload['emergency_address_sid'],
332
333
  'bundle_sid' => payload['bundle_sid'],
334
+ 'status' => payload['status'],
333
335
  }
334
336
  end
335
337
 
@@ -465,6 +467,12 @@ module Twilio
465
467
  @properties['uri']
466
468
  end
467
469
 
470
+ ##
471
+ # @return [mobile.VoiceReceiveMode] The voice_receive_mode
472
+ def voice_receive_mode
473
+ @properties['voice_receive_mode']
474
+ end
475
+
468
476
  ##
469
477
  # @return [String] The SID of the application that handles calls to the phone number
470
478
  def voice_application_sid
@@ -519,6 +527,12 @@ module Twilio
519
527
  @properties['bundle_sid']
520
528
  end
521
529
 
530
+ ##
531
+ # @return [String] The status
532
+ def status
533
+ @properties['status']
534
+ end
535
+
522
536
  ##
523
537
  # Provide a user friendly representation
524
538
  def to_s
@@ -321,6 +321,7 @@ module Twilio
321
321
  'status_callback_method' => payload['status_callback_method'],
322
322
  'trunk_sid' => payload['trunk_sid'],
323
323
  'uri' => payload['uri'],
324
+ 'voice_receive_mode' => payload['voice_receive_mode'],
324
325
  'voice_application_sid' => payload['voice_application_sid'],
325
326
  'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
326
327
  'voice_fallback_method' => payload['voice_fallback_method'],
@@ -330,6 +331,7 @@ module Twilio
330
331
  'emergency_status' => payload['emergency_status'],
331
332
  'emergency_address_sid' => payload['emergency_address_sid'],
332
333
  'bundle_sid' => payload['bundle_sid'],
334
+ 'status' => payload['status'],
333
335
  }
334
336
  end
335
337
 
@@ -465,6 +467,12 @@ module Twilio
465
467
  @properties['uri']
466
468
  end
467
469
 
470
+ ##
471
+ # @return [toll_free.VoiceReceiveMode] The voice_receive_mode
472
+ def voice_receive_mode
473
+ @properties['voice_receive_mode']
474
+ end
475
+
468
476
  ##
469
477
  # @return [String] The SID of the application that handles calls to the phone number
470
478
  def voice_application_sid
@@ -519,6 +527,12 @@ module Twilio
519
527
  @properties['bundle_sid']
520
528
  end
521
529
 
530
+ ##
531
+ # @return [String] The status
532
+ def status
533
+ @properties['status']
534
+ end
535
+
522
536
  ##
523
537
  # Provide a user friendly representation
524
538
  def to_s
@@ -33,6 +33,7 @@ module Twilio
33
33
  @autopilot = nil
34
34
  @chat = nil
35
35
  @conversations = nil
36
+ @events = nil
36
37
  @fax = nil
37
38
  @flex_api = nil
38
39
  @insights = nil
@@ -160,6 +161,12 @@ module Twilio
160
161
  @conversations ||= Conversations.new self
161
162
  end
162
163
 
164
+ ##
165
+ # Access the Events Twilio Domain
166
+ def events
167
+ @events ||= Events.new self
168
+ end
169
+
163
170
  ##
164
171
  # Access the Fax Twilio Domain
165
172
  def fax
@@ -28,6 +28,12 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
+ ##
32
+ # @return [Twilio::REST::Conversations::V1::ConfigurationInstance]
33
+ def configuration
34
+ self.v1.configuration()
35
+ end
36
+
31
37
  ##
32
38
  # @param [String] sid A 34 character string that uniquely identifies this
33
39
  # resource.
@@ -43,6 +49,52 @@ module Twilio
43
49
  self.v1.webhooks()
44
50
  end
45
51
 
52
+ ##
53
+ # @param [String] sid A 34 character string that uniquely identifies this
54
+ # resource.
55
+ # @return [Twilio::REST::Conversations::V1::CredentialInstance] if sid was passed.
56
+ # @return [Twilio::REST::Conversations::V1::CredentialList]
57
+ def credentials(sid=:unset)
58
+ self.v1.credentials(sid)
59
+ end
60
+
61
+ ##
62
+ # @param [String] sid The unique string that we created to identify the Role
63
+ # resource.
64
+ # @return [Twilio::REST::Conversations::V1::RoleInstance] if sid was passed.
65
+ # @return [Twilio::REST::Conversations::V1::RoleList]
66
+ def roles(sid=:unset)
67
+ self.v1.roles(sid)
68
+ end
69
+
70
+ ##
71
+ # @param [String] sid A 34 character string that uniquely identifies this
72
+ # resource.
73
+ # @return [Twilio::REST::Conversations::V1::ServiceInstance] if sid was passed.
74
+ # @return [Twilio::REST::Conversations::V1::ServiceList]
75
+ def services(sid=:unset)
76
+ self.v1.services(sid)
77
+ end
78
+
79
+ ##
80
+ # @param [String] chat_service_sid The SID of the [Chat
81
+ # Service](https://www.twilio.com/docs/chat/rest/service-resource) the
82
+ # Configuration applies to.
83
+ # @return [Twilio::REST::Conversations::V1::NotificationInstance] if chat_service_sid was passed.
84
+ # @return [Twilio::REST::Conversations::V1::NotificationList]
85
+ def notifications(chat_service_sid=:unset)
86
+ self.v1.notifications(chat_service_sid)
87
+ end
88
+
89
+ ##
90
+ # @param [String] sid The unique string that we created to identify the User
91
+ # resource.
92
+ # @return [Twilio::REST::Conversations::V1::UserInstance] if sid was passed.
93
+ # @return [Twilio::REST::Conversations::V1::UserList]
94
+ def users(sid=:unset)
95
+ self.v1.users(sid)
96
+ end
97
+
46
98
  ##
47
99
  # Provide a user friendly representation
48
100
  def to_s
@@ -15,13 +15,25 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
+ @configuration = nil
18
19
  @conversations = nil
19
20
  @webhooks = nil
21
+ @credentials = nil
22
+ @roles = nil
23
+ @services = nil
24
+ @notifications = nil
25
+ @users = nil
26
+ end
27
+
28
+ ##
29
+ # @return [Twilio::REST::Conversations::V1::ConfigurationContext]
30
+ def configuration
31
+ @configuration ||= ConfigurationContext.new self
20
32
  end
21
33
 
22
34
  ##
23
35
  # @param [String] sid A 34 character string that uniquely identifies this
24
- # resource.
36
+ # resource. Can also be the `unique_name` of the Conversation.
25
37
  # @return [Twilio::REST::Conversations::V1::ConversationContext] if sid was passed.
26
38
  # @return [Twilio::REST::Conversations::V1::ConversationList]
27
39
  def conversations(sid=:unset)
@@ -40,6 +52,81 @@ module Twilio
40
52
  @webhooks ||= WebhookContext.new self
41
53
  end
42
54
 
55
+ ##
56
+ # @param [String] sid A 34 character string that uniquely identifies this
57
+ # resource.
58
+ # @return [Twilio::REST::Conversations::V1::CredentialContext] if sid was passed.
59
+ # @return [Twilio::REST::Conversations::V1::CredentialList]
60
+ def credentials(sid=:unset)
61
+ if sid.nil?
62
+ raise ArgumentError, 'sid cannot be nil'
63
+ elsif sid == :unset
64
+ @credentials ||= CredentialList.new self
65
+ else
66
+ CredentialContext.new(self, sid)
67
+ end
68
+ end
69
+
70
+ ##
71
+ # @param [String] sid The SID of the Role resource to fetch.
72
+ # @return [Twilio::REST::Conversations::V1::RoleContext] if sid was passed.
73
+ # @return [Twilio::REST::Conversations::V1::RoleList]
74
+ def roles(sid=:unset)
75
+ if sid.nil?
76
+ raise ArgumentError, 'sid cannot be nil'
77
+ elsif sid == :unset
78
+ @roles ||= RoleList.new self
79
+ else
80
+ RoleContext.new(self, sid)
81
+ end
82
+ end
83
+
84
+ ##
85
+ # @param [String] sid A 34 character string that uniquely identifies this
86
+ # resource.
87
+ # @return [Twilio::REST::Conversations::V1::ServiceContext] if sid was passed.
88
+ # @return [Twilio::REST::Conversations::V1::ServiceList]
89
+ def services(sid=:unset)
90
+ if sid.nil?
91
+ raise ArgumentError, 'sid cannot be nil'
92
+ elsif sid == :unset
93
+ @services ||= ServiceList.new self
94
+ else
95
+ ServiceContext.new(self, sid)
96
+ end
97
+ end
98
+
99
+ ##
100
+ # @param [String] chat_service_sid The SID of the [Chat
101
+ # Service](https://www.twilio.com/docs/chat/rest/service-resource) the
102
+ # Configuration applies to.
103
+ # @return [Twilio::REST::Conversations::V1::NotificationContext] if chat_service_sid was passed.
104
+ # @return [Twilio::REST::Conversations::V1::NotificationList]
105
+ def notifications(chat_service_sid=:unset)
106
+ if chat_service_sid.nil?
107
+ raise ArgumentError, 'chat_service_sid cannot be nil'
108
+ elsif chat_service_sid == :unset
109
+ @notifications ||= NotificationList.new self
110
+ else
111
+ NotificationContext.new(self, chat_service_sid)
112
+ end
113
+ end
114
+
115
+ ##
116
+ # @param [String] sid The SID of the User resource to fetch. This value can be
117
+ # either the `sid` or the `identity` of the User resource to fetch.
118
+ # @return [Twilio::REST::Conversations::V1::UserContext] if sid was passed.
119
+ # @return [Twilio::REST::Conversations::V1::UserList]
120
+ def users(sid=:unset)
121
+ if sid.nil?
122
+ raise ArgumentError, 'sid cannot be nil'
123
+ elsif sid == :unset
124
+ @users ||= UserList.new self
125
+ else
126
+ UserContext.new(self, sid)
127
+ end
128
+ end
129
+
43
130
  ##
44
131
  # Provide a user friendly representation
45
132
  def to_s
@@ -0,0 +1,258 @@
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 Conversations < 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 ConfigurationList < ListResource
16
+ ##
17
+ # Initialize the ConfigurationList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [ConfigurationList] ConfigurationList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '#<Twilio.Conversations.V1.ConfigurationList>'
31
+ end
32
+ end
33
+
34
+ ##
35
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
36
+ class ConfigurationPage < Page
37
+ ##
38
+ # Initialize the ConfigurationPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [ConfigurationPage] ConfigurationPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of ConfigurationInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [ConfigurationInstance] ConfigurationInstance
54
+ def get_instance(payload)
55
+ ConfigurationInstance.new(@version, payload, )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Conversations.V1.ConfigurationPage>'
62
+ end
63
+ end
64
+
65
+ ##
66
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
67
+ class ConfigurationContext < InstanceContext
68
+ ##
69
+ # Initialize the ConfigurationContext
70
+ # @param [Version] version Version that contains the resource
71
+ # @return [ConfigurationContext] ConfigurationContext
72
+ def initialize(version)
73
+ super(version)
74
+
75
+ # Path Solution
76
+ @solution = {}
77
+ @uri = "/Configuration"
78
+ end
79
+
80
+ ##
81
+ # Fetch the ConfigurationInstance
82
+ # @return [ConfigurationInstance] Fetched ConfigurationInstance
83
+ def fetch
84
+ payload = @version.fetch('GET', @uri)
85
+
86
+ ConfigurationInstance.new(@version, payload, )
87
+ end
88
+
89
+ ##
90
+ # Update the ConfigurationInstance
91
+ # @param [String] default_chat_service_sid The SID of the default [Chat
92
+ # Service](https://www.twilio.com/docs/chat/rest/service-resource) to use when
93
+ # creating a conversation.
94
+ # @param [String] default_messaging_service_sid The SID of the default [Messaging
95
+ # Service](https://www.twilio.com/docs/sms/services/api) to use when creating a
96
+ # conversation.
97
+ # @param [String] default_inactive_timer Default ISO8601 duration when
98
+ # conversation will be switched to `inactive` state. Minimum value for this timer
99
+ # is 1 minute.
100
+ # @param [String] default_closed_timer Default ISO8601 duration when conversation
101
+ # will be switched to `closed` state. Minimum value for this timer is 10 minutes.
102
+ # @return [ConfigurationInstance] Updated ConfigurationInstance
103
+ def update(default_chat_service_sid: :unset, default_messaging_service_sid: :unset, default_inactive_timer: :unset, default_closed_timer: :unset)
104
+ data = Twilio::Values.of({
105
+ 'DefaultChatServiceSid' => default_chat_service_sid,
106
+ 'DefaultMessagingServiceSid' => default_messaging_service_sid,
107
+ 'DefaultInactiveTimer' => default_inactive_timer,
108
+ 'DefaultClosedTimer' => default_closed_timer,
109
+ })
110
+
111
+ payload = @version.update('POST', @uri, data: data)
112
+
113
+ ConfigurationInstance.new(@version, payload, )
114
+ end
115
+
116
+ ##
117
+ # Provide a user friendly representation
118
+ def to_s
119
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
120
+ "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
121
+ end
122
+
123
+ ##
124
+ # Provide a detailed, user friendly representation
125
+ def inspect
126
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
127
+ "#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
128
+ end
129
+ end
130
+
131
+ ##
132
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
133
+ class ConfigurationInstance < InstanceResource
134
+ ##
135
+ # Initialize the ConfigurationInstance
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Hash] payload payload that contains response from Twilio
138
+ # @return [ConfigurationInstance] ConfigurationInstance
139
+ def initialize(version, payload)
140
+ super(version)
141
+
142
+ # Marshaled Properties
143
+ @properties = {
144
+ 'account_sid' => payload['account_sid'],
145
+ 'default_chat_service_sid' => payload['default_chat_service_sid'],
146
+ 'default_messaging_service_sid' => payload['default_messaging_service_sid'],
147
+ 'default_inactive_timer' => payload['default_inactive_timer'],
148
+ 'default_closed_timer' => payload['default_closed_timer'],
149
+ 'url' => payload['url'],
150
+ 'links' => payload['links'],
151
+ }
152
+
153
+ # Context
154
+ @instance_context = nil
155
+ @params = {}
156
+ end
157
+
158
+ ##
159
+ # Generate an instance context for the instance, the context is capable of
160
+ # performing various actions. All instance actions are proxied to the context
161
+ # @return [ConfigurationContext] ConfigurationContext for this ConfigurationInstance
162
+ def context
163
+ unless @instance_context
164
+ @instance_context = ConfigurationContext.new(@version, )
165
+ end
166
+ @instance_context
167
+ end
168
+
169
+ ##
170
+ # @return [String] The SID of the Account responsible for this configuration.
171
+ def account_sid
172
+ @properties['account_sid']
173
+ end
174
+
175
+ ##
176
+ # @return [String] The SID of the default Chat Service that every new conversation is associated with.
177
+ def default_chat_service_sid
178
+ @properties['default_chat_service_sid']
179
+ end
180
+
181
+ ##
182
+ # @return [String] The SID of the default Messaging Service that every new conversation is associated with.
183
+ def default_messaging_service_sid
184
+ @properties['default_messaging_service_sid']
185
+ end
186
+
187
+ ##
188
+ # @return [String] Default ISO8601 duration when conversation will be switched to `inactive` state.
189
+ def default_inactive_timer
190
+ @properties['default_inactive_timer']
191
+ end
192
+
193
+ ##
194
+ # @return [String] Default ISO8601 duration when conversation will be switched to `closed` state.
195
+ def default_closed_timer
196
+ @properties['default_closed_timer']
197
+ end
198
+
199
+ ##
200
+ # @return [String] The url
201
+ def url
202
+ @properties['url']
203
+ end
204
+
205
+ ##
206
+ # @return [String] The links
207
+ def links
208
+ @properties['links']
209
+ end
210
+
211
+ ##
212
+ # Fetch the ConfigurationInstance
213
+ # @return [ConfigurationInstance] Fetched ConfigurationInstance
214
+ def fetch
215
+ context.fetch
216
+ end
217
+
218
+ ##
219
+ # Update the ConfigurationInstance
220
+ # @param [String] default_chat_service_sid The SID of the default [Chat
221
+ # Service](https://www.twilio.com/docs/chat/rest/service-resource) to use when
222
+ # creating a conversation.
223
+ # @param [String] default_messaging_service_sid The SID of the default [Messaging
224
+ # Service](https://www.twilio.com/docs/sms/services/api) to use when creating a
225
+ # conversation.
226
+ # @param [String] default_inactive_timer Default ISO8601 duration when
227
+ # conversation will be switched to `inactive` state. Minimum value for this timer
228
+ # is 1 minute.
229
+ # @param [String] default_closed_timer Default ISO8601 duration when conversation
230
+ # will be switched to `closed` state. Minimum value for this timer is 10 minutes.
231
+ # @return [ConfigurationInstance] Updated ConfigurationInstance
232
+ def update(default_chat_service_sid: :unset, default_messaging_service_sid: :unset, default_inactive_timer: :unset, default_closed_timer: :unset)
233
+ context.update(
234
+ default_chat_service_sid: default_chat_service_sid,
235
+ default_messaging_service_sid: default_messaging_service_sid,
236
+ default_inactive_timer: default_inactive_timer,
237
+ default_closed_timer: default_closed_timer,
238
+ )
239
+ end
240
+
241
+ ##
242
+ # Provide a user friendly representation
243
+ def to_s
244
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
245
+ "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
246
+ end
247
+
248
+ ##
249
+ # Provide a detailed, user friendly representation
250
+ def inspect
251
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
252
+ "<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
253
+ end
254
+ end
255
+ end
256
+ end
257
+ end
258
+ end