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,647 @@
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
+ ##
12
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
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
+ # Retrieve a single page of ServiceInstance records from the API.
28
+ # Request is executed immediately.
29
+ # @param [String] friendly_name The friendly_name
30
+ # @param [String] apn_credential_sid The apn_credential_sid
31
+ # @param [String] gcm_credential_sid The gcm_credential_sid
32
+ # @param [String] messaging_service_sid The messaging_service_sid
33
+ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id
34
+ # @param [String] default_apn_notification_protocol_version The
35
+ # default_apn_notification_protocol_version
36
+ # @param [String] default_gcm_notification_protocol_version The
37
+ # default_gcm_notification_protocol_version
38
+ # @param [String] fcm_credential_sid The fcm_credential_sid
39
+ # @param [String] default_fcm_notification_protocol_version The
40
+ # default_fcm_notification_protocol_version
41
+ # @param [Boolean] log_enabled The log_enabled
42
+ # @param [String] alexa_skill_id The alexa_skill_id
43
+ # @param [String] default_alexa_notification_protocol_version The
44
+ # default_alexa_notification_protocol_version
45
+ # @return [ServiceInstance] Newly created ServiceInstance
46
+ def create(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset)
47
+ data = Twilio::Values.of({
48
+ 'FriendlyName' => friendly_name,
49
+ 'ApnCredentialSid' => apn_credential_sid,
50
+ 'GcmCredentialSid' => gcm_credential_sid,
51
+ 'MessagingServiceSid' => messaging_service_sid,
52
+ 'FacebookMessengerPageId' => facebook_messenger_page_id,
53
+ 'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version,
54
+ 'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version,
55
+ 'FcmCredentialSid' => fcm_credential_sid,
56
+ 'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version,
57
+ 'LogEnabled' => log_enabled,
58
+ 'AlexaSkillId' => alexa_skill_id,
59
+ 'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version,
60
+ })
61
+
62
+ payload = @version.create(
63
+ 'POST',
64
+ @uri,
65
+ data: data
66
+ )
67
+
68
+ ServiceInstance.new(
69
+ @version,
70
+ payload,
71
+ )
72
+ end
73
+
74
+ ##
75
+ # Lists ServiceInstance records from the API as a list.
76
+ # Unlike stream(), this operation is eager and will load `limit` records into
77
+ # memory before returning.
78
+ # @param [String] friendly_name The friendly_name
79
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
80
+ # guarantees to never return more than limit. Default is no limit
81
+ # @param [Integer] page_size Number of records to fetch per request, when
82
+ # not set will use the default value of 50 records. If no page_size is defined
83
+ # but a limit is defined, stream() will attempt to read the limit with the most
84
+ # efficient page size, i.e. min(limit, 1000)
85
+ # @return [Array] Array of up to limit results
86
+ def list(friendly_name: :unset, limit: nil, page_size: nil)
87
+ self.stream(
88
+ friendly_name: friendly_name,
89
+ limit: limit,
90
+ page_size: page_size
91
+ ).entries
92
+ end
93
+
94
+ ##
95
+ # Streams ServiceInstance records from the API as an Enumerable.
96
+ # This operation lazily loads records as efficiently as possible until the limit
97
+ # is reached.
98
+ # @param [String] friendly_name The friendly_name
99
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
100
+ # guarantees to never return more than limit. Default is no limit.
101
+ # @param [Integer] page_size Number of records to fetch per request, when
102
+ # not set will use the default value of 50 records. If no page_size is defined
103
+ # but a limit is defined, stream() will attempt to read the limit with the most
104
+ # efficient page size, i.e. min(limit, 1000)
105
+ # @return [Enumerable] Enumerable that will yield up to limit results
106
+ def stream(friendly_name: :unset, limit: nil, page_size: nil)
107
+ limits = @version.read_limits(limit, page_size)
108
+
109
+ page = self.page(
110
+ friendly_name: friendly_name,
111
+ page_size: limits[:page_size],
112
+ )
113
+
114
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
115
+ end
116
+
117
+ ##
118
+ # When passed a block, yields ServiceInstance records from the API.
119
+ # This operation lazily loads records as efficiently as possible until the limit
120
+ # is reached.
121
+ def each
122
+ limits = @version.read_limits
123
+
124
+ page = self.page(
125
+ page_size: limits[:page_size],
126
+ )
127
+
128
+ @version.stream(page,
129
+ limit: limits[:limit],
130
+ page_limit: limits[:page_limit]).each {|x| yield x}
131
+ end
132
+
133
+ ##
134
+ # Retrieve a single page of ServiceInstance records from the API.
135
+ # Request is executed immediately.
136
+ # @param [String] friendly_name The friendly_name
137
+ # @param [String] page_token PageToken provided by the API
138
+ # @param [Integer] page_number Page Number, this value is simply for client state
139
+ # @param [Integer] page_size Number of records to return, defaults to 50
140
+ # @return [Page] Page of ServiceInstance
141
+ def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
142
+ params = Twilio::Values.of({
143
+ 'FriendlyName' => friendly_name,
144
+ 'PageToken' => page_token,
145
+ 'Page' => page_number,
146
+ 'PageSize' => page_size,
147
+ })
148
+ response = @version.page(
149
+ 'GET',
150
+ @uri,
151
+ params
152
+ )
153
+ ServicePage.new(@version, response, @solution)
154
+ end
155
+
156
+ ##
157
+ # Retrieve a single page of ServiceInstance records from the API.
158
+ # Request is executed immediately.
159
+ # @param [String] target_url API-generated URL for the requested results page
160
+ # @return [Page] Page of ServiceInstance
161
+ def get_page(target_url)
162
+ response = @version.domain.request(
163
+ 'GET',
164
+ target_url
165
+ )
166
+ ServicePage.new(@version, response, @solution)
167
+ end
168
+
169
+ ##
170
+ # Provide a user friendly representation
171
+ def to_s
172
+ '#<Twilio.Notify.V1.ServiceList>'
173
+ end
174
+ end
175
+
176
+ ##
177
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
178
+ class ServicePage < Page
179
+ ##
180
+ # Initialize the ServicePage
181
+ # @param [Version] version Version that contains the resource
182
+ # @param [Response] response Response from the API
183
+ # @param [Hash] solution Path solution for the resource
184
+ # @return [ServicePage] ServicePage
185
+ def initialize(version, response, solution)
186
+ super(version, response)
187
+
188
+ # Path Solution
189
+ @solution = solution
190
+ end
191
+
192
+ ##
193
+ # Build an instance of ServiceInstance
194
+ # @param [Hash] payload Payload response from the API
195
+ # @return [ServiceInstance] ServiceInstance
196
+ def get_instance(payload)
197
+ ServiceInstance.new(
198
+ @version,
199
+ payload,
200
+ )
201
+ end
202
+
203
+ ##
204
+ # Provide a user friendly representation
205
+ def to_s
206
+ '<Twilio.Notify.V1.ServicePage>'
207
+ end
208
+ end
209
+
210
+ ##
211
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
212
+ class ServiceContext < InstanceContext
213
+ ##
214
+ # Initialize the ServiceContext
215
+ # @param [Version] version Version that contains the resource
216
+ # @param [String] sid The sid
217
+ # @return [ServiceContext] ServiceContext
218
+ def initialize(version, sid)
219
+ super(version)
220
+
221
+ # Path Solution
222
+ @solution = {
223
+ sid: sid,
224
+ }
225
+ @uri = "/Services/#{@solution[:sid]}"
226
+
227
+ # Dependents
228
+ @bindings = nil
229
+ @notifications = nil
230
+ @users = nil
231
+ @segments = nil
232
+ end
233
+
234
+ ##
235
+ # Deletes the ServiceInstance
236
+ # @return [Boolean] true if delete succeeds, true otherwise
237
+ def delete
238
+ @version.delete('delete', @uri)
239
+ end
240
+
241
+ ##
242
+ # Fetch a ServiceInstance
243
+ # @return [ServiceInstance] Fetched ServiceInstance
244
+ def fetch
245
+ params = Twilio::Values.of({})
246
+
247
+ payload = @version.fetch(
248
+ 'GET',
249
+ @uri,
250
+ params,
251
+ )
252
+
253
+ ServiceInstance.new(
254
+ @version,
255
+ payload,
256
+ sid: @solution[:sid],
257
+ )
258
+ end
259
+
260
+ ##
261
+ # Update the ServiceInstance
262
+ # @param [String] friendly_name The friendly_name
263
+ # @param [String] apn_credential_sid The apn_credential_sid
264
+ # @param [String] gcm_credential_sid The gcm_credential_sid
265
+ # @param [String] messaging_service_sid The messaging_service_sid
266
+ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id
267
+ # @param [String] default_apn_notification_protocol_version The
268
+ # default_apn_notification_protocol_version
269
+ # @param [String] default_gcm_notification_protocol_version The
270
+ # default_gcm_notification_protocol_version
271
+ # @param [String] fcm_credential_sid The fcm_credential_sid
272
+ # @param [String] default_fcm_notification_protocol_version The
273
+ # default_fcm_notification_protocol_version
274
+ # @param [Boolean] log_enabled The log_enabled
275
+ # @param [String] alexa_skill_id The alexa_skill_id
276
+ # @param [String] default_alexa_notification_protocol_version The
277
+ # default_alexa_notification_protocol_version
278
+ # @return [ServiceInstance] Updated ServiceInstance
279
+ def update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset)
280
+ data = Twilio::Values.of({
281
+ 'FriendlyName' => friendly_name,
282
+ 'ApnCredentialSid' => apn_credential_sid,
283
+ 'GcmCredentialSid' => gcm_credential_sid,
284
+ 'MessagingServiceSid' => messaging_service_sid,
285
+ 'FacebookMessengerPageId' => facebook_messenger_page_id,
286
+ 'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version,
287
+ 'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version,
288
+ 'FcmCredentialSid' => fcm_credential_sid,
289
+ 'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version,
290
+ 'LogEnabled' => log_enabled,
291
+ 'AlexaSkillId' => alexa_skill_id,
292
+ 'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version,
293
+ })
294
+
295
+ payload = @version.update(
296
+ 'POST',
297
+ @uri,
298
+ data: data,
299
+ )
300
+
301
+ ServiceInstance.new(
302
+ @version,
303
+ payload,
304
+ sid: @solution[:sid],
305
+ )
306
+ end
307
+
308
+ ##
309
+ # Access the bindings
310
+ # @return [BindingList]
311
+ # @return [BindingContext] if sid was passed.
312
+ def bindings(sid=:unset)
313
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
314
+
315
+ if sid != :unset
316
+ return BindingContext.new(
317
+ @version,
318
+ @solution[:sid],
319
+ sid,
320
+ )
321
+ end
322
+
323
+ unless @bindings
324
+ @bindings = BindingList.new(
325
+ @version,
326
+ service_sid: @solution[:sid],
327
+ )
328
+ end
329
+
330
+ @bindings
331
+ end
332
+
333
+ ##
334
+ # Access the notifications
335
+ # @return [NotificationList]
336
+ # @return [NotificationContext]
337
+ def notifications
338
+ unless @notifications
339
+ @notifications = NotificationList.new(
340
+ @version,
341
+ service_sid: @solution[:sid],
342
+ )
343
+ end
344
+
345
+ @notifications
346
+ end
347
+
348
+ ##
349
+ # Access the users
350
+ # @return [UserList]
351
+ # @return [UserContext] if identity was passed.
352
+ def users(identity=:unset)
353
+ raise ArgumentError, 'identity cannot be nil' if identity.nil?
354
+
355
+ if identity != :unset
356
+ return UserContext.new(
357
+ @version,
358
+ @solution[:sid],
359
+ identity,
360
+ )
361
+ end
362
+
363
+ unless @users
364
+ @users = UserList.new(
365
+ @version,
366
+ service_sid: @solution[:sid],
367
+ )
368
+ end
369
+
370
+ @users
371
+ end
372
+
373
+ ##
374
+ # Access the segments
375
+ # @return [SegmentList]
376
+ # @return [SegmentContext]
377
+ def segments
378
+ unless @segments
379
+ @segments = SegmentList.new(
380
+ @version,
381
+ service_sid: @solution[:sid],
382
+ )
383
+ end
384
+
385
+ @segments
386
+ end
387
+
388
+ ##
389
+ # Provide a user friendly representation
390
+ def to_s
391
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
392
+ "#<Twilio.Notify.V1.ServiceContext #{context}>"
393
+ end
394
+ end
395
+
396
+ ##
397
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
398
+ class ServiceInstance < InstanceResource
399
+ ##
400
+ # Initialize the ServiceInstance
401
+ # @param [Version] version Version that contains the resource
402
+ # @param [Hash] payload payload that contains response from Twilio
403
+ # @param [String] sid The sid
404
+ # @return [ServiceInstance] ServiceInstance
405
+ def initialize(version, payload, sid: nil)
406
+ super(version)
407
+
408
+ # Marshaled Properties
409
+ @properties = {
410
+ 'sid' => payload['sid'],
411
+ 'account_sid' => payload['account_sid'],
412
+ 'friendly_name' => payload['friendly_name'],
413
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
414
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
415
+ 'apn_credential_sid' => payload['apn_credential_sid'],
416
+ 'gcm_credential_sid' => payload['gcm_credential_sid'],
417
+ 'fcm_credential_sid' => payload['fcm_credential_sid'],
418
+ 'messaging_service_sid' => payload['messaging_service_sid'],
419
+ 'facebook_messenger_page_id' => payload['facebook_messenger_page_id'],
420
+ 'default_apn_notification_protocol_version' => payload['default_apn_notification_protocol_version'],
421
+ 'default_gcm_notification_protocol_version' => payload['default_gcm_notification_protocol_version'],
422
+ 'default_fcm_notification_protocol_version' => payload['default_fcm_notification_protocol_version'],
423
+ 'log_enabled' => payload['log_enabled'],
424
+ 'url' => payload['url'],
425
+ 'links' => payload['links'],
426
+ 'alexa_skill_id' => payload['alexa_skill_id'],
427
+ 'default_alexa_notification_protocol_version' => payload['default_alexa_notification_protocol_version'],
428
+ }
429
+
430
+ # Context
431
+ @instance_context = nil
432
+ @params = {
433
+ 'sid' => sid || @properties['sid'],
434
+ }
435
+ end
436
+
437
+ ##
438
+ # Generate an instance context for the instance, the context is capable of
439
+ # performing various actions. All instance actions are proxied to the context
440
+ # @return [ServiceContext] ServiceContext for this ServiceInstance
441
+ def context
442
+ unless @instance_context
443
+ @instance_context = ServiceContext.new(
444
+ @version,
445
+ @params['sid'],
446
+ )
447
+ end
448
+ @instance_context
449
+ end
450
+
451
+ ##
452
+ # @return [String] The sid
453
+ def sid
454
+ @properties['sid']
455
+ end
456
+
457
+ ##
458
+ # @return [String] The account_sid
459
+ def account_sid
460
+ @properties['account_sid']
461
+ end
462
+
463
+ ##
464
+ # @return [String] The friendly_name
465
+ def friendly_name
466
+ @properties['friendly_name']
467
+ end
468
+
469
+ ##
470
+ # @return [Time] The date_created
471
+ def date_created
472
+ @properties['date_created']
473
+ end
474
+
475
+ ##
476
+ # @return [Time] The date_updated
477
+ def date_updated
478
+ @properties['date_updated']
479
+ end
480
+
481
+ ##
482
+ # @return [String] The apn_credential_sid
483
+ def apn_credential_sid
484
+ @properties['apn_credential_sid']
485
+ end
486
+
487
+ ##
488
+ # @return [String] The gcm_credential_sid
489
+ def gcm_credential_sid
490
+ @properties['gcm_credential_sid']
491
+ end
492
+
493
+ ##
494
+ # @return [String] The fcm_credential_sid
495
+ def fcm_credential_sid
496
+ @properties['fcm_credential_sid']
497
+ end
498
+
499
+ ##
500
+ # @return [String] The messaging_service_sid
501
+ def messaging_service_sid
502
+ @properties['messaging_service_sid']
503
+ end
504
+
505
+ ##
506
+ # @return [String] The facebook_messenger_page_id
507
+ def facebook_messenger_page_id
508
+ @properties['facebook_messenger_page_id']
509
+ end
510
+
511
+ ##
512
+ # @return [String] The default_apn_notification_protocol_version
513
+ def default_apn_notification_protocol_version
514
+ @properties['default_apn_notification_protocol_version']
515
+ end
516
+
517
+ ##
518
+ # @return [String] The default_gcm_notification_protocol_version
519
+ def default_gcm_notification_protocol_version
520
+ @properties['default_gcm_notification_protocol_version']
521
+ end
522
+
523
+ ##
524
+ # @return [String] The default_fcm_notification_protocol_version
525
+ def default_fcm_notification_protocol_version
526
+ @properties['default_fcm_notification_protocol_version']
527
+ end
528
+
529
+ ##
530
+ # @return [Boolean] The log_enabled
531
+ def log_enabled
532
+ @properties['log_enabled']
533
+ end
534
+
535
+ ##
536
+ # @return [String] The url
537
+ def url
538
+ @properties['url']
539
+ end
540
+
541
+ ##
542
+ # @return [String] The links
543
+ def links
544
+ @properties['links']
545
+ end
546
+
547
+ ##
548
+ # @return [String] The alexa_skill_id
549
+ def alexa_skill_id
550
+ @properties['alexa_skill_id']
551
+ end
552
+
553
+ ##
554
+ # @return [String] The default_alexa_notification_protocol_version
555
+ def default_alexa_notification_protocol_version
556
+ @properties['default_alexa_notification_protocol_version']
557
+ end
558
+
559
+ ##
560
+ # Deletes the ServiceInstance
561
+ # @return [Boolean] true if delete succeeds, true otherwise
562
+ def delete
563
+ context.delete
564
+ end
565
+
566
+ ##
567
+ # Fetch a ServiceInstance
568
+ # @return [ServiceInstance] Fetched ServiceInstance
569
+ def fetch
570
+ context.fetch
571
+ end
572
+
573
+ ##
574
+ # Update the ServiceInstance
575
+ # @param [String] friendly_name The friendly_name
576
+ # @param [String] apn_credential_sid The apn_credential_sid
577
+ # @param [String] gcm_credential_sid The gcm_credential_sid
578
+ # @param [String] messaging_service_sid The messaging_service_sid
579
+ # @param [String] facebook_messenger_page_id The facebook_messenger_page_id
580
+ # @param [String] default_apn_notification_protocol_version The
581
+ # default_apn_notification_protocol_version
582
+ # @param [String] default_gcm_notification_protocol_version The
583
+ # default_gcm_notification_protocol_version
584
+ # @param [String] fcm_credential_sid The fcm_credential_sid
585
+ # @param [String] default_fcm_notification_protocol_version The
586
+ # default_fcm_notification_protocol_version
587
+ # @param [Boolean] log_enabled The log_enabled
588
+ # @param [String] alexa_skill_id The alexa_skill_id
589
+ # @param [String] default_alexa_notification_protocol_version The
590
+ # default_alexa_notification_protocol_version
591
+ # @return [ServiceInstance] Updated ServiceInstance
592
+ def update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset)
593
+ context.update(
594
+ friendly_name: friendly_name,
595
+ apn_credential_sid: apn_credential_sid,
596
+ gcm_credential_sid: gcm_credential_sid,
597
+ messaging_service_sid: messaging_service_sid,
598
+ facebook_messenger_page_id: facebook_messenger_page_id,
599
+ default_apn_notification_protocol_version: default_apn_notification_protocol_version,
600
+ default_gcm_notification_protocol_version: default_gcm_notification_protocol_version,
601
+ fcm_credential_sid: fcm_credential_sid,
602
+ default_fcm_notification_protocol_version: default_fcm_notification_protocol_version,
603
+ log_enabled: log_enabled,
604
+ alexa_skill_id: alexa_skill_id,
605
+ default_alexa_notification_protocol_version: default_alexa_notification_protocol_version,
606
+ )
607
+ end
608
+
609
+ ##
610
+ # Access the bindings
611
+ # @return [bindings] bindings
612
+ def bindings
613
+ context.bindings
614
+ end
615
+
616
+ ##
617
+ # Access the notifications
618
+ # @return [notifications] notifications
619
+ def notifications
620
+ context.notifications
621
+ end
622
+
623
+ ##
624
+ # Access the users
625
+ # @return [users] users
626
+ def users
627
+ context.users
628
+ end
629
+
630
+ ##
631
+ # Access the segments
632
+ # @return [segments] segments
633
+ def segments
634
+ context.segments
635
+ end
636
+
637
+ ##
638
+ # Provide a user friendly representation
639
+ def to_s
640
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
641
+ "<Twilio.Notify.V1.ServiceInstance #{values}>"
642
+ end
643
+ end
644
+ end
645
+ end
646
+ end
647
+ end