twilio-ruby 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,442 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Notify < Domain
10
+ class V1 < Version
11
+ class ServiceContext < InstanceContext
12
+ class UserContext < InstanceContext
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class UserBindingList < ListResource
16
+ ##
17
+ # Initialize the UserBindingList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] service_sid The service_sid
20
+ # @param [String] identity The identity
21
+ # @return [UserBindingList] UserBindingList
22
+ def initialize(version, service_sid: nil, identity: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {
27
+ service_sid: service_sid,
28
+ identity: identity
29
+ }
30
+ @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}/Bindings"
31
+ end
32
+
33
+ ##
34
+ # Retrieve a single page of UserBindingInstance records from the API.
35
+ # Request is executed immediately.
36
+ # @param [user_binding.BindingType] binding_type The binding_type
37
+ # @param [String] address The address
38
+ # @param [String] tag The tag
39
+ # @param [String] notification_protocol_version The notification_protocol_version
40
+ # @param [String] credential_sid The credential_sid
41
+ # @param [String] endpoint The endpoint
42
+ # @return [UserBindingInstance] Newly created UserBindingInstance
43
+ def create(binding_type: nil, address: nil, tag: :unset, notification_protocol_version: :unset, credential_sid: :unset, endpoint: :unset)
44
+ data = Twilio::Values.of({
45
+ 'BindingType' => binding_type,
46
+ 'Address' => address,
47
+ 'Tag' => tag,
48
+ 'NotificationProtocolVersion' => notification_protocol_version,
49
+ 'CredentialSid' => credential_sid,
50
+ 'Endpoint' => endpoint,
51
+ })
52
+
53
+ payload = @version.create(
54
+ 'POST',
55
+ @uri,
56
+ data: data
57
+ )
58
+
59
+ UserBindingInstance.new(
60
+ @version,
61
+ payload,
62
+ service_sid: @solution[:service_sid],
63
+ identity: @solution[:identity],
64
+ )
65
+ end
66
+
67
+ ##
68
+ # Lists UserBindingInstance records from the API as a list.
69
+ # Unlike stream(), this operation is eager and will load `limit` records into
70
+ # memory before returning.
71
+ # @param [Date] start_date The start_date
72
+ # @param [Date] end_date The end_date
73
+ # @param [String] tag The tag
74
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
75
+ # guarantees to never return more than limit. Default is no limit
76
+ # @param [Integer] page_size Number of records to fetch per request, when
77
+ # not set will use the default value of 50 records. If no page_size is defined
78
+ # but a limit is defined, stream() will attempt to read the limit with the most
79
+ # efficient page size, i.e. min(limit, 1000)
80
+ # @return [Array] Array of up to limit results
81
+ def list(start_date: :unset, end_date: :unset, tag: :unset, limit: nil, page_size: nil)
82
+ self.stream(
83
+ start_date: start_date,
84
+ end_date: end_date,
85
+ tag: tag,
86
+ limit: limit,
87
+ page_size: page_size
88
+ ).entries
89
+ end
90
+
91
+ ##
92
+ # Streams UserBindingInstance records from the API as an Enumerable.
93
+ # This operation lazily loads records as efficiently as possible until the limit
94
+ # is reached.
95
+ # @param [Date] start_date The start_date
96
+ # @param [Date] end_date The end_date
97
+ # @param [String] tag The tag
98
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
99
+ # guarantees to never return more than limit. Default is no limit.
100
+ # @param [Integer] page_size Number of records to fetch per request, when
101
+ # not set will use the default value of 50 records. If no page_size is defined
102
+ # but a limit is defined, stream() will attempt to read the limit with the most
103
+ # efficient page size, i.e. min(limit, 1000)
104
+ # @return [Enumerable] Enumerable that will yield up to limit results
105
+ def stream(start_date: :unset, end_date: :unset, tag: :unset, limit: nil, page_size: nil)
106
+ limits = @version.read_limits(limit, page_size)
107
+
108
+ page = self.page(
109
+ start_date: start_date,
110
+ end_date: end_date,
111
+ tag: tag,
112
+ page_size: limits[:page_size],
113
+ )
114
+
115
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
116
+ end
117
+
118
+ ##
119
+ # When passed a block, yields UserBindingInstance records from the API.
120
+ # This operation lazily loads records as efficiently as possible until the limit
121
+ # is reached.
122
+ def each
123
+ limits = @version.read_limits
124
+
125
+ page = self.page(
126
+ page_size: limits[:page_size],
127
+ )
128
+
129
+ @version.stream(page,
130
+ limit: limits[:limit],
131
+ page_limit: limits[:page_limit]).each {|x| yield x}
132
+ end
133
+
134
+ ##
135
+ # Retrieve a single page of UserBindingInstance records from the API.
136
+ # Request is executed immediately.
137
+ # @param [Date] start_date The start_date
138
+ # @param [Date] end_date The end_date
139
+ # @param [String] tag The tag
140
+ # @param [String] page_token PageToken provided by the API
141
+ # @param [Integer] page_number Page Number, this value is simply for client state
142
+ # @param [Integer] page_size Number of records to return, defaults to 50
143
+ # @return [Page] Page of UserBindingInstance
144
+ def page(start_date: :unset, end_date: :unset, tag: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
145
+ params = Twilio::Values.of({
146
+ 'StartDate' => Twilio.serialize_iso8601_date(start_date),
147
+ 'EndDate' => Twilio.serialize_iso8601_date(end_date),
148
+ 'Tag' => tag,
149
+ 'PageToken' => page_token,
150
+ 'Page' => page_number,
151
+ 'PageSize' => page_size,
152
+ })
153
+ response = @version.page(
154
+ 'GET',
155
+ @uri,
156
+ params
157
+ )
158
+ UserBindingPage.new(@version, response, @solution)
159
+ end
160
+
161
+ ##
162
+ # Retrieve a single page of UserBindingInstance records from the API.
163
+ # Request is executed immediately.
164
+ # @param [String] target_url API-generated URL for the requested results page
165
+ # @return [Page] Page of UserBindingInstance
166
+ def get_page(target_url)
167
+ response = @version.domain.request(
168
+ 'GET',
169
+ target_url
170
+ )
171
+ UserBindingPage.new(@version, response, @solution)
172
+ end
173
+
174
+ ##
175
+ # Provide a user friendly representation
176
+ def to_s
177
+ '#<Twilio.Notify.V1.UserBindingList>'
178
+ end
179
+ end
180
+
181
+ ##
182
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
183
+ class UserBindingPage < Page
184
+ ##
185
+ # Initialize the UserBindingPage
186
+ # @param [Version] version Version that contains the resource
187
+ # @param [Response] response Response from the API
188
+ # @param [Hash] solution Path solution for the resource
189
+ # @return [UserBindingPage] UserBindingPage
190
+ def initialize(version, response, solution)
191
+ super(version, response)
192
+
193
+ # Path Solution
194
+ @solution = solution
195
+ end
196
+
197
+ ##
198
+ # Build an instance of UserBindingInstance
199
+ # @param [Hash] payload Payload response from the API
200
+ # @return [UserBindingInstance] UserBindingInstance
201
+ def get_instance(payload)
202
+ UserBindingInstance.new(
203
+ @version,
204
+ payload,
205
+ service_sid: @solution[:service_sid],
206
+ identity: @solution[:identity],
207
+ )
208
+ end
209
+
210
+ ##
211
+ # Provide a user friendly representation
212
+ def to_s
213
+ '<Twilio.Notify.V1.UserBindingPage>'
214
+ end
215
+ end
216
+
217
+ ##
218
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
219
+ class UserBindingContext < InstanceContext
220
+ ##
221
+ # Initialize the UserBindingContext
222
+ # @param [Version] version Version that contains the resource
223
+ # @param [String] service_sid The service_sid
224
+ # @param [String] identity The identity
225
+ # @param [String] sid The sid
226
+ # @return [UserBindingContext] UserBindingContext
227
+ def initialize(version, service_sid, identity, sid)
228
+ super(version)
229
+
230
+ # Path Solution
231
+ @solution = {
232
+ service_sid: service_sid,
233
+ identity: identity,
234
+ sid: sid,
235
+ }
236
+ @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}/Bindings/#{@solution[:sid]}"
237
+ end
238
+
239
+ ##
240
+ # Fetch a UserBindingInstance
241
+ # @return [UserBindingInstance] Fetched UserBindingInstance
242
+ def fetch
243
+ params = Twilio::Values.of({})
244
+
245
+ payload = @version.fetch(
246
+ 'GET',
247
+ @uri,
248
+ params,
249
+ )
250
+
251
+ UserBindingInstance.new(
252
+ @version,
253
+ payload,
254
+ service_sid: @solution[:service_sid],
255
+ identity: @solution[:identity],
256
+ sid: @solution[:sid],
257
+ )
258
+ end
259
+
260
+ ##
261
+ # Deletes the UserBindingInstance
262
+ # @return [Boolean] true if delete succeeds, true otherwise
263
+ def delete
264
+ @version.delete('delete', @uri)
265
+ end
266
+
267
+ ##
268
+ # Provide a user friendly representation
269
+ def to_s
270
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
271
+ "#<Twilio.Notify.V1.UserBindingContext #{context}>"
272
+ end
273
+ end
274
+
275
+ ##
276
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
277
+ class UserBindingInstance < InstanceResource
278
+ ##
279
+ # Initialize the UserBindingInstance
280
+ # @param [Version] version Version that contains the resource
281
+ # @param [Hash] payload payload that contains response from Twilio
282
+ # @param [String] service_sid The service_sid
283
+ # @param [String] identity The identity
284
+ # @param [String] sid The sid
285
+ # @return [UserBindingInstance] UserBindingInstance
286
+ def initialize(version, payload, service_sid: nil, identity: nil, sid: nil)
287
+ super(version)
288
+
289
+ # Marshaled Properties
290
+ @properties = {
291
+ 'sid' => payload['sid'],
292
+ 'account_sid' => payload['account_sid'],
293
+ 'service_sid' => payload['service_sid'],
294
+ 'credential_sid' => payload['credential_sid'],
295
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
296
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
297
+ 'notification_protocol_version' => payload['notification_protocol_version'],
298
+ 'endpoint' => payload['endpoint'],
299
+ 'identity' => payload['identity'],
300
+ 'binding_type' => payload['binding_type'],
301
+ 'address' => payload['address'],
302
+ 'tags' => payload['tags'],
303
+ 'url' => payload['url'],
304
+ 'links' => payload['links'],
305
+ }
306
+
307
+ # Context
308
+ @instance_context = nil
309
+ @params = {
310
+ 'service_sid' => service_sid,
311
+ 'identity' => identity,
312
+ 'sid' => sid || @properties['sid'],
313
+ }
314
+ end
315
+
316
+ ##
317
+ # Generate an instance context for the instance, the context is capable of
318
+ # performing various actions. All instance actions are proxied to the context
319
+ # @return [UserBindingContext] UserBindingContext for this UserBindingInstance
320
+ def context
321
+ unless @instance_context
322
+ @instance_context = UserBindingContext.new(
323
+ @version,
324
+ @params['service_sid'],
325
+ @params['identity'],
326
+ @params['sid'],
327
+ )
328
+ end
329
+ @instance_context
330
+ end
331
+
332
+ ##
333
+ # @return [String] The sid
334
+ def sid
335
+ @properties['sid']
336
+ end
337
+
338
+ ##
339
+ # @return [String] The account_sid
340
+ def account_sid
341
+ @properties['account_sid']
342
+ end
343
+
344
+ ##
345
+ # @return [String] The service_sid
346
+ def service_sid
347
+ @properties['service_sid']
348
+ end
349
+
350
+ ##
351
+ # @return [String] The credential_sid
352
+ def credential_sid
353
+ @properties['credential_sid']
354
+ end
355
+
356
+ ##
357
+ # @return [Time] The date_created
358
+ def date_created
359
+ @properties['date_created']
360
+ end
361
+
362
+ ##
363
+ # @return [Time] The date_updated
364
+ def date_updated
365
+ @properties['date_updated']
366
+ end
367
+
368
+ ##
369
+ # @return [String] The notification_protocol_version
370
+ def notification_protocol_version
371
+ @properties['notification_protocol_version']
372
+ end
373
+
374
+ ##
375
+ # @return [String] The endpoint
376
+ def endpoint
377
+ @properties['endpoint']
378
+ end
379
+
380
+ ##
381
+ # @return [String] The identity
382
+ def identity
383
+ @properties['identity']
384
+ end
385
+
386
+ ##
387
+ # @return [String] The binding_type
388
+ def binding_type
389
+ @properties['binding_type']
390
+ end
391
+
392
+ ##
393
+ # @return [String] The address
394
+ def address
395
+ @properties['address']
396
+ end
397
+
398
+ ##
399
+ # @return [String] The tags
400
+ def tags
401
+ @properties['tags']
402
+ end
403
+
404
+ ##
405
+ # @return [String] The url
406
+ def url
407
+ @properties['url']
408
+ end
409
+
410
+ ##
411
+ # @return [String] The links
412
+ def links
413
+ @properties['links']
414
+ end
415
+
416
+ ##
417
+ # Fetch a UserBindingInstance
418
+ # @return [UserBindingInstance] Fetched UserBindingInstance
419
+ def fetch
420
+ context.fetch
421
+ end
422
+
423
+ ##
424
+ # Deletes the UserBindingInstance
425
+ # @return [Boolean] true if delete succeeds, true otherwise
426
+ def delete
427
+ context.delete
428
+ end
429
+
430
+ ##
431
+ # Provide a user friendly representation
432
+ def to_s
433
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
434
+ "<Twilio.Notify.V1.UserBindingInstance #{values}>"
435
+ end
436
+ end
437
+ end
438
+ end
439
+ end
440
+ end
441
+ end
442
+ end
@@ -0,0 +1,453 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Notify < Domain
10
+ class V1 < Version
11
+ class ServiceContext < InstanceContext
12
+ ##
13
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
14
+ class UserList < ListResource
15
+ ##
16
+ # Initialize the UserList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] service_sid The service_sid
19
+ # @return [UserList] UserList
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]}/Users"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of UserInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] identity The identity
34
+ # @param [String] segment The segment
35
+ # @return [UserInstance] Newly created UserInstance
36
+ def create(identity: nil, segment: :unset)
37
+ data = Twilio::Values.of({
38
+ 'Identity' => identity,
39
+ 'Segment' => segment,
40
+ })
41
+
42
+ payload = @version.create(
43
+ 'POST',
44
+ @uri,
45
+ data: data
46
+ )
47
+
48
+ UserInstance.new(
49
+ @version,
50
+ payload,
51
+ service_sid: @solution[:service_sid],
52
+ )
53
+ end
54
+
55
+ ##
56
+ # Lists UserInstance records from the API as a list.
57
+ # Unlike stream(), this operation is eager and will load `limit` records into
58
+ # memory before returning.
59
+ # @param [String] identity The identity
60
+ # @param [String] segment The segment
61
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
62
+ # guarantees to never return more than limit. Default is no limit
63
+ # @param [Integer] page_size Number of records to fetch per request, when
64
+ # not set will use the default value of 50 records. If no page_size is defined
65
+ # but a limit is defined, stream() will attempt to read the limit with the most
66
+ # efficient page size, i.e. min(limit, 1000)
67
+ # @return [Array] Array of up to limit results
68
+ def list(identity: :unset, segment: :unset, limit: nil, page_size: nil)
69
+ self.stream(
70
+ identity: identity,
71
+ segment: segment,
72
+ limit: limit,
73
+ page_size: page_size
74
+ ).entries
75
+ end
76
+
77
+ ##
78
+ # Streams UserInstance records from the API as an Enumerable.
79
+ # This operation lazily loads records as efficiently as possible until the limit
80
+ # is reached.
81
+ # @param [String] identity The identity
82
+ # @param [String] segment The segment
83
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
84
+ # guarantees to never return more than limit. Default is no limit.
85
+ # @param [Integer] page_size Number of records to fetch per request, when
86
+ # not set will use the default value of 50 records. If no page_size is defined
87
+ # but a limit is defined, stream() will attempt to read the limit with the most
88
+ # efficient page size, i.e. min(limit, 1000)
89
+ # @return [Enumerable] Enumerable that will yield up to limit results
90
+ def stream(identity: :unset, segment: :unset, limit: nil, page_size: nil)
91
+ limits = @version.read_limits(limit, page_size)
92
+
93
+ page = self.page(
94
+ identity: identity,
95
+ segment: segment,
96
+ page_size: limits[:page_size],
97
+ )
98
+
99
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
100
+ end
101
+
102
+ ##
103
+ # When passed a block, yields UserInstance records from the API.
104
+ # This operation lazily loads records as efficiently as possible until the limit
105
+ # is reached.
106
+ def each
107
+ limits = @version.read_limits
108
+
109
+ page = self.page(
110
+ page_size: limits[:page_size],
111
+ )
112
+
113
+ @version.stream(page,
114
+ limit: limits[:limit],
115
+ page_limit: limits[:page_limit]).each {|x| yield x}
116
+ end
117
+
118
+ ##
119
+ # Retrieve a single page of UserInstance records from the API.
120
+ # Request is executed immediately.
121
+ # @param [String] identity The identity
122
+ # @param [String] segment The segment
123
+ # @param [String] page_token PageToken provided by the API
124
+ # @param [Integer] page_number Page Number, this value is simply for client state
125
+ # @param [Integer] page_size Number of records to return, defaults to 50
126
+ # @return [Page] Page of UserInstance
127
+ def page(identity: :unset, segment: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
128
+ params = Twilio::Values.of({
129
+ 'Identity' => identity,
130
+ 'Segment' => segment,
131
+ 'PageToken' => page_token,
132
+ 'Page' => page_number,
133
+ 'PageSize' => page_size,
134
+ })
135
+ response = @version.page(
136
+ 'GET',
137
+ @uri,
138
+ params
139
+ )
140
+ UserPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Retrieve a single page of UserInstance records from the API.
145
+ # Request is executed immediately.
146
+ # @param [String] target_url API-generated URL for the requested results page
147
+ # @return [Page] Page of UserInstance
148
+ def get_page(target_url)
149
+ response = @version.domain.request(
150
+ 'GET',
151
+ target_url
152
+ )
153
+ UserPage.new(@version, response, @solution)
154
+ end
155
+
156
+ ##
157
+ # Provide a user friendly representation
158
+ def to_s
159
+ '#<Twilio.Notify.V1.UserList>'
160
+ end
161
+ end
162
+
163
+ ##
164
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
165
+ class UserPage < Page
166
+ ##
167
+ # Initialize the UserPage
168
+ # @param [Version] version Version that contains the resource
169
+ # @param [Response] response Response from the API
170
+ # @param [Hash] solution Path solution for the resource
171
+ # @return [UserPage] UserPage
172
+ def initialize(version, response, solution)
173
+ super(version, response)
174
+
175
+ # Path Solution
176
+ @solution = solution
177
+ end
178
+
179
+ ##
180
+ # Build an instance of UserInstance
181
+ # @param [Hash] payload Payload response from the API
182
+ # @return [UserInstance] UserInstance
183
+ def get_instance(payload)
184
+ UserInstance.new(
185
+ @version,
186
+ payload,
187
+ service_sid: @solution[:service_sid],
188
+ )
189
+ end
190
+
191
+ ##
192
+ # Provide a user friendly representation
193
+ def to_s
194
+ '<Twilio.Notify.V1.UserPage>'
195
+ end
196
+ end
197
+
198
+ ##
199
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
200
+ class UserContext < InstanceContext
201
+ ##
202
+ # Initialize the UserContext
203
+ # @param [Version] version Version that contains the resource
204
+ # @param [String] service_sid The service_sid
205
+ # @param [String] identity The identity
206
+ # @return [UserContext] UserContext
207
+ def initialize(version, service_sid, identity)
208
+ super(version)
209
+
210
+ # Path Solution
211
+ @solution = {
212
+ service_sid: service_sid,
213
+ identity: identity,
214
+ }
215
+ @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}"
216
+
217
+ # Dependents
218
+ @bindings = nil
219
+ @segment_memberships = nil
220
+ end
221
+
222
+ ##
223
+ # Deletes the UserInstance
224
+ # @return [Boolean] true if delete succeeds, true otherwise
225
+ def delete
226
+ @version.delete('delete', @uri)
227
+ end
228
+
229
+ ##
230
+ # Fetch a UserInstance
231
+ # @return [UserInstance] Fetched UserInstance
232
+ def fetch
233
+ params = Twilio::Values.of({})
234
+
235
+ payload = @version.fetch(
236
+ 'GET',
237
+ @uri,
238
+ params,
239
+ )
240
+
241
+ UserInstance.new(
242
+ @version,
243
+ payload,
244
+ service_sid: @solution[:service_sid],
245
+ identity: @solution[:identity],
246
+ )
247
+ end
248
+
249
+ ##
250
+ # Access the bindings
251
+ # @return [UserBindingList]
252
+ # @return [UserBindingContext] if sid was passed.
253
+ def bindings(sid=:unset)
254
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
255
+
256
+ if sid != :unset
257
+ return UserBindingContext.new(
258
+ @version,
259
+ @solution[:service_sid],
260
+ @solution[:identity],
261
+ sid,
262
+ )
263
+ end
264
+
265
+ unless @bindings
266
+ @bindings = UserBindingList.new(
267
+ @version,
268
+ service_sid: @solution[:service_sid],
269
+ identity: @solution[:identity],
270
+ )
271
+ end
272
+
273
+ @bindings
274
+ end
275
+
276
+ ##
277
+ # Access the segment_memberships
278
+ # @return [SegmentMembershipList]
279
+ # @return [SegmentMembershipContext] if segment was passed.
280
+ def segment_memberships(segment=:unset)
281
+ raise ArgumentError, 'segment cannot be nil' if segment.nil?
282
+
283
+ if segment != :unset
284
+ return SegmentMembershipContext.new(
285
+ @version,
286
+ @solution[:service_sid],
287
+ @solution[:identity],
288
+ segment,
289
+ )
290
+ end
291
+
292
+ unless @segment_memberships
293
+ @segment_memberships = SegmentMembershipList.new(
294
+ @version,
295
+ service_sid: @solution[:service_sid],
296
+ identity: @solution[:identity],
297
+ )
298
+ end
299
+
300
+ @segment_memberships
301
+ end
302
+
303
+ ##
304
+ # Provide a user friendly representation
305
+ def to_s
306
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
307
+ "#<Twilio.Notify.V1.UserContext #{context}>"
308
+ end
309
+ end
310
+
311
+ ##
312
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
313
+ class UserInstance < InstanceResource
314
+ ##
315
+ # Initialize the UserInstance
316
+ # @param [Version] version Version that contains the resource
317
+ # @param [Hash] payload payload that contains response from Twilio
318
+ # @param [String] service_sid The service_sid
319
+ # @param [String] identity The identity
320
+ # @return [UserInstance] UserInstance
321
+ def initialize(version, payload, service_sid: nil, identity: nil)
322
+ super(version)
323
+
324
+ # Marshaled Properties
325
+ @properties = {
326
+ 'sid' => payload['sid'],
327
+ 'account_sid' => payload['account_sid'],
328
+ 'service_sid' => payload['service_sid'],
329
+ 'identity' => payload['identity'],
330
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
331
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
332
+ 'segments' => payload['segments'],
333
+ 'url' => payload['url'],
334
+ 'links' => payload['links'],
335
+ }
336
+
337
+ # Context
338
+ @instance_context = nil
339
+ @params = {
340
+ 'service_sid' => service_sid,
341
+ 'identity' => identity || @properties['identity'],
342
+ }
343
+ end
344
+
345
+ ##
346
+ # Generate an instance context for the instance, the context is capable of
347
+ # performing various actions. All instance actions are proxied to the context
348
+ # @return [UserContext] UserContext for this UserInstance
349
+ def context
350
+ unless @instance_context
351
+ @instance_context = UserContext.new(
352
+ @version,
353
+ @params['service_sid'],
354
+ @params['identity'],
355
+ )
356
+ end
357
+ @instance_context
358
+ end
359
+
360
+ ##
361
+ # @return [String] The sid
362
+ def sid
363
+ @properties['sid']
364
+ end
365
+
366
+ ##
367
+ # @return [String] The account_sid
368
+ def account_sid
369
+ @properties['account_sid']
370
+ end
371
+
372
+ ##
373
+ # @return [String] The service_sid
374
+ def service_sid
375
+ @properties['service_sid']
376
+ end
377
+
378
+ ##
379
+ # @return [String] The identity
380
+ def identity
381
+ @properties['identity']
382
+ end
383
+
384
+ ##
385
+ # @return [Time] The date_created
386
+ def date_created
387
+ @properties['date_created']
388
+ end
389
+
390
+ ##
391
+ # @return [Time] The date_updated
392
+ def date_updated
393
+ @properties['date_updated']
394
+ end
395
+
396
+ ##
397
+ # @return [String] The segments
398
+ def segments
399
+ @properties['segments']
400
+ end
401
+
402
+ ##
403
+ # @return [String] The url
404
+ def url
405
+ @properties['url']
406
+ end
407
+
408
+ ##
409
+ # @return [String] The links
410
+ def links
411
+ @properties['links']
412
+ end
413
+
414
+ ##
415
+ # Deletes the UserInstance
416
+ # @return [Boolean] true if delete succeeds, true otherwise
417
+ def delete
418
+ context.delete
419
+ end
420
+
421
+ ##
422
+ # Fetch a UserInstance
423
+ # @return [UserInstance] Fetched UserInstance
424
+ def fetch
425
+ context.fetch
426
+ end
427
+
428
+ ##
429
+ # Access the bindings
430
+ # @return [bindings] bindings
431
+ def bindings
432
+ context.bindings
433
+ end
434
+
435
+ ##
436
+ # Access the segment_memberships
437
+ # @return [segment_memberships] segment_memberships
438
+ def segment_memberships
439
+ context.segment_memberships
440
+ end
441
+
442
+ ##
443
+ # Provide a user friendly representation
444
+ def to_s
445
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
446
+ "<Twilio.Notify.V1.UserInstance #{values}>"
447
+ end
448
+ end
449
+ end
450
+ end
451
+ end
452
+ end
453
+ end