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,549 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Fax < 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 FaxList < ListResource
14
+ ##
15
+ # Initialize the FaxList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [FaxList] FaxList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/Faxes"
24
+ end
25
+
26
+ ##
27
+ # Lists FaxInstance 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 [String] from Filters the returned list to only include faxes sent from
31
+ # the supplied number, given in E.164 format.
32
+ # @param [String] to Filters the returned list to only include faxes sent to the
33
+ # supplied number, given in E.164 format.
34
+ # @param [Time] date_created_on_or_before Filters the returned list to only
35
+ # include faxes created on or before the supplied date, given in ISO 8601 format.
36
+ # @param [Time] date_created_after Filters the returned list to only include faxes
37
+ # created after the supplied date, given in ISO 8601 format.
38
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
39
+ # guarantees to never return more than limit. Default is no limit
40
+ # @param [Integer] page_size Number of records to fetch per request, when
41
+ # not set will use the default value of 50 records. If no page_size is defined
42
+ # but a limit is defined, stream() will attempt to read the limit with the most
43
+ # efficient page size, i.e. min(limit, 1000)
44
+ # @return [Array] Array of up to limit results
45
+ def list(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
46
+ self.stream(
47
+ from: from,
48
+ to: to,
49
+ date_created_on_or_before: date_created_on_or_before,
50
+ date_created_after: date_created_after,
51
+ limit: limit,
52
+ page_size: page_size
53
+ ).entries
54
+ end
55
+
56
+ ##
57
+ # Streams FaxInstance records from the API as an Enumerable.
58
+ # This operation lazily loads records as efficiently as possible until the limit
59
+ # is reached.
60
+ # @param [String] from Filters the returned list to only include faxes sent from
61
+ # the supplied number, given in E.164 format.
62
+ # @param [String] to Filters the returned list to only include faxes sent to the
63
+ # supplied number, given in E.164 format.
64
+ # @param [Time] date_created_on_or_before Filters the returned list to only
65
+ # include faxes created on or before the supplied date, given in ISO 8601 format.
66
+ # @param [Time] date_created_after Filters the returned list to only include faxes
67
+ # created after the supplied date, given in ISO 8601 format.
68
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
69
+ # guarantees to never return more than limit. Default is no limit.
70
+ # @param [Integer] page_size Number of records to fetch per request, when
71
+ # not set will use the default value of 50 records. If no page_size is defined
72
+ # but a limit is defined, stream() will attempt to read the limit with the most
73
+ # efficient page size, i.e. min(limit, 1000)
74
+ # @return [Enumerable] Enumerable that will yield up to limit results
75
+ def stream(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
76
+ limits = @version.read_limits(limit, page_size)
77
+
78
+ page = self.page(
79
+ from: from,
80
+ to: to,
81
+ date_created_on_or_before: date_created_on_or_before,
82
+ date_created_after: date_created_after,
83
+ page_size: limits[:page_size],
84
+ )
85
+
86
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
87
+ end
88
+
89
+ ##
90
+ # When passed a block, yields FaxInstance records from the API.
91
+ # This operation lazily loads records as efficiently as possible until the limit
92
+ # is reached.
93
+ def each
94
+ limits = @version.read_limits
95
+
96
+ page = self.page(
97
+ page_size: limits[:page_size],
98
+ )
99
+
100
+ @version.stream(page,
101
+ limit: limits[:limit],
102
+ page_limit: limits[:page_limit]).each {|x| yield x}
103
+ end
104
+
105
+ ##
106
+ # Retrieve a single page of FaxInstance records from the API.
107
+ # Request is executed immediately.
108
+ # @param [String] from Filters the returned list to only include faxes sent from
109
+ # the supplied number, given in E.164 format.
110
+ # @param [String] to Filters the returned list to only include faxes sent to the
111
+ # supplied number, given in E.164 format.
112
+ # @param [Time] date_created_on_or_before Filters the returned list to only
113
+ # include faxes created on or before the supplied date, given in ISO 8601 format.
114
+ # @param [Time] date_created_after Filters the returned list to only include faxes
115
+ # created after the supplied date, given in ISO 8601 format.
116
+ # @param [String] page_token PageToken provided by the API
117
+ # @param [Integer] page_number Page Number, this value is simply for client state
118
+ # @param [Integer] page_size Number of records to return, defaults to 50
119
+ # @return [Page] Page of FaxInstance
120
+ def page(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
121
+ params = Twilio::Values.of({
122
+ 'From' => from,
123
+ 'To' => to,
124
+ 'DateCreatedOnOrBefore' => Twilio.serialize_iso8601_datetime(date_created_on_or_before),
125
+ 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
126
+ 'PageToken' => page_token,
127
+ 'Page' => page_number,
128
+ 'PageSize' => page_size,
129
+ })
130
+ response = @version.page(
131
+ 'GET',
132
+ @uri,
133
+ params
134
+ )
135
+ FaxPage.new(@version, response, @solution)
136
+ end
137
+
138
+ ##
139
+ # Retrieve a single page of FaxInstance records from the API.
140
+ # Request is executed immediately.
141
+ # @param [String] target_url API-generated URL for the requested results page
142
+ # @return [Page] Page of FaxInstance
143
+ def get_page(target_url)
144
+ response = @version.domain.request(
145
+ 'GET',
146
+ target_url
147
+ )
148
+ FaxPage.new(@version, response, @solution)
149
+ end
150
+
151
+ ##
152
+ # Retrieve a single page of FaxInstance records from the API.
153
+ # Request is executed immediately.
154
+ # @param [String] to The phone number or SIP address to send the fax to,
155
+ # E.164-formatted.
156
+ # @param [String] media_url The URL that Twilio will request to obtain the fax
157
+ # media to send, which must be a PDF file.
158
+ # @param [fax.Quality] quality The quality setting to use for this fax. One of
159
+ # `standard`, `fine` or `superfine`.
160
+ # @param [String] status_callback The URL that Twilio will request when the status
161
+ # of the fax changes.
162
+ # @param [String] from The phone number to use as the caller id, E.164-formatted.
163
+ # If using a phone number, it must be a Twilio number or a verified outgoing
164
+ # caller id for your account. If sending to a SIP address, this can be any
165
+ # alphanumeric string (plus the characters `+`, `_`, `.`, and `-`) to use in the
166
+ # From header of the SIP request.
167
+ # @param [String] sip_auth_username The username to use for authentication when
168
+ # sending to a SIP address.
169
+ # @param [String] sip_auth_password The password to use for authentication when
170
+ # sending to a SIP address.
171
+ # @param [Boolean] store_media Whether or not to store a copy of the sent media on
172
+ # Twilio's servers for later retrieval (defaults to `true`)
173
+ # @return [FaxInstance] Newly created FaxInstance
174
+ def create(to: nil, media_url: nil, quality: :unset, status_callback: :unset, from: :unset, sip_auth_username: :unset, sip_auth_password: :unset, store_media: :unset)
175
+ data = Twilio::Values.of({
176
+ 'To' => to,
177
+ 'MediaUrl' => media_url,
178
+ 'Quality' => quality,
179
+ 'StatusCallback' => status_callback,
180
+ 'From' => from,
181
+ 'SipAuthUsername' => sip_auth_username,
182
+ 'SipAuthPassword' => sip_auth_password,
183
+ 'StoreMedia' => store_media,
184
+ })
185
+
186
+ payload = @version.create(
187
+ 'POST',
188
+ @uri,
189
+ data: data
190
+ )
191
+
192
+ FaxInstance.new(
193
+ @version,
194
+ payload,
195
+ )
196
+ end
197
+
198
+ ##
199
+ # Provide a user friendly representation
200
+ def to_s
201
+ '#<Twilio.Fax.V1.FaxList>'
202
+ end
203
+ end
204
+
205
+ ##
206
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
207
+ class FaxPage < Page
208
+ ##
209
+ # Initialize the FaxPage
210
+ # @param [Version] version Version that contains the resource
211
+ # @param [Response] response Response from the API
212
+ # @param [Hash] solution Path solution for the resource
213
+ # @return [FaxPage] FaxPage
214
+ def initialize(version, response, solution)
215
+ super(version, response)
216
+
217
+ # Path Solution
218
+ @solution = solution
219
+ end
220
+
221
+ ##
222
+ # Build an instance of FaxInstance
223
+ # @param [Hash] payload Payload response from the API
224
+ # @return [FaxInstance] FaxInstance
225
+ def get_instance(payload)
226
+ FaxInstance.new(
227
+ @version,
228
+ payload,
229
+ )
230
+ end
231
+
232
+ ##
233
+ # Provide a user friendly representation
234
+ def to_s
235
+ '<Twilio.Fax.V1.FaxPage>'
236
+ end
237
+ end
238
+
239
+ ##
240
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
241
+ class FaxContext < InstanceContext
242
+ ##
243
+ # Initialize the FaxContext
244
+ # @param [Version] version Version that contains the resource
245
+ # @param [String] sid A 34 character string that uniquely identifies this fax.
246
+ # @return [FaxContext] FaxContext
247
+ def initialize(version, sid)
248
+ super(version)
249
+
250
+ # Path Solution
251
+ @solution = {
252
+ sid: sid,
253
+ }
254
+ @uri = "/Faxes/#{@solution[:sid]}"
255
+
256
+ # Dependents
257
+ @media = nil
258
+ end
259
+
260
+ ##
261
+ # Fetch a FaxInstance
262
+ # @return [FaxInstance] Fetched FaxInstance
263
+ def fetch
264
+ params = Twilio::Values.of({})
265
+
266
+ payload = @version.fetch(
267
+ 'GET',
268
+ @uri,
269
+ params,
270
+ )
271
+
272
+ FaxInstance.new(
273
+ @version,
274
+ payload,
275
+ sid: @solution[:sid],
276
+ )
277
+ end
278
+
279
+ ##
280
+ # Update the FaxInstance
281
+ # @param [fax.UpdateStatus] status The updated status of this fax. The only valid
282
+ # option is `canceled`. This may fail if the status has already started
283
+ # transmission.
284
+ # @return [FaxInstance] Updated FaxInstance
285
+ def update(status: :unset)
286
+ data = Twilio::Values.of({
287
+ 'Status' => status,
288
+ })
289
+
290
+ payload = @version.update(
291
+ 'POST',
292
+ @uri,
293
+ data: data,
294
+ )
295
+
296
+ FaxInstance.new(
297
+ @version,
298
+ payload,
299
+ sid: @solution[:sid],
300
+ )
301
+ end
302
+
303
+ ##
304
+ # Deletes the FaxInstance
305
+ # @return [Boolean] true if delete succeeds, true otherwise
306
+ def delete
307
+ @version.delete('delete', @uri)
308
+ end
309
+
310
+ ##
311
+ # Access the media
312
+ # @return [FaxMediaList]
313
+ # @return [FaxMediaContext] if sid was passed.
314
+ def media(sid=:unset)
315
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
316
+
317
+ if sid != :unset
318
+ return FaxMediaContext.new(
319
+ @version,
320
+ @solution[:sid],
321
+ sid,
322
+ )
323
+ end
324
+
325
+ unless @media
326
+ @media = FaxMediaList.new(
327
+ @version,
328
+ fax_sid: @solution[:sid],
329
+ )
330
+ end
331
+
332
+ @media
333
+ end
334
+
335
+ ##
336
+ # Provide a user friendly representation
337
+ def to_s
338
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
339
+ "#<Twilio.Fax.V1.FaxContext #{context}>"
340
+ end
341
+ end
342
+
343
+ ##
344
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
345
+ class FaxInstance < InstanceResource
346
+ ##
347
+ # Initialize the FaxInstance
348
+ # @param [Version] version Version that contains the resource
349
+ # @param [Hash] payload payload that contains response from Twilio
350
+ # @param [String] sid A 34 character string that uniquely identifies this fax.
351
+ # @return [FaxInstance] FaxInstance
352
+ def initialize(version, payload, sid: nil)
353
+ super(version)
354
+
355
+ # Marshaled Properties
356
+ @properties = {
357
+ 'sid' => payload['sid'],
358
+ 'account_sid' => payload['account_sid'],
359
+ 'from' => payload['from'],
360
+ 'to' => payload['to'],
361
+ 'quality' => payload['quality'],
362
+ 'media_sid' => payload['media_sid'],
363
+ 'media_url' => payload['media_url'],
364
+ 'num_pages' => payload['num_pages'] == nil ? payload['num_pages'] : payload['num_pages'].to_i,
365
+ 'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
366
+ 'status' => payload['status'],
367
+ 'direction' => payload['direction'],
368
+ 'api_version' => payload['api_version'],
369
+ 'price' => payload['price'].to_f,
370
+ 'price_unit' => payload['price_unit'],
371
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
372
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
373
+ 'links' => payload['links'],
374
+ 'url' => payload['url'],
375
+ }
376
+
377
+ # Context
378
+ @instance_context = nil
379
+ @params = {
380
+ 'sid' => sid || @properties['sid'],
381
+ }
382
+ end
383
+
384
+ ##
385
+ # Generate an instance context for the instance, the context is capable of
386
+ # performing various actions. All instance actions are proxied to the context
387
+ # @return [FaxContext] FaxContext for this FaxInstance
388
+ def context
389
+ unless @instance_context
390
+ @instance_context = FaxContext.new(
391
+ @version,
392
+ @params['sid'],
393
+ )
394
+ end
395
+ @instance_context
396
+ end
397
+
398
+ ##
399
+ # @return [String] A string that uniquely identifies this fax.
400
+ def sid
401
+ @properties['sid']
402
+ end
403
+
404
+ ##
405
+ # @return [String] Account SID
406
+ def account_sid
407
+ @properties['account_sid']
408
+ end
409
+
410
+ ##
411
+ # @return [String] The party that sent the fax
412
+ def from
413
+ @properties['from']
414
+ end
415
+
416
+ ##
417
+ # @return [String] The party that received the fax
418
+ def to
419
+ @properties['to']
420
+ end
421
+
422
+ ##
423
+ # @return [fax.Quality] The quality of this fax
424
+ def quality
425
+ @properties['quality']
426
+ end
427
+
428
+ ##
429
+ # @return [String] Media SID
430
+ def media_sid
431
+ @properties['media_sid']
432
+ end
433
+
434
+ ##
435
+ # @return [String] URL pointing to fax media
436
+ def media_url
437
+ @properties['media_url']
438
+ end
439
+
440
+ ##
441
+ # @return [String] Number of pages
442
+ def num_pages
443
+ @properties['num_pages']
444
+ end
445
+
446
+ ##
447
+ # @return [String] The time taken to transmit the fax
448
+ def duration
449
+ @properties['duration']
450
+ end
451
+
452
+ ##
453
+ # @return [fax.Status] The status of this fax
454
+ def status
455
+ @properties['status']
456
+ end
457
+
458
+ ##
459
+ # @return [fax.Direction] The direction of this fax
460
+ def direction
461
+ @properties['direction']
462
+ end
463
+
464
+ ##
465
+ # @return [String] The API version used
466
+ def api_version
467
+ @properties['api_version']
468
+ end
469
+
470
+ ##
471
+ # @return [String] Fax transmission price
472
+ def price
473
+ @properties['price']
474
+ end
475
+
476
+ ##
477
+ # @return [String] Currency used for billing
478
+ def price_unit
479
+ @properties['price_unit']
480
+ end
481
+
482
+ ##
483
+ # @return [Time] The date this fax was created
484
+ def date_created
485
+ @properties['date_created']
486
+ end
487
+
488
+ ##
489
+ # @return [Time] The date this fax was updated
490
+ def date_updated
491
+ @properties['date_updated']
492
+ end
493
+
494
+ ##
495
+ # @return [String] Nested resource URLs
496
+ def links
497
+ @properties['links']
498
+ end
499
+
500
+ ##
501
+ # @return [String] The URL of this resource
502
+ def url
503
+ @properties['url']
504
+ end
505
+
506
+ ##
507
+ # Fetch a FaxInstance
508
+ # @return [FaxInstance] Fetched FaxInstance
509
+ def fetch
510
+ context.fetch
511
+ end
512
+
513
+ ##
514
+ # Update the FaxInstance
515
+ # @param [fax.UpdateStatus] status The updated status of this fax. The only valid
516
+ # option is `canceled`. This may fail if the status has already started
517
+ # transmission.
518
+ # @return [FaxInstance] Updated FaxInstance
519
+ def update(status: :unset)
520
+ context.update(
521
+ status: status,
522
+ )
523
+ end
524
+
525
+ ##
526
+ # Deletes the FaxInstance
527
+ # @return [Boolean] true if delete succeeds, true otherwise
528
+ def delete
529
+ context.delete
530
+ end
531
+
532
+ ##
533
+ # Access the media
534
+ # @return [media] media
535
+ def media
536
+ context.media
537
+ end
538
+
539
+ ##
540
+ # Provide a user friendly representation
541
+ def to_s
542
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
543
+ "<Twilio.Fax.V1.FaxInstance #{values}>"
544
+ end
545
+ end
546
+ end
547
+ end
548
+ end
549
+ end