twilio-ruby 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +30 -2
  3. data/CONTRIBUTING.md +159 -0
  4. data/ISSUE_TEMPLATE.md +26 -0
  5. data/LICENSE.md +1 -1
  6. data/README.md +6 -7
  7. data/VERSIONS.md +21 -49
  8. data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +11 -11
  9. data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +11 -11
  10. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +11 -11
  11. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +11 -11
  12. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +11 -11
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +11 -11
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +11 -11
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +11 -11
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +11 -11
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +11 -11
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +11 -18
  19. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +11 -11
  20. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +11 -11
  21. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +11 -11
  22. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +11 -11
  23. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +358 -0
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +439 -0
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -11
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -11
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -11
  28. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +48 -11
  29. data/lib/twilio-ruby/rest/api/v2010/account/key.rb +11 -11
  30. data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +22 -12
  32. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +11 -11
  33. data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +11 -11
  34. data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +11 -11
  35. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +11 -11
  36. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +11 -11
  37. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +11 -11
  38. data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +11 -11
  39. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +11 -18
  40. data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +11 -11
  41. data/lib/twilio-ruby/rest/api/v2010/account/signing_key.rb +11 -11
  42. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +11 -11
  43. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +11 -11
  44. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  45. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  46. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +11 -11
  47. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +11 -11
  48. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +11 -11
  49. data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +11 -11
  50. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +11 -11
  51. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +11 -11
  52. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +11 -11
  53. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +11 -11
  54. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +11 -11
  55. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +11 -11
  56. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +11 -11
  57. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +11 -11
  58. data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +11 -11
  59. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +11 -11
  60. data/lib/twilio-ruby/rest/api/v2010/account.rb +11 -11
  61. data/lib/twilio-ruby/rest/chat/v1/credential.rb +11 -11
  62. data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +11 -11
  63. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +11 -11
  64. data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +11 -11
  65. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +11 -11
  66. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +11 -11
  67. data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +11 -11
  68. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +11 -11
  69. data/lib/twilio-ruby/rest/chat/v1/service.rb +11 -11
  70. data/lib/twilio-ruby/rest/chat/v2/credential.rb +11 -11
  71. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +11 -11
  72. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +11 -11
  73. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +11 -11
  74. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +11 -11
  75. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +11 -11
  76. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +11 -11
  77. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +11 -11
  78. data/lib/twilio-ruby/rest/chat/v2/service.rb +11 -11
  79. data/lib/twilio-ruby/rest/client.rb +42 -0
  80. data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +334 -0
  81. data/lib/twilio-ruby/rest/fax/v1/fax.rb +549 -0
  82. data/lib/twilio-ruby/rest/fax/v1.rb +41 -0
  83. data/lib/twilio-ruby/rest/fax.rb +44 -0
  84. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +11 -11
  85. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +11 -11
  86. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +11 -11
  87. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +11 -11
  88. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +11 -11
  89. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +11 -11
  90. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +11 -11
  91. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +11 -11
  92. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +11 -11
  93. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +11 -11
  94. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +11 -11
  95. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +11 -11
  96. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +11 -11
  97. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +11 -11
  98. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +11 -11
  99. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +11 -11
  100. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +11 -11
  101. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +11 -11
  102. data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +360 -0
  103. data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +367 -0
  104. data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +367 -0
  105. data/lib/twilio-ruby/rest/messaging/v1/service.rb +645 -0
  106. data/lib/twilio-ruby/rest/messaging/v1.rb +41 -0
  107. data/lib/twilio-ruby/rest/messaging.rb +44 -0
  108. data/lib/twilio-ruby/rest/monitor/v1/alert.rb +11 -11
  109. data/lib/twilio-ruby/rest/monitor/v1/event.rb +11 -11
  110. data/lib/twilio-ruby/rest/notify/v1/credential.rb +411 -0
  111. data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +438 -0
  112. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +294 -0
  113. data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +230 -0
  114. data/lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb +262 -0
  115. data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +442 -0
  116. data/lib/twilio-ruby/rest/notify/v1/service/user.rb +453 -0
  117. data/lib/twilio-ruby/rest/notify/v1/service.rb +647 -0
  118. data/lib/twilio-ruby/rest/notify/v1.rb +56 -0
  119. data/lib/twilio-ruby/rest/notify.rb +52 -0
  120. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +216 -0
  121. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +211 -0
  122. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +251 -0
  123. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +56 -0
  124. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +570 -0
  125. data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +42 -0
  126. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb +309 -0
  127. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +341 -0
  128. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb +349 -0
  129. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +448 -0
  130. data/lib/twilio-ruby/rest/preview/marketplace.rb +58 -0
  131. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +367 -0
  132. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +437 -0
  133. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +460 -0
  134. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +514 -0
  135. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +544 -0
  136. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +367 -0
  137. data/lib/twilio-ruby/rest/preview/proxy/service.rb +508 -0
  138. data/lib/twilio-ruby/rest/preview/proxy.rb +41 -0
  139. data/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb +403 -0
  140. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +453 -0
  141. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +438 -0
  142. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb +403 -0
  143. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +446 -0
  144. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +440 -0
  145. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb +403 -0
  146. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +446 -0
  147. data/lib/twilio-ruby/rest/preview/sync/service.rb +512 -0
  148. data/lib/twilio-ruby/rest/preview/sync.rb +41 -0
  149. data/lib/twilio-ruby/rest/preview/wireless/command.rb +390 -0
  150. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +443 -0
  151. data/lib/twilio-ruby/rest/preview/wireless/sim/usage.rb +244 -0
  152. data/lib/twilio-ruby/rest/preview/wireless/sim.rb +552 -0
  153. data/lib/twilio-ruby/rest/preview/wireless.rb +71 -0
  154. data/lib/twilio-ruby/rest/preview.rb +145 -0
  155. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +11 -11
  156. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +11 -11
  157. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +11 -11
  158. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +403 -0
  159. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +453 -0
  160. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +438 -0
  161. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +403 -0
  162. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +446 -0
  163. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +440 -0
  164. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +403 -0
  165. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +446 -0
  166. data/lib/twilio-ruby/rest/sync/v1/service.rb +512 -0
  167. data/lib/twilio-ruby/rest/sync/v1.rb +41 -0
  168. data/lib/twilio-ruby/rest/sync.rb +44 -0
  169. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +11 -11
  170. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +11 -11
  171. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +143 -13
  172. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +11 -11
  173. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +11 -11
  174. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +11 -11
  175. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +11 -11
  176. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +143 -13
  177. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +11 -11
  178. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +11 -11
  179. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +11 -11
  180. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +11 -11
  181. data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +11 -11
  182. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +11 -11
  183. data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +11 -11
  184. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +11 -11
  185. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +11 -11
  186. data/lib/twilio-ruby/rest/video/v1/recording.rb +11 -11
  187. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +11 -11
  188. data/lib/twilio-ruby/rest/video/v1/room.rb +11 -11
  189. data/lib/twilio-ruby/rest/wireless/v1/command.rb +375 -0
  190. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +460 -0
  191. data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +241 -0
  192. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +556 -0
  193. data/lib/twilio-ruby/rest/wireless/v1.rb +71 -0
  194. data/lib/twilio-ruby/rest/wireless.rb +60 -0
  195. data/lib/twilio-ruby/version.rb +1 -1
  196. data/spec/integration/api/v2010/account/call/recording_spec.rb +0 -2
  197. data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension_spec.rb +135 -0
  198. data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on_spec.rb +223 -0
  199. data/spec/integration/api/v2010/account/recording_spec.rb +0 -2
  200. data/spec/integration/fax/v1/fax/fax_media_spec.rb +126 -0
  201. data/spec/integration/fax/v1/fax_spec.rb +272 -0
  202. data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +170 -0
  203. data/spec/integration/messaging/v1/service/phone_number_spec.rb +201 -0
  204. data/spec/integration/messaging/v1/service/short_code_spec.rb +173 -0
  205. data/spec/integration/messaging/v1/service_spec.rb +263 -0
  206. data/spec/integration/notify/v1/credential_spec.rb +223 -0
  207. data/spec/integration/notify/v1/service/binding_spec.rb +227 -0
  208. data/spec/integration/notify/v1/service/notification_spec.rb +97 -0
  209. data/spec/integration/notify/v1/service/segment_spec.rb +84 -0
  210. data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +118 -0
  211. data/spec/integration/notify/v1/service/user/user_binding_spec.rb +269 -0
  212. data/spec/integration/notify/v1/service/user_spec.rb +213 -0
  213. data/spec/integration/notify/v1/service_spec.rb +280 -0
  214. data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
  215. data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
  216. data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
  217. data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +280 -0
  218. data/spec/integration/preview/marketplace/available_add_on/available_add_on_extension_spec.rb +121 -0
  219. data/spec/integration/preview/marketplace/available_add_on_spec.rb +142 -0
  220. data/spec/integration/preview/marketplace/installed_add_on/installed_add_on_extension_spec.rb +164 -0
  221. data/spec/integration/preview/marketplace/installed_add_on_spec.rb +252 -0
  222. data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
  223. data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
  224. data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
  225. data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
  226. data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
  227. data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
  228. data/spec/integration/preview/proxy/service_spec.rb +200 -0
  229. data/spec/integration/preview/sync/service/document/document_permission_spec.rb +206 -0
  230. data/spec/integration/preview/sync/service/document_spec.rb +254 -0
  231. data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +256 -0
  232. data/spec/integration/preview/sync/service/sync_list/sync_list_permission_spec.rb +206 -0
  233. data/spec/integration/preview/sync/service/sync_list_spec.rb +207 -0
  234. data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +257 -0
  235. data/spec/integration/preview/sync/service/sync_map/sync_map_permission_spec.rb +206 -0
  236. data/spec/integration/preview/sync/service/sync_map_spec.rb +207 -0
  237. data/spec/integration/preview/sync/service_spec.rb +244 -0
  238. data/spec/integration/preview/wireless/command_spec.rb +169 -0
  239. data/spec/integration/preview/wireless/rate_plan_spec.rb +260 -0
  240. data/spec/integration/preview/wireless/sim/usage_spec.rb +49 -0
  241. data/spec/integration/preview/wireless/sim_spec.rb +208 -0
  242. data/spec/integration/sync/v1/service/document/document_permission_spec.rb +206 -0
  243. data/spec/integration/sync/v1/service/document_spec.rb +254 -0
  244. data/spec/integration/sync/v1/service/sync_list/sync_list_item_spec.rb +256 -0
  245. data/spec/integration/sync/v1/service/sync_list/sync_list_permission_spec.rb +206 -0
  246. data/spec/integration/sync/v1/service/sync_list_spec.rb +207 -0
  247. data/spec/integration/sync/v1/service/sync_map/sync_map_item_spec.rb +257 -0
  248. data/spec/integration/sync/v1/service/sync_map/sync_map_permission_spec.rb +206 -0
  249. data/spec/integration/sync/v1/service/sync_map_spec.rb +207 -0
  250. data/spec/integration/sync/v1/service_spec.rb +244 -0
  251. data/spec/integration/taskrouter/v1/workspace/task/reservation_spec.rb +5 -5
  252. data/spec/integration/taskrouter/v1/workspace/worker/reservation_spec.rb +5 -5
  253. data/spec/integration/wireless/v1/command_spec.rb +166 -0
  254. data/spec/integration/wireless/v1/rate_plan_spec.rb +268 -0
  255. data/spec/integration/wireless/v1/sim/usage_record_spec.rb +65 -0
  256. data/spec/integration/wireless/v1/sim_spec.rb +208 -0
  257. data/twilio-ruby.gemspec +1 -3
  258. metadata +192 -2
@@ -0,0 +1,367 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Proxy < Version
11
+ class ServiceContext < InstanceContext
12
+ ##
13
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
14
+ class ShortCodeList < ListResource
15
+ ##
16
+ # Initialize the ShortCodeList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] service_sid The unique SID identifier of the Service.
19
+ # @return [ShortCodeList] ShortCodeList
20
+ def initialize(version, service_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ service_sid: service_sid
26
+ }
27
+ @uri = "/Services/#{@solution[:service_sid]}/ShortCodes"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of ShortCodeInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] sid The shortcode Sid that uniquely identifies this resource
34
+ # @return [ShortCodeInstance] Newly created ShortCodeInstance
35
+ def create(sid: nil)
36
+ data = Twilio::Values.of({
37
+ 'Sid' => sid,
38
+ })
39
+
40
+ payload = @version.create(
41
+ 'POST',
42
+ @uri,
43
+ data: data
44
+ )
45
+
46
+ ShortCodeInstance.new(
47
+ @version,
48
+ payload,
49
+ service_sid: @solution[:service_sid],
50
+ )
51
+ end
52
+
53
+ ##
54
+ # Lists ShortCodeInstance records from the API as a list.
55
+ # Unlike stream(), this operation is eager and will load `limit` records into
56
+ # memory before returning.
57
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
58
+ # guarantees to never return more than limit. Default is no limit
59
+ # @param [Integer] page_size Number of records to fetch per request, when
60
+ # not set will use the default value of 50 records. If no page_size is defined
61
+ # but a limit is defined, stream() will attempt to read the limit with the most
62
+ # efficient page size, i.e. min(limit, 1000)
63
+ # @return [Array] Array of up to limit results
64
+ def list(limit: nil, page_size: nil)
65
+ self.stream(
66
+ limit: limit,
67
+ page_size: page_size
68
+ ).entries
69
+ end
70
+
71
+ ##
72
+ # Streams ShortCodeInstance records from the API as an Enumerable.
73
+ # This operation lazily loads records as efficiently as possible until the limit
74
+ # is reached.
75
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
76
+ # guarantees to never return more than limit. Default is no limit.
77
+ # @param [Integer] page_size Number of records to fetch per request, when
78
+ # not set will use the default value of 50 records. If no page_size is defined
79
+ # but a limit is defined, stream() will attempt to read the limit with the most
80
+ # efficient page size, i.e. min(limit, 1000)
81
+ # @return [Enumerable] Enumerable that will yield up to limit results
82
+ def stream(limit: nil, page_size: nil)
83
+ limits = @version.read_limits(limit, page_size)
84
+
85
+ page = self.page(
86
+ page_size: limits[:page_size],
87
+ )
88
+
89
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
90
+ end
91
+
92
+ ##
93
+ # When passed a block, yields ShortCodeInstance records from the API.
94
+ # This operation lazily loads records as efficiently as possible until the limit
95
+ # is reached.
96
+ def each
97
+ limits = @version.read_limits
98
+
99
+ page = self.page(
100
+ page_size: limits[:page_size],
101
+ )
102
+
103
+ @version.stream(page,
104
+ limit: limits[:limit],
105
+ page_limit: limits[:page_limit]).each {|x| yield x}
106
+ end
107
+
108
+ ##
109
+ # Retrieve a single page of ShortCodeInstance records from the API.
110
+ # Request is executed immediately.
111
+ # @param [String] page_token PageToken provided by the API
112
+ # @param [Integer] page_number Page Number, this value is simply for client state
113
+ # @param [Integer] page_size Number of records to return, defaults to 50
114
+ # @return [Page] Page of ShortCodeInstance
115
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
116
+ params = Twilio::Values.of({
117
+ 'PageToken' => page_token,
118
+ 'Page' => page_number,
119
+ 'PageSize' => page_size,
120
+ })
121
+ response = @version.page(
122
+ 'GET',
123
+ @uri,
124
+ params
125
+ )
126
+ ShortCodePage.new(@version, response, @solution)
127
+ end
128
+
129
+ ##
130
+ # Retrieve a single page of ShortCodeInstance records from the API.
131
+ # Request is executed immediately.
132
+ # @param [String] target_url API-generated URL for the requested results page
133
+ # @return [Page] Page of ShortCodeInstance
134
+ def get_page(target_url)
135
+ response = @version.domain.request(
136
+ 'GET',
137
+ target_url
138
+ )
139
+ ShortCodePage.new(@version, response, @solution)
140
+ end
141
+
142
+ ##
143
+ # Provide a user friendly representation
144
+ def to_s
145
+ '#<Twilio.Preview.Proxy.ShortCodeList>'
146
+ end
147
+ end
148
+
149
+ ##
150
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
151
+ class ShortCodePage < Page
152
+ ##
153
+ # Initialize the ShortCodePage
154
+ # @param [Version] version Version that contains the resource
155
+ # @param [Response] response Response from the API
156
+ # @param [Hash] solution Path solution for the resource
157
+ # @return [ShortCodePage] ShortCodePage
158
+ def initialize(version, response, solution)
159
+ super(version, response)
160
+
161
+ # Path Solution
162
+ @solution = solution
163
+ end
164
+
165
+ ##
166
+ # Build an instance of ShortCodeInstance
167
+ # @param [Hash] payload Payload response from the API
168
+ # @return [ShortCodeInstance] ShortCodeInstance
169
+ def get_instance(payload)
170
+ ShortCodeInstance.new(
171
+ @version,
172
+ payload,
173
+ service_sid: @solution[:service_sid],
174
+ )
175
+ end
176
+
177
+ ##
178
+ # Provide a user friendly representation
179
+ def to_s
180
+ '<Twilio.Preview.Proxy.ShortCodePage>'
181
+ end
182
+ end
183
+
184
+ ##
185
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
186
+ class ShortCodeContext < InstanceContext
187
+ ##
188
+ # Initialize the ShortCodeContext
189
+ # @param [Version] version Version that contains the resource
190
+ # @param [String] service_sid The service_sid
191
+ # @param [String] sid The shortcode Sid that uniquely identifies this resource
192
+ # @return [ShortCodeContext] ShortCodeContext
193
+ def initialize(version, service_sid, sid)
194
+ super(version)
195
+
196
+ # Path Solution
197
+ @solution = {
198
+ service_sid: service_sid,
199
+ sid: sid,
200
+ }
201
+ @uri = "/Services/#{@solution[:service_sid]}/ShortCodes/#{@solution[:sid]}"
202
+ end
203
+
204
+ ##
205
+ # Deletes the ShortCodeInstance
206
+ # @return [Boolean] true if delete succeeds, true otherwise
207
+ def delete
208
+ @version.delete('delete', @uri)
209
+ end
210
+
211
+ ##
212
+ # Fetch a ShortCodeInstance
213
+ # @return [ShortCodeInstance] Fetched ShortCodeInstance
214
+ def fetch
215
+ params = Twilio::Values.of({})
216
+
217
+ payload = @version.fetch(
218
+ 'GET',
219
+ @uri,
220
+ params,
221
+ )
222
+
223
+ ShortCodeInstance.new(
224
+ @version,
225
+ payload,
226
+ service_sid: @solution[:service_sid],
227
+ sid: @solution[:sid],
228
+ )
229
+ end
230
+
231
+ ##
232
+ # Provide a user friendly representation
233
+ def to_s
234
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
235
+ "#<Twilio.Preview.Proxy.ShortCodeContext #{context}>"
236
+ end
237
+ end
238
+
239
+ ##
240
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
241
+ class ShortCodeInstance < InstanceResource
242
+ ##
243
+ # Initialize the ShortCodeInstance
244
+ # @param [Version] version Version that contains the resource
245
+ # @param [Hash] payload payload that contains response from Twilio
246
+ # @param [String] service_sid The unique SID identifier of the Service.
247
+ # @param [String] sid The shortcode Sid that uniquely identifies this resource
248
+ # @return [ShortCodeInstance] ShortCodeInstance
249
+ def initialize(version, payload, service_sid: nil, sid: nil)
250
+ super(version)
251
+
252
+ # Marshaled Properties
253
+ @properties = {
254
+ 'sid' => payload['sid'],
255
+ 'account_sid' => payload['account_sid'],
256
+ 'service_sid' => payload['service_sid'],
257
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
258
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
259
+ 'short_code' => payload['short_code'],
260
+ 'country_code' => payload['country_code'],
261
+ 'capabilities' => payload['capabilities'],
262
+ 'url' => payload['url'],
263
+ }
264
+
265
+ # Context
266
+ @instance_context = nil
267
+ @params = {
268
+ 'service_sid' => service_sid,
269
+ 'sid' => sid || @properties['sid'],
270
+ }
271
+ end
272
+
273
+ ##
274
+ # Generate an instance context for the instance, the context is capable of
275
+ # performing various actions. All instance actions are proxied to the context
276
+ # @return [ShortCodeContext] ShortCodeContext for this ShortCodeInstance
277
+ def context
278
+ unless @instance_context
279
+ @instance_context = ShortCodeContext.new(
280
+ @version,
281
+ @params['service_sid'],
282
+ @params['sid'],
283
+ )
284
+ end
285
+ @instance_context
286
+ end
287
+
288
+ ##
289
+ # @return [String] A string that uniquely identifies this resource
290
+ def sid
291
+ @properties['sid']
292
+ end
293
+
294
+ ##
295
+ # @return [String] Account Sid.
296
+ def account_sid
297
+ @properties['account_sid']
298
+ end
299
+
300
+ ##
301
+ # @return [String] Service Sid.
302
+ def service_sid
303
+ @properties['service_sid']
304
+ end
305
+
306
+ ##
307
+ # @return [Time] The date this resource was created
308
+ def date_created
309
+ @properties['date_created']
310
+ end
311
+
312
+ ##
313
+ # @return [Time] The date this resource was last updated
314
+ def date_updated
315
+ @properties['date_updated']
316
+ end
317
+
318
+ ##
319
+ # @return [String] The short code. e.g., 894546.
320
+ def short_code
321
+ @properties['short_code']
322
+ end
323
+
324
+ ##
325
+ # @return [String] The ISO 3166-1 alpha-2 country code
326
+ def country_code
327
+ @properties['country_code']
328
+ end
329
+
330
+ ##
331
+ # @return [Hash] Indicate if a shortcode can receive messages
332
+ def capabilities
333
+ @properties['capabilities']
334
+ end
335
+
336
+ ##
337
+ # @return [String] The URL of this resource.
338
+ def url
339
+ @properties['url']
340
+ end
341
+
342
+ ##
343
+ # Deletes the ShortCodeInstance
344
+ # @return [Boolean] true if delete succeeds, true otherwise
345
+ def delete
346
+ context.delete
347
+ end
348
+
349
+ ##
350
+ # Fetch a ShortCodeInstance
351
+ # @return [ShortCodeInstance] Fetched ShortCodeInstance
352
+ def fetch
353
+ context.fetch
354
+ end
355
+
356
+ ##
357
+ # Provide a user friendly representation
358
+ def to_s
359
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
360
+ "<Twilio.Preview.Proxy.ShortCodeInstance #{values}>"
361
+ end
362
+ end
363
+ end
364
+ end
365
+ end
366
+ end
367
+ end
@@ -0,0 +1,508 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Proxy < Version
11
+ ##
12
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
13
+ class ServiceList < ListResource
14
+ ##
15
+ # Initialize the ServiceList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [ServiceList] ServiceList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/Services"
24
+ end
25
+
26
+ ##
27
+ # Lists ServiceInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
31
+ # guarantees to never return more than limit. Default is no limit
32
+ # @param [Integer] page_size Number of records to fetch per request, when
33
+ # not set will use the default value of 50 records. If no page_size is defined
34
+ # but a limit is defined, stream() will attempt to read the limit with the most
35
+ # efficient page size, i.e. min(limit, 1000)
36
+ # @return [Array] Array of up to limit results
37
+ def list(limit: nil, page_size: nil)
38
+ self.stream(
39
+ limit: limit,
40
+ page_size: page_size
41
+ ).entries
42
+ end
43
+
44
+ ##
45
+ # Streams ServiceInstance records from the API as an Enumerable.
46
+ # This operation lazily loads records as efficiently as possible until the limit
47
+ # is reached.
48
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
49
+ # guarantees to never return more than limit. Default is no limit.
50
+ # @param [Integer] page_size Number of records to fetch per request, when
51
+ # not set will use the default value of 50 records. If no page_size is defined
52
+ # but a limit is defined, stream() will attempt to read the limit with the most
53
+ # efficient page size, i.e. min(limit, 1000)
54
+ # @return [Enumerable] Enumerable that will yield up to limit results
55
+ def stream(limit: nil, page_size: nil)
56
+ limits = @version.read_limits(limit, page_size)
57
+
58
+ page = self.page(
59
+ page_size: limits[:page_size],
60
+ )
61
+
62
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
63
+ end
64
+
65
+ ##
66
+ # When passed a block, yields ServiceInstance records from the API.
67
+ # This operation lazily loads records as efficiently as possible until the limit
68
+ # is reached.
69
+ def each
70
+ limits = @version.read_limits
71
+
72
+ page = self.page(
73
+ page_size: limits[:page_size],
74
+ )
75
+
76
+ @version.stream(page,
77
+ limit: limits[:limit],
78
+ page_limit: limits[:page_limit]).each {|x| yield x}
79
+ end
80
+
81
+ ##
82
+ # Retrieve a single page of ServiceInstance records from the API.
83
+ # Request is executed immediately.
84
+ # @param [String] page_token PageToken provided by the API
85
+ # @param [Integer] page_number Page Number, this value is simply for client state
86
+ # @param [Integer] page_size Number of records to return, defaults to 50
87
+ # @return [Page] Page of ServiceInstance
88
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
89
+ params = Twilio::Values.of({
90
+ 'PageToken' => page_token,
91
+ 'Page' => page_number,
92
+ 'PageSize' => page_size,
93
+ })
94
+ response = @version.page(
95
+ 'GET',
96
+ @uri,
97
+ params
98
+ )
99
+ ServicePage.new(@version, response, @solution)
100
+ end
101
+
102
+ ##
103
+ # Retrieve a single page of ServiceInstance records from the API.
104
+ # Request is executed immediately.
105
+ # @param [String] target_url API-generated URL for the requested results page
106
+ # @return [Page] Page of ServiceInstance
107
+ def get_page(target_url)
108
+ response = @version.domain.request(
109
+ 'GET',
110
+ target_url
111
+ )
112
+ ServicePage.new(@version, response, @solution)
113
+ end
114
+
115
+ ##
116
+ # Retrieve a single page of ServiceInstance records from the API.
117
+ # Request is executed immediately.
118
+ # @param [String] friendly_name A human readable description of this resource, up
119
+ # to 64 characters.
120
+ # @param [Boolean] auto_create Boolean flag specifying whether to create threads
121
+ # when a user communticates out of band.
122
+ # @param [String] callback_url The URL Twilio will request for callback
123
+ # notifications.
124
+ # @return [ServiceInstance] Newly created ServiceInstance
125
+ def create(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
126
+ data = Twilio::Values.of({
127
+ 'FriendlyName' => friendly_name,
128
+ 'AutoCreate' => auto_create,
129
+ 'CallbackUrl' => callback_url,
130
+ })
131
+
132
+ payload = @version.create(
133
+ 'POST',
134
+ @uri,
135
+ data: data
136
+ )
137
+
138
+ ServiceInstance.new(
139
+ @version,
140
+ payload,
141
+ )
142
+ end
143
+
144
+ ##
145
+ # Provide a user friendly representation
146
+ def to_s
147
+ '#<Twilio.Preview.Proxy.ServiceList>'
148
+ end
149
+ end
150
+
151
+ ##
152
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
153
+ class ServicePage < Page
154
+ ##
155
+ # Initialize the ServicePage
156
+ # @param [Version] version Version that contains the resource
157
+ # @param [Response] response Response from the API
158
+ # @param [Hash] solution Path solution for the resource
159
+ # @return [ServicePage] ServicePage
160
+ def initialize(version, response, solution)
161
+ super(version, response)
162
+
163
+ # Path Solution
164
+ @solution = solution
165
+ end
166
+
167
+ ##
168
+ # Build an instance of ServiceInstance
169
+ # @param [Hash] payload Payload response from the API
170
+ # @return [ServiceInstance] ServiceInstance
171
+ def get_instance(payload)
172
+ ServiceInstance.new(
173
+ @version,
174
+ payload,
175
+ )
176
+ end
177
+
178
+ ##
179
+ # Provide a user friendly representation
180
+ def to_s
181
+ '<Twilio.Preview.Proxy.ServicePage>'
182
+ end
183
+ end
184
+
185
+ ##
186
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
187
+ class ServiceContext < InstanceContext
188
+ ##
189
+ # Initialize the ServiceContext
190
+ # @param [Version] version Version that contains the resource
191
+ # @param [String] sid A 34 character string that uniquely identifies this Service.
192
+ # @return [ServiceContext] ServiceContext
193
+ def initialize(version, sid)
194
+ super(version)
195
+
196
+ # Path Solution
197
+ @solution = {
198
+ sid: sid,
199
+ }
200
+ @uri = "/Services/#{@solution[:sid]}"
201
+
202
+ # Dependents
203
+ @sessions = nil
204
+ @phone_numbers = nil
205
+ @short_codes = nil
206
+ end
207
+
208
+ ##
209
+ # Fetch a ServiceInstance
210
+ # @return [ServiceInstance] Fetched ServiceInstance
211
+ def fetch
212
+ params = Twilio::Values.of({})
213
+
214
+ payload = @version.fetch(
215
+ 'GET',
216
+ @uri,
217
+ params,
218
+ )
219
+
220
+ ServiceInstance.new(
221
+ @version,
222
+ payload,
223
+ sid: @solution[:sid],
224
+ )
225
+ end
226
+
227
+ ##
228
+ # Deletes the ServiceInstance
229
+ # @return [Boolean] true if delete succeeds, true otherwise
230
+ def delete
231
+ @version.delete('delete', @uri)
232
+ end
233
+
234
+ ##
235
+ # Update the ServiceInstance
236
+ # @param [String] friendly_name A human readable description of this resource, up
237
+ # to 64 characters.
238
+ # @param [Boolean] auto_create Boolean flag specifying whether to create threads
239
+ # when a user communticates out of band.
240
+ # @param [String] callback_url The URL Twilio will request for callback
241
+ # notifications.
242
+ # @return [ServiceInstance] Updated ServiceInstance
243
+ def update(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
244
+ data = Twilio::Values.of({
245
+ 'FriendlyName' => friendly_name,
246
+ 'AutoCreate' => auto_create,
247
+ 'CallbackUrl' => callback_url,
248
+ })
249
+
250
+ payload = @version.update(
251
+ 'POST',
252
+ @uri,
253
+ data: data,
254
+ )
255
+
256
+ ServiceInstance.new(
257
+ @version,
258
+ payload,
259
+ sid: @solution[:sid],
260
+ )
261
+ end
262
+
263
+ ##
264
+ # Access the sessions
265
+ # @return [SessionList]
266
+ # @return [SessionContext] if sid was passed.
267
+ def sessions(sid=:unset)
268
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
269
+
270
+ if sid != :unset
271
+ return SessionContext.new(
272
+ @version,
273
+ @solution[:sid],
274
+ sid,
275
+ )
276
+ end
277
+
278
+ unless @sessions
279
+ @sessions = SessionList.new(
280
+ @version,
281
+ service_sid: @solution[:sid],
282
+ )
283
+ end
284
+
285
+ @sessions
286
+ end
287
+
288
+ ##
289
+ # Access the phone_numbers
290
+ # @return [PhoneNumberList]
291
+ # @return [PhoneNumberContext] if sid was passed.
292
+ def phone_numbers(sid=:unset)
293
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
294
+
295
+ if sid != :unset
296
+ return PhoneNumberContext.new(
297
+ @version,
298
+ @solution[:sid],
299
+ sid,
300
+ )
301
+ end
302
+
303
+ unless @phone_numbers
304
+ @phone_numbers = PhoneNumberList.new(
305
+ @version,
306
+ service_sid: @solution[:sid],
307
+ )
308
+ end
309
+
310
+ @phone_numbers
311
+ end
312
+
313
+ ##
314
+ # Access the short_codes
315
+ # @return [ShortCodeList]
316
+ # @return [ShortCodeContext] if sid was passed.
317
+ def short_codes(sid=:unset)
318
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
319
+
320
+ if sid != :unset
321
+ return ShortCodeContext.new(
322
+ @version,
323
+ @solution[:sid],
324
+ sid,
325
+ )
326
+ end
327
+
328
+ unless @short_codes
329
+ @short_codes = ShortCodeList.new(
330
+ @version,
331
+ service_sid: @solution[:sid],
332
+ )
333
+ end
334
+
335
+ @short_codes
336
+ end
337
+
338
+ ##
339
+ # Provide a user friendly representation
340
+ def to_s
341
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
342
+ "#<Twilio.Preview.Proxy.ServiceContext #{context}>"
343
+ end
344
+ end
345
+
346
+ ##
347
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
348
+ class ServiceInstance < InstanceResource
349
+ ##
350
+ # Initialize the ServiceInstance
351
+ # @param [Version] version Version that contains the resource
352
+ # @param [Hash] payload payload that contains response from Twilio
353
+ # @param [String] sid A 34 character string that uniquely identifies this Service.
354
+ # @return [ServiceInstance] ServiceInstance
355
+ def initialize(version, payload, sid: nil)
356
+ super(version)
357
+
358
+ # Marshaled Properties
359
+ @properties = {
360
+ 'sid' => payload['sid'],
361
+ 'friendly_name' => payload['friendly_name'],
362
+ 'account_sid' => payload['account_sid'],
363
+ 'auto_create' => payload['auto_create'],
364
+ 'callback_url' => payload['callback_url'],
365
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
366
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
367
+ 'url' => payload['url'],
368
+ 'links' => payload['links'],
369
+ }
370
+
371
+ # Context
372
+ @instance_context = nil
373
+ @params = {
374
+ 'sid' => sid || @properties['sid'],
375
+ }
376
+ end
377
+
378
+ ##
379
+ # Generate an instance context for the instance, the context is capable of
380
+ # performing various actions. All instance actions are proxied to the context
381
+ # @return [ServiceContext] ServiceContext for this ServiceInstance
382
+ def context
383
+ unless @instance_context
384
+ @instance_context = ServiceContext.new(
385
+ @version,
386
+ @params['sid'],
387
+ )
388
+ end
389
+ @instance_context
390
+ end
391
+
392
+ ##
393
+ # @return [String] A string that uniquely identifies this Service.
394
+ def sid
395
+ @properties['sid']
396
+ end
397
+
398
+ ##
399
+ # @return [String] A human readable description of this resource
400
+ def friendly_name
401
+ @properties['friendly_name']
402
+ end
403
+
404
+ ##
405
+ # @return [String] Account Sid.
406
+ def account_sid
407
+ @properties['account_sid']
408
+ end
409
+
410
+ ##
411
+ # @return [Boolean] Boolean flag specifying whether to auto-create threads.
412
+ def auto_create
413
+ @properties['auto_create']
414
+ end
415
+
416
+ ##
417
+ # @return [String] URL Twilio will request for callbacks.
418
+ def callback_url
419
+ @properties['callback_url']
420
+ end
421
+
422
+ ##
423
+ # @return [Time] The date this Service was created
424
+ def date_created
425
+ @properties['date_created']
426
+ end
427
+
428
+ ##
429
+ # @return [Time] The date this Service was updated
430
+ def date_updated
431
+ @properties['date_updated']
432
+ end
433
+
434
+ ##
435
+ # @return [String] The URL of this resource.
436
+ def url
437
+ @properties['url']
438
+ end
439
+
440
+ ##
441
+ # @return [String] Nested resource URLs.
442
+ def links
443
+ @properties['links']
444
+ end
445
+
446
+ ##
447
+ # Fetch a ServiceInstance
448
+ # @return [ServiceInstance] Fetched ServiceInstance
449
+ def fetch
450
+ context.fetch
451
+ end
452
+
453
+ ##
454
+ # Deletes the ServiceInstance
455
+ # @return [Boolean] true if delete succeeds, true otherwise
456
+ def delete
457
+ context.delete
458
+ end
459
+
460
+ ##
461
+ # Update the ServiceInstance
462
+ # @param [String] friendly_name A human readable description of this resource, up
463
+ # to 64 characters.
464
+ # @param [Boolean] auto_create Boolean flag specifying whether to create threads
465
+ # when a user communticates out of band.
466
+ # @param [String] callback_url The URL Twilio will request for callback
467
+ # notifications.
468
+ # @return [ServiceInstance] Updated ServiceInstance
469
+ def update(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
470
+ context.update(
471
+ friendly_name: friendly_name,
472
+ auto_create: auto_create,
473
+ callback_url: callback_url,
474
+ )
475
+ end
476
+
477
+ ##
478
+ # Access the sessions
479
+ # @return [sessions] sessions
480
+ def sessions
481
+ context.sessions
482
+ end
483
+
484
+ ##
485
+ # Access the phone_numbers
486
+ # @return [phone_numbers] phone_numbers
487
+ def phone_numbers
488
+ context.phone_numbers
489
+ end
490
+
491
+ ##
492
+ # Access the short_codes
493
+ # @return [short_codes] short_codes
494
+ def short_codes
495
+ context.short_codes
496
+ end
497
+
498
+ ##
499
+ # Provide a user friendly representation
500
+ def to_s
501
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
502
+ "<Twilio.Preview.Proxy.ServiceInstance #{values}>"
503
+ end
504
+ end
505
+ end
506
+ end
507
+ end
508
+ end