twilio-ruby 5.0.0.rc21 → 5.0.0.rc22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +3 -0
  3. data/lib/twilio-ruby.rb +7 -3
  4. data/lib/twilio-ruby/framework/domain.rb +5 -1
  5. data/lib/twilio-ruby/framework/page.rb +4 -4
  6. data/lib/twilio-ruby/framework/serialize.rb +3 -2
  7. data/lib/twilio-ruby/framework/values.rb +7 -0
  8. data/lib/twilio-ruby/framework/version.rb +4 -6
  9. data/lib/twilio-ruby/jwt/access_token.rb +160 -134
  10. data/lib/twilio-ruby/jwt/client_capability.rb +98 -0
  11. data/lib/twilio-ruby/jwt/jwt.rb +56 -0
  12. data/lib/twilio-ruby/jwt/task_router.rb +108 -139
  13. data/lib/twilio-ruby/rest/accounts.rb +1 -1
  14. data/lib/twilio-ruby/rest/accounts/v1/credential.rb +1 -1
  15. data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +30 -17
  16. data/lib/twilio-ruby/rest/api.rb +2 -2
  17. data/lib/twilio-ruby/rest/api/v2010/account.rb +31 -18
  18. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +32 -19
  19. data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +18 -5
  20. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +32 -19
  21. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +20 -7
  22. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +20 -7
  23. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +20 -7
  24. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +20 -7
  25. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +20 -7
  26. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +33 -20
  27. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +13 -13
  28. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +8 -8
  29. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +23 -10
  30. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +23 -10
  31. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +27 -14
  32. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +32 -19
  33. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +25 -12
  34. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +32 -19
  35. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +24 -11
  36. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +20 -7
  37. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +24 -11
  38. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +24 -11
  39. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +24 -11
  40. data/lib/twilio-ruby/rest/api/v2010/account/key.rb +26 -13
  41. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +30 -17
  42. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +5 -5
  43. data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +23 -10
  44. data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +5 -5
  45. data/lib/twilio-ruby/rest/api/v2010/account/new_signing_key.rb +5 -5
  46. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +23 -10
  47. data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +28 -15
  48. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +30 -17
  49. data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +23 -10
  50. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +23 -10
  51. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +21 -8
  52. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +21 -8
  53. data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +21 -8
  54. data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +27 -14
  55. data/lib/twilio-ruby/rest/api/v2010/account/signing_key.rb +26 -13
  56. data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +1 -1
  57. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +27 -14
  58. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +29 -16
  59. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +30 -17
  60. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +24 -11
  61. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +24 -11
  62. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +27 -14
  63. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +29 -16
  64. data/lib/twilio-ruby/rest/api/v2010/account/token.rb +5 -5
  65. data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +21 -8
  66. data/lib/twilio-ruby/rest/api/v2010/account/usage.rb +1 -1
  67. data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +20 -7
  68. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +20 -7
  69. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +20 -7
  70. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +20 -7
  71. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +20 -7
  72. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +20 -7
  73. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +20 -7
  74. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +20 -7
  75. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +20 -7
  76. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +32 -19
  77. data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +5 -5
  78. data/lib/twilio-ruby/rest/chat.rb +4 -4
  79. data/lib/twilio-ruby/rest/chat/v1/credential.rb +30 -17
  80. data/lib/twilio-ruby/rest/chat/v1/service.rb +29 -16
  81. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +32 -19
  82. data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +27 -14
  83. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +32 -19
  84. data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +32 -19
  85. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +27 -14
  86. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +30 -17
  87. data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +18 -5
  88. data/lib/twilio-ruby/rest/chat/v2/credential.rb +30 -17
  89. data/lib/twilio-ruby/rest/chat/v2/service.rb +29 -16
  90. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +32 -19
  91. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +27 -14
  92. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +32 -19
  93. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +32 -19
  94. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +27 -14
  95. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +30 -17
  96. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +18 -5
  97. data/lib/twilio-ruby/rest/fax.rb +2 -2
  98. data/lib/twilio-ruby/rest/fax/v1/fax.rb +32 -19
  99. data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +21 -8
  100. data/lib/twilio-ruby/rest/ip_messaging.rb +4 -4
  101. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +30 -17
  102. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +29 -16
  103. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +32 -19
  104. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +27 -14
  105. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +32 -19
  106. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +32 -19
  107. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +27 -14
  108. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +30 -17
  109. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +18 -5
  110. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +30 -17
  111. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +29 -16
  112. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +32 -19
  113. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +27 -14
  114. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +32 -19
  115. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +32 -19
  116. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +27 -14
  117. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +30 -17
  118. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +18 -5
  119. data/lib/twilio-ruby/rest/lookups.rb +2 -2
  120. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +6 -6
  121. data/lib/twilio-ruby/rest/messaging.rb +2 -2
  122. data/lib/twilio-ruby/rest/messaging/v1/service.rb +30 -17
  123. data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +24 -11
  124. data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +24 -11
  125. data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +24 -11
  126. data/lib/twilio-ruby/rest/monitor.rb +4 -4
  127. data/lib/twilio-ruby/rest/monitor/v1/alert.rb +23 -10
  128. data/lib/twilio-ruby/rest/monitor/v1/event.rb +22 -9
  129. data/lib/twilio-ruby/rest/notify.rb +4 -4
  130. data/lib/twilio-ruby/rest/notify/v1/credential.rb +30 -17
  131. data/lib/twilio-ruby/rest/notify/v1/service.rb +32 -19
  132. data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +27 -14
  133. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +5 -5
  134. data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +18 -5
  135. data/lib/twilio-ruby/rest/notify/v1/service/user.rb +27 -14
  136. data/lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb +7 -7
  137. data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +27 -14
  138. data/lib/twilio-ruby/rest/preview.rb +18 -18
  139. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +3 -3
  140. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +18 -5
  141. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +8 -8
  142. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +32 -19
  143. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +20 -7
  144. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb +20 -7
  145. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +30 -17
  146. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb +23 -10
  147. data/lib/twilio-ruby/rest/preview/proxy/service.rb +30 -17
  148. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +24 -11
  149. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +32 -19
  150. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +22 -9
  151. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +32 -19
  152. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +24 -11
  153. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +24 -11
  154. data/lib/twilio-ruby/rest/preview/sync/service.rb +30 -17
  155. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +28 -15
  156. data/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb +24 -11
  157. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +25 -12
  158. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +29 -16
  159. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb +24 -11
  160. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +25 -12
  161. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +29 -16
  162. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb +24 -11
  163. data/lib/twilio-ruby/rest/preview/wireless/command.rb +26 -13
  164. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +30 -17
  165. data/lib/twilio-ruby/rest/preview/wireless/sim.rb +28 -15
  166. data/lib/twilio-ruby/rest/preview/wireless/sim/usage.rb +6 -6
  167. data/lib/twilio-ruby/rest/pricing.rb +3 -3
  168. data/lib/twilio-ruby/rest/pricing/v1/messaging.rb +1 -1
  169. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +20 -7
  170. data/lib/twilio-ruby/rest/pricing/v1/phone_number.rb +1 -1
  171. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +20 -7
  172. data/lib/twilio-ruby/rest/pricing/v1/voice.rb +1 -1
  173. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +20 -7
  174. data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +3 -3
  175. data/lib/twilio-ruby/rest/sync.rb +2 -2
  176. data/lib/twilio-ruby/rest/sync/v1/service.rb +30 -17
  177. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +28 -15
  178. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +24 -11
  179. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +25 -12
  180. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +29 -16
  181. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +24 -11
  182. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +25 -12
  183. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +29 -16
  184. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +24 -11
  185. data/lib/twilio-ruby/rest/taskrouter.rb +2 -2
  186. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +33 -20
  187. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +32 -19
  188. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +22 -9
  189. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +32 -19
  190. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +27 -14
  191. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +20 -7
  192. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +33 -20
  193. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +6 -6
  194. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +20 -7
  195. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +33 -20
  196. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +27 -14
  197. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +25 -12
  198. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +6 -6
  199. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +6 -6
  200. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +33 -20
  201. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +6 -6
  202. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +6 -6
  203. data/lib/twilio-ruby/rest/trunking.rb +2 -2
  204. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +30 -17
  205. data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +24 -11
  206. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +24 -11
  207. data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +29 -16
  208. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +24 -11
  209. data/lib/twilio-ruby/rest/video.rb +4 -4
  210. data/lib/twilio-ruby/rest/video/v1/recording.rb +23 -10
  211. data/lib/twilio-ruby/rest/video/v1/room.rb +29 -16
  212. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +20 -7
  213. data/lib/twilio-ruby/rest/wireless.rb +6 -6
  214. data/lib/twilio-ruby/rest/wireless/v1/command.rb +26 -13
  215. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +30 -17
  216. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +27 -14
  217. data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +20 -7
  218. data/lib/twilio-ruby/twiml/messaging_response.rb +147 -0
  219. data/lib/twilio-ruby/twiml/twiml.rb +77 -0
  220. data/lib/twilio-ruby/twiml/voice_response.rb +925 -0
  221. data/lib/twilio-ruby/version.rb +1 -1
  222. data/spec/holodeck/hologram.rb +0 -1
  223. data/spec/jwt/access_token_spec.rb +126 -182
  224. data/spec/jwt/client_capability_spec.rb +104 -0
  225. data/spec/jwt/task_router_spec.rb +164 -97
  226. data/spec/twiml/messaging_response_spec.rb +62 -0
  227. data/spec/twiml/voice_response_spec.rb +452 -0
  228. data/twilio-ruby.gemspec +4 -2
  229. metadata +36 -23
  230. data/lib/twilio-ruby/compatibility/v2010/account/call/feedback.rb +0 -15
  231. data/lib/twilio-ruby/compatibility/v2010/account/queue/member.rb +0 -23
  232. data/lib/twilio-ruby/jwt/capability.rb +0 -64
  233. data/lib/twilio-ruby/twiml/response.rb +0 -16
  234. data/spec/jwt/capability_spec.rb +0 -186
  235. data/spec/jwt/task_router_taskqueue_spec.rb +0 -111
  236. data/spec/jwt/task_router_worker_spec.rb +0 -146
  237. data/spec/jwt/task_router_workspace_spec.rb +0 -110
  238. data/spec/twiml/twiml_response_spec.rb +0 -47
@@ -37,7 +37,7 @@ module Twilio
37
37
  # but a limit is defined, stream() will attempt to read the
38
38
  # limit with the most efficient page size, i.e. min(limit, 1000)
39
39
  # @return [Array] Array of up to limit results
40
- def list(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, limit: nil, page_size: nil)
40
+ def list(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, limit: nil, page_size: nil)
41
41
  self.stream(
42
42
  status: status,
43
43
  iccid: iccid,
@@ -65,7 +65,7 @@ module Twilio
65
65
  # but a limit is defined, stream() will attempt to read the
66
66
  # limit with the most efficient page size, i.e. min(limit, 1000)
67
67
  # @return [Enumerable] Enumerable that will yield up to limit results
68
- def stream(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, limit: nil, page_size: nil)
68
+ def stream(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, limit: nil, page_size: nil)
69
69
  limits = @version.read_limits(limit, page_size)
70
70
 
71
71
  page = self.page(
@@ -119,8 +119,8 @@ module Twilio
119
119
  # @param [Integer] page_number Page Number, this value is simply for client state
120
120
  # @param [Integer] page_size Number of records to return, defaults to 50
121
121
  # @return [Page] Page of SimInstance
122
- def page(status: nil, iccid: nil, rate_plan: nil, e_id: nil, sim_registration_code: nil, page_token: nil, page_number: nil, page_size: nil)
123
- params = {
122
+ def page(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
123
+ params = Twilio::Values.of({
124
124
  'Status' => status,
125
125
  'Iccid' => iccid,
126
126
  'RatePlan' => rate_plan,
@@ -129,13 +129,26 @@ module Twilio
129
129
  'PageToken' => page_token,
130
130
  'Page' => page_number,
131
131
  'PageSize' => page_size,
132
- }
132
+ })
133
133
  response = @version.page(
134
134
  'GET',
135
135
  @uri,
136
136
  params
137
137
  )
138
- return SimPage.new(@version, response, @solution)
138
+ SimPage.new(@version, response, @solution)
139
+ end
140
+
141
+ ##
142
+ # Retrieve a single page of SimInstance records from the API.
143
+ # Request is executed immediately.
144
+ # @param [String] target_url API-generated URL for the requested results page
145
+ # @return [Page] Page of SimInstance
146
+ def get_page(target_url)
147
+ response = @version.domain.request(
148
+ 'GET',
149
+ target_url
150
+ )
151
+ SimPage.new(@version, response, @solution)
139
152
  end
140
153
 
141
154
  ##
@@ -164,7 +177,7 @@ module Twilio
164
177
  # @param [Hash] payload Payload response from the API
165
178
  # @return [SimInstance] SimInstance
166
179
  def get_instance(payload)
167
- return SimInstance.new(
180
+ SimInstance.new(
168
181
  @version,
169
182
  payload,
170
183
  )
@@ -200,7 +213,7 @@ module Twilio
200
213
  # Fetch a SimInstance
201
214
  # @return [SimInstance] Fetched SimInstance
202
215
  def fetch
203
- params = {}
216
+ params = Twilio::Values.of({})
204
217
 
205
218
  payload = @version.fetch(
206
219
  'GET',
@@ -208,7 +221,7 @@ module Twilio
208
221
  params,
209
222
  )
210
223
 
211
- return SimInstance.new(
224
+ SimInstance.new(
212
225
  @version,
213
226
  payload,
214
227
  sid: @solution[:sid],
@@ -234,8 +247,8 @@ module Twilio
234
247
  # @param [String] voice_method The voice_method
235
248
  # @param [String] voice_url The voice_url
236
249
  # @return [SimInstance] Updated SimInstance
237
- def update(unique_name: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil, sms_fallback_method: nil, sms_fallback_url: nil, sms_method: nil, sms_url: nil, voice_fallback_method: nil, voice_fallback_url: nil, voice_method: nil, voice_url: nil)
238
- data = {
250
+ def update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset)
251
+ data = Twilio::Values.of({
239
252
  'UniqueName' => unique_name,
240
253
  'CallbackMethod' => callback_method,
241
254
  'CallbackUrl' => callback_url,
@@ -252,7 +265,7 @@ module Twilio
252
265
  'VoiceFallbackUrl' => voice_fallback_url,
253
266
  'VoiceMethod' => voice_method,
254
267
  'VoiceUrl' => voice_url,
255
- }
268
+ })
256
269
 
257
270
  payload = @version.update(
258
271
  'POST',
@@ -260,7 +273,7 @@ module Twilio
260
273
  data: data,
261
274
  )
262
275
 
263
- return SimInstance.new(
276
+ SimInstance.new(
264
277
  @version,
265
278
  payload,
266
279
  sid: @solution[:sid],
@@ -461,7 +474,7 @@ module Twilio
461
474
  # @param [String] voice_method The voice_method
462
475
  # @param [String] voice_url The voice_url
463
476
  # @return [SimInstance] Updated SimInstance
464
- def update(unique_name: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil, sms_fallback_method: nil, sms_fallback_url: nil, sms_method: nil, sms_url: nil, voice_fallback_method: nil, voice_fallback_url: nil, voice_method: nil, voice_url: nil)
477
+ def update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset)
465
478
  context.update(
466
479
  unique_name: unique_name,
467
480
  callback_method: callback_method,
@@ -39,7 +39,7 @@ module Twilio
39
39
  # but a limit is defined, stream() will attempt to read the
40
40
  # limit with the most efficient page size, i.e. min(limit, 1000)
41
41
  # @return [Array] Array of up to limit results
42
- def list(end_: nil, start: nil, granularity: nil, limit: nil, page_size: nil)
42
+ def list(end_: :unset, start: :unset, granularity: :unset, limit: nil, page_size: nil)
43
43
  self.stream(
44
44
  end_: end_,
45
45
  start: start,
@@ -63,7 +63,7 @@ module Twilio
63
63
  # but a limit is defined, stream() will attempt to read the
64
64
  # limit with the most efficient page size, i.e. min(limit, 1000)
65
65
  # @return [Enumerable] Enumerable that will yield up to limit results
66
- def stream(end_: nil, start: nil, granularity: nil, limit: nil, page_size: nil)
66
+ def stream(end_: :unset, start: :unset, granularity: :unset, limit: nil, page_size: nil)
67
67
  limits = @version.read_limits(limit, page_size)
68
68
 
69
69
  page = self.page(
@@ -111,21 +111,34 @@ module Twilio
111
111
  # @param [Integer] page_number Page Number, this value is simply for client state
112
112
  # @param [Integer] page_size Number of records to return, defaults to 50
113
113
  # @return [Page] Page of UsageRecordInstance
114
- def page(end_: nil, start: nil, granularity: nil, page_token: nil, page_number: nil, page_size: nil)
115
- params = {
114
+ def page(end_: :unset, start: :unset, granularity: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
115
+ params = Twilio::Values.of({
116
116
  'End' => Twilio.serialize_iso8601(end_),
117
117
  'Start' => Twilio.serialize_iso8601(start),
118
118
  'Granularity' => granularity,
119
119
  'PageToken' => page_token,
120
120
  'Page' => page_number,
121
121
  'PageSize' => page_size,
122
- }
122
+ })
123
123
  response = @version.page(
124
124
  'GET',
125
125
  @uri,
126
126
  params
127
127
  )
128
- return UsageRecordPage.new(@version, response, @solution)
128
+ UsageRecordPage.new(@version, response, @solution)
129
+ end
130
+
131
+ ##
132
+ # Retrieve a single page of UsageRecordInstance records from the API.
133
+ # Request is executed immediately.
134
+ # @param [String] target_url API-generated URL for the requested results page
135
+ # @return [Page] Page of UsageRecordInstance
136
+ def get_page(target_url)
137
+ response = @version.domain.request(
138
+ 'GET',
139
+ target_url
140
+ )
141
+ UsageRecordPage.new(@version, response, @solution)
129
142
  end
130
143
 
131
144
  ##
@@ -155,7 +168,7 @@ module Twilio
155
168
  # @param [Hash] payload Payload response from the API
156
169
  # @return [UsageRecordInstance] UsageRecordInstance
157
170
  def get_instance(payload)
158
- return UsageRecordInstance.new(
171
+ UsageRecordInstance.new(
159
172
  @version,
160
173
  payload,
161
174
  sim_sid: @solution[:sim_sid],
@@ -0,0 +1,147 @@
1
+ module Twilio
2
+ module TwiML
3
+
4
+ # Messaging TwiML Response
5
+ class MessagingResponse < TwiML
6
+ # Create a new <Response>
7
+ def initialize()
8
+ super()
9
+ self.name = 'Response'
10
+ end
11
+
12
+ # Create a <Message> element
13
+ #
14
+ # == Parameters:
15
+ # body:: body of the message
16
+ # to:: number to send to
17
+ # from_:: number to send from
18
+ # method:: action HTTP method
19
+ # action:: action URL
20
+ # status_callback:: callback URL
21
+ # keyword_args:: additional attributes
22
+ #
23
+ # == Returns:
24
+ # A <Response> element with a <Message> child element
25
+ def message(
26
+ body,
27
+ to: nil,
28
+ from: nil,
29
+ method: nil,
30
+ action: nil,
31
+ status_callback: nil,
32
+ **keyword_args)
33
+
34
+ self.append(Message.new(
35
+ body: body,
36
+ to: to,
37
+ from: from,
38
+ method: method,
39
+ action: action,
40
+ status_callback: status_callback,
41
+ **keyword_args
42
+ ))
43
+ end
44
+
45
+ # Create an <Redirect> element
46
+ #
47
+ # == Parameters:
48
+ # url:: URL to redirect to
49
+ # method:: HTTP method
50
+ # keyword_args:: attributes
51
+ #
52
+ # == Returns:
53
+ # A <Response> element with an <Redirect> child element
54
+ def redirect(url, method: nil, **keyword_args)
55
+ self.append(Redirect.new(url, method: method, **keyword_args))
56
+ end
57
+ end
58
+
59
+ # <Message> element
60
+ class Message < TwiML
61
+ # Create a <Message> element
62
+ #
63
+ # == Parameters:
64
+ # body:: message body
65
+ # keyword_args:: additional attributes
66
+ #
67
+ # == Returns:
68
+ # A <Message> element
69
+ def initialize(body: nil, **keyword_args)
70
+ super(**keyword_args)
71
+ if !(body.nil?)
72
+ @value = body
73
+ end
74
+ end
75
+
76
+ # Create a <Body> element
77
+ #
78
+ # == Parameters:
79
+ # body:: body of message
80
+ # keyword_args:: additional attributes
81
+ #
82
+ # == Returns:
83
+ # A <Message> element with a <Body> child element
84
+ def body(body)
85
+ self.append(Body.new(body))
86
+ end
87
+
88
+ # Create a <Media> element
89
+ #
90
+ # == Parameters:
91
+ # body:: body of message
92
+ # keyword_args:: additional attributes
93
+ #
94
+ # == Returns:
95
+ # A <Message> element with a <Media> child element
96
+ def media(url)
97
+ self.append(Media.new(url))
98
+ end
99
+ end
100
+
101
+ # <Body> element
102
+ class Body < TwiML
103
+ # Create a <Body> element
104
+ #
105
+ # == Parameters:
106
+ # body:: message body
107
+ #
108
+ # == Returns:
109
+ # A <Body> element
110
+ def initialize(body)
111
+ super()
112
+ @value = body
113
+ end
114
+ end
115
+
116
+ # <Media> element
117
+ class Media < TwiML
118
+ # Create a <Media> element
119
+ #
120
+ # == Parameters:
121
+ # url:: media URL location
122
+ #
123
+ # == Returns:
124
+ # A <Media> element
125
+ def initialize(url)
126
+ super()
127
+ @value = url
128
+ end
129
+ end
130
+
131
+ # <Redirect> element
132
+ class Redirect < TwiML
133
+ # Create a <Redirect> element
134
+ #
135
+ # == Parameters:
136
+ # url:: redirect URL location
137
+ # keyword_args:: additional attributes
138
+ #
139
+ # == Returns:
140
+ # A <Redirect> element
141
+ def initialize(url, **keyword_args)
142
+ super(**keyword_args)
143
+ @value = url
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,77 @@
1
+ require 'libxml'
2
+
3
+ module Twilio
4
+ module TwiML
5
+ class TwiMLError < StandardError
6
+ end
7
+
8
+ class TwiML
9
+ # Generate getter/setter methods
10
+ attr_accessor :name
11
+ attr_accessor :indent
12
+
13
+ def initialize(indent: false, **keyword_args)
14
+ @name = self.class.name.split('::').last
15
+ @indent = indent
16
+ @value = nil
17
+ @verbs = []
18
+ @attrs = {}
19
+
20
+ keyword_args.each do |key, val|
21
+ if !(val.nil?)
22
+ @attrs[TwiML.to_lower_camel_case(key)] = val
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.to_lower_camel_case(symbol)
28
+ # Symbols don't have the .split method, so convert to string first
29
+ result = symbol.to_s.split('_').map(&:capitalize).join
30
+ result[0].downcase + result[1..result.length]
31
+ end
32
+
33
+ def to_s()
34
+ self.to_xml_str
35
+ end
36
+
37
+ def to_xml_str(xml_declaration = true)
38
+ xml = self.xml.to_s(:indent => self.indent)
39
+
40
+ return ('<?xml version="1.0" encoding="UTF-8"?>' + xml) if xml_declaration
41
+ xml
42
+ end
43
+
44
+ def xml()
45
+ # create XML element
46
+ elem = LibXML::XML::Node.new(@name, @value)
47
+
48
+ # set element attributes
49
+ keys = @attrs.keys.sort
50
+ keys.each do |key|
51
+ value = @attrs[key]
52
+
53
+ if (value.is_a?(TrueClass) || value.is_a?(FalseClass))
54
+ elem[key] = value.to_s.downcase
55
+ else
56
+ elem[key] = value.to_s
57
+ end
58
+ end
59
+
60
+ @verbs.each do |verb|
61
+ elem << verb.xml
62
+ end
63
+
64
+ elem
65
+ end
66
+
67
+ def append(verb)
68
+ if !(verb.is_a?(TwiML))
69
+ raise TwiMLError.new "Only appending of TwiML is allowed"
70
+ end
71
+
72
+ @verbs << verb
73
+ self
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,925 @@
1
+ module Twilio
2
+ module TwiML
3
+
4
+ # Voice TwiML Response
5
+ class VoiceResponse < TwiML
6
+ # Create a new <Response>
7
+ def initialize()
8
+ super()
9
+ self.name = 'Response'
10
+ end
11
+
12
+ # Create a <Dial> element
13
+ #
14
+ # == Parameters:
15
+ # number:: phone number to dial
16
+ # action:: action URL
17
+ # method:: action HTTP method
18
+ # timeout:: time to wait for answer
19
+ # hangup_on_star:: hangup call on * press
20
+ # time_limit:: max time length
21
+ # caller_id:: caller ID to display
22
+ # record:: record the call
23
+ # trim:: trim the recording
24
+ # recording_status_callback:: status callback URL
25
+ # recording_status_callback_method:: status callback URL method
26
+ # keyword_args:: additional attributes
27
+ #
28
+ # == Returns:
29
+ # A <Response> element with a <Dial> child element
30
+ def dial(
31
+ number,
32
+ action: nil,
33
+ method: nil,
34
+ timeout: nil,
35
+ hangup_on_star: nil,
36
+ time_limit: nil,
37
+ caller_id: nil,
38
+ record: nil,
39
+ trim: nil,
40
+ recording_status_callback: nil,
41
+ recording_status_callback_method: nil,
42
+ **keyword_args)
43
+
44
+ self.append(Dial.new(
45
+ number: number,
46
+ action: action,
47
+ method: method,
48
+ timeout: timeout,
49
+ hangup_on_star: hangup_on_star,
50
+ time_limit: time_limit,
51
+ caller_id: caller_id,
52
+ record: record,
53
+ trim: trim,
54
+ recording_status_callback: recording_status_callback,
55
+ recording_status_callback_method: recording_status_callback_method,
56
+ **keyword_args
57
+ ))
58
+ end
59
+
60
+ # Create an <Echo> element
61
+ #
62
+ # == Parameters:
63
+ # keyword_args:: attributes
64
+ #
65
+ # == Returns:
66
+ # A <Response> element with an <Echo> child element
67
+ def echo(**keyword_args)
68
+ self.append(Echo.new(**keyword_args))
69
+ end
70
+
71
+ # Create an <Enqueue> element
72
+ #
73
+ # == Parameters:
74
+ # name:: friendly name
75
+ # action:: action URL
76
+ # method:: action URL method
77
+ # wait_url:: wait URL
78
+ # wait_url_method:: wait URL method
79
+ # workflow_sid:: TaskRouter workflow SID
80
+ # keyword_args:: additional attributes
81
+ #
82
+ # == Returns:
83
+ # A <Response> element with an <Enqueue> child element
84
+ def enqueue(
85
+ name,
86
+ action: nil,
87
+ method: nil,
88
+ wait_url: nil,
89
+ wait_url_method: nil,
90
+ workflow_sid: nil,
91
+ **keyword_args)
92
+
93
+ self.append(Enqueue.new(
94
+ name,
95
+ action: action,
96
+ method: method,
97
+ wait_url: wait_url,
98
+ wait_url_method: wait_url_method,
99
+ workflow_sid: workflow_sid,
100
+ **keyword_args
101
+ ))
102
+ end
103
+
104
+ # Create a <Gather> element
105
+ #
106
+ # == Parameters:
107
+ # action:: action URL
108
+ # method:: action URL method
109
+ # timeout:: time to wait while gathering input
110
+ # finish_on_key:: finish on key press
111
+ # num_digits:: digits to collect
112
+ # partial_result_callback:: callback url
113
+ # partial_result_callback_method:: callback method
114
+ # language:: locale string
115
+ # hints:: speech recognition hints
116
+ # barge_in:: stop playing media upon speech
117
+ # acknowledge_sound_url:: url to hit when sound starts
118
+ # keyword_args:: additional attributes
119
+ #
120
+ # == Returns:
121
+ # A <Response> element with a <Gather> child element
122
+ def gather(
123
+ action: nil,
124
+ method: nil,
125
+ timeout: nil,
126
+ finish_on_key: nil,
127
+ num_digits: nil,
128
+ partial_result_callback: nil,
129
+ partial_result_callback_method: nil,
130
+ language: nil,
131
+ hints: nil,
132
+ barge_in: nil,
133
+ acknowledge_sound_url: nil,
134
+ **keyword_args)
135
+
136
+ self.append(Gather.new(
137
+ action: action,
138
+ method: method,
139
+ timeout: timeout,
140
+ finish_on_key: finish_on_key,
141
+ num_digits: num_digits,
142
+ partial_result_callback: partial_result_callback,
143
+ partial_result_callback_method: partial_result_callback_method,
144
+ language: language,
145
+ hints: hints,
146
+ barge_in: barge_in,
147
+ acknowledge_sound_url: acknowledge_sound_url,
148
+ **keyword_args
149
+ ))
150
+ end
151
+
152
+ # Create a <Hangup> element
153
+ #
154
+ # == Returns:
155
+ # A <Response> element with a <Hangup> child element
156
+ def hangup()
157
+ self.append(Hangup.new)
158
+ end
159
+
160
+ # Create a <Leave> element
161
+ #
162
+ # == Returns:
163
+ # A <Response> element with a <Leave> child element
164
+ def leave()
165
+ self.append(Leave.new)
166
+ end
167
+
168
+ # Create a <Pause> element
169
+ #
170
+ # == Parameters:
171
+ # length:: time in seconds to pause
172
+ #
173
+ # == Returns:
174
+ # A <Response> element with a <Pause> child element
175
+ def pause(length: nil)
176
+ self.append(Pause.new(length: length))
177
+ end
178
+
179
+ # Create a <Play> element
180
+ #
181
+ # == Parameters:
182
+ # url:: url to play
183
+ # loop:: times to loop
184
+ # digits:: play DTMF tones during a call
185
+ # keyword_args:: additional attributes
186
+ #
187
+ # == Returns:
188
+ # A <Response> element with a <Play> child element
189
+ def play(url, loop: nil, digits: nil, **keyword_args)
190
+ self.append(Play.new(
191
+ url,
192
+ loop: loop,
193
+ digits: digits,
194
+ **keyword_args
195
+ ))
196
+ end
197
+
198
+ # Create a <Record> element
199
+ #
200
+ # == Parameters:
201
+ # action:: action URL
202
+ # method:: action URL method
203
+ # timeout:: timeout for recording
204
+ # finish_on_key:: finish recording on key
205
+ # max_length:: max length to record
206
+ # play_beep:: play beep
207
+ # trim:: trim the recording
208
+ # recording_status_callback:: status callback for the recordings
209
+ # recording_status_callback_method:: status callback method
210
+ # transcribe:: transcribe the recording
211
+ # transcribe_callback:: transcribe callback URL
212
+ # keyword_args:: additional attributes
213
+ #
214
+ # == Returns:
215
+ # A <Response> element with a <Record> child element
216
+ def record(
217
+ action: nil,
218
+ method: nil,
219
+ timeout: nil,
220
+ finish_on_key: nil,
221
+ max_length: nil,
222
+ play_beep: nil,
223
+ trim: nil,
224
+ recording_status_callback: nil,
225
+ recording_status_callback_method: nil,
226
+ transcribe: nil,
227
+ transcribe_callback: nil,
228
+ **keyword_args)
229
+
230
+ self.append(Record.new(
231
+ action: action,
232
+ method: method,
233
+ timeout: timeout,
234
+ finish_on_key: finish_on_key,
235
+ max_length: max_length,
236
+ play_beep: play_beep,
237
+ trim: trim,
238
+ recording_status_callback: recording_status_callback,
239
+ recording_status_callback_method: recording_status_callback_method,
240
+ transcribe: transcribe,
241
+ transcribe_callback: transcribe_callback,
242
+ **keyword_args
243
+ ))
244
+ end
245
+
246
+ # Create a <Redirect> element
247
+ #
248
+ # == Parameters:
249
+ # url:: redirect URL
250
+ # method:: redirect method
251
+ # keyword_args:: additional attributes
252
+ #
253
+ # == Returns:
254
+ # A <Response> element with a <Redirect> child element
255
+ def redirect(url, method: nil, **keyword_args)
256
+ self.append(Redirect.new(url, method: method, **keyword_args))
257
+ end
258
+
259
+ # Create a <Reject> element
260
+ #
261
+ # == Parameters:
262
+ # reason:: rejection reason
263
+ # keyword_args:: additional attributes
264
+ #
265
+ # == Returns:
266
+ # A <Response> element with a <Reject> child element
267
+ def reject(reason: nil, **keyword_args)
268
+ self.append(Reject.new(reason: reason, **keyword_args))
269
+ end
270
+
271
+ # Create a <Say> element
272
+ #
273
+ # == Parameters:
274
+ # body:: message body
275
+ # loop:: times to loop
276
+ # language:: language of message
277
+ # voice:: voice to use
278
+ # keyword_args:: additional attributes
279
+ #
280
+ # == Returns:
281
+ # A <Response> element with a <Say> child element
282
+ def say(body, loop: nil, language: nil, voice: nil, **keyword_args)
283
+ self.append(Say.new(
284
+ body,
285
+ loop: loop,
286
+ language: language,
287
+ voice: voice,
288
+ **keyword_args
289
+ ))
290
+ end
291
+
292
+ # Create a <Sms> element
293
+ #
294
+ # == Parameters:
295
+ # body:: body of message
296
+ # to:: to phone number
297
+ # from_:: from phone number
298
+ # method:: action URL method
299
+ # action:: action URL
300
+ # status_callback:: status callback URL
301
+ # keyword_args:: additional attributes
302
+ #
303
+ # == Returns:
304
+ # A <Response> element with a <Sms> child element
305
+ def sms(
306
+ body,
307
+ to: nil,
308
+ from: nil,
309
+ method: nil,
310
+ action: nil,
311
+ status_callback: nil,
312
+ **keyword_args)
313
+
314
+ self.append(Sms.new(
315
+ body,
316
+ to: to,
317
+ from: from,
318
+ method: method,
319
+ action: action,
320
+ status_callback: status_callback,
321
+ **keyword_args
322
+ ))
323
+ end
324
+ end
325
+
326
+ # <Dial> element
327
+ class Dial < TwiML
328
+ # Create a <Dial> element
329
+ #
330
+ # == Parameters:
331
+ # number:: phone number to dial
332
+ # keyword_args:: additional attributes
333
+ #
334
+ # == Returns:
335
+ # A <Dial> element
336
+ def initialize(number: nil, **keyword_args)
337
+ super(**keyword_args)
338
+ if !(number.nil?)
339
+ @value = number
340
+ end
341
+ end
342
+
343
+ # Create a <Client> element
344
+ #
345
+ # == Parameters:
346
+ # name:: name of client
347
+ # method:: action URL method
348
+ # url:: action URL
349
+ # status_callback_event:: events to call status callback
350
+ # status_callback_method:: status callback URL method
351
+ # status_callback:: status callback URL
352
+ # keyword_args:: additional attributes
353
+ #
354
+ # == Returns:
355
+ # A <Dial> element with a <Client> child element
356
+ def client(
357
+ name,
358
+ method: nil,
359
+ url: nil,
360
+ status_callback_event: nil,
361
+ status_callback_method: nil,
362
+ status_callback: nil,
363
+ **keyword_args)
364
+
365
+ self.append(Client.new(
366
+ name,
367
+ method: method,
368
+ url: url,
369
+ status_callback_event: status_callback_event,
370
+ status_callback_method: status_callback_method,
371
+ status_callback: status_callback,
372
+ **keyword_args
373
+ ))
374
+ end
375
+
376
+ # Create a <Conference> element
377
+ #
378
+ # == Parameters:
379
+ # name:: name of conference
380
+ # muted:: join the conference muted
381
+ # start_conference_on_enter:: start the conference on enter
382
+ # end_conference_on_exit:: end the conference on exit
383
+ # max_participants:: max number of people in conference
384
+ # beep:: play beep when joining
385
+ # record:: record the conference
386
+ # trim:: trim the recording
387
+ # wait_method:: wait URL method
388
+ # wait_url:: wait URL to play
389
+ # event_callback_url:: event callback URL
390
+ # status_callback_event:: events to call status callback
391
+ # status_callback:: status callback URL
392
+ # status_callback_method:: status callback URL method
393
+ # recording_status_callback:: recording status callback URL
394
+ # recording_status_callback_method:: recording status callback URL method
395
+ # keyword_args:: additional attributes
396
+ #
397
+ # == Returns:
398
+ # A <Dial> element with a <Conference> child element
399
+ def conference(
400
+ name,
401
+ muted: nil,
402
+ start_conference_on_enter: nil,
403
+ end_conference_on_exit: nil,
404
+ max_participants: nil,
405
+ beep: nil,
406
+ record: nil,
407
+ trim: nil,
408
+ wait_url: nil,
409
+ wait_method: nil,
410
+ event_callback_url: nil,
411
+ status_callback: nil,
412
+ status_callback_event: nil,
413
+ status_callback_method: nil,
414
+ recording_status_callback: nil,
415
+ recording_status_callback_method: nil,
416
+ **keyword_args)
417
+
418
+ self.append(Conference.new(
419
+ name,
420
+ muted: muted,
421
+ start_conference_on_enter: start_conference_on_enter,
422
+ end_conference_on_exit: end_conference_on_exit,
423
+ max_participants: max_participants,
424
+ beep: beep,
425
+ record: record,
426
+ trim: trim,
427
+ wait_url: wait_url,
428
+ wait_method: wait_method,
429
+ event_callback_url: event_callback_url,
430
+ status_callback: status_callback,
431
+ status_callback_event: status_callback_event,
432
+ status_callback_method: status_callback_method,
433
+ recording_status_callback: recording_status_callback,
434
+ recording_status_callback_method: recording_status_callback_method,
435
+ **keyword_args
436
+ ))
437
+ end
438
+
439
+ # Create a <Number> element
440
+ #
441
+ # == Parameters:
442
+ # number:: phone number to dial
443
+ # send_digits:: play DTMF tones when the call is answered
444
+ # url:: TwiML URL
445
+ # method:: TwiML URL method
446
+ # status_callback_event:: events to call status callback
447
+ # status_callback:: status callback URL
448
+ # status_callback_method:: status callback URL method
449
+ # keyword_args:: additional attributes
450
+ #
451
+ # == Returns:
452
+ # A <Dial> element with a <Number> child element
453
+ def number(
454
+ number,
455
+ send_digits: nil,
456
+ url: nil,
457
+ method: nil,
458
+ status_callback: nil,
459
+ status_callback_event: nil,
460
+ status_callback_method: nil,
461
+ **keyword_args)
462
+
463
+ self.append(Number.new(
464
+ number,
465
+ send_digits: send_digits,
466
+ url: url,
467
+ method: method,
468
+ status_callback: status_callback,
469
+ status_callback_event: status_callback_event,
470
+ status_callback_method: status_callback_method,
471
+ **keyword_args
472
+ ))
473
+ end
474
+
475
+ # Create a <Queue> element
476
+ #
477
+ # == Parameters:
478
+ # queue_name:: queue name
479
+ # url:: action URL
480
+ # method:: action URL method
481
+ # reservation_sid:: TaskRouter reservation SID
482
+ # post_work_activity_sid:: TaskRouter activity SID
483
+ # keyword_args:: additional attributes
484
+ #
485
+ # == Returns:
486
+ # A <Dial> element with a <Queue> child element
487
+ def queue(
488
+ queue_name,
489
+ url: nil,
490
+ method: nil,
491
+ reservation_sid: nil,
492
+ post_work_activity_sid: nil,
493
+ **keyword_args)
494
+
495
+ self.append(Queue.new(
496
+ queue_name,
497
+ url: url,
498
+ method: method,
499
+ reservation_sid: reservation_sid,
500
+ post_work_activity_sid: post_work_activity_sid,
501
+ **keyword_args
502
+ ))
503
+ end
504
+
505
+ # Create a <Sim> element
506
+ #
507
+ # == Parameters:
508
+ # sid:: sim sid
509
+ # keyword_args:: additional attributes
510
+ #
511
+ # == Returns:
512
+ # A <Dial> element with a <Sim> child element
513
+ def sim(sid, **keyword_args)
514
+ self.append(Sim.new(sid,**keyword_args))
515
+ end
516
+
517
+ # Create a <Sip> element
518
+ #
519
+ # == Parameters:
520
+ # uri:: sip url
521
+ # username:: sip username
522
+ # password:: sip password
523
+ # url:: action URL
524
+ # method:: action URL method
525
+ # status_callback_event:: events to call status callback
526
+ # status_callback:: status callback URL
527
+ # status_callback_method:: status callback URL method
528
+ # keyword_args:: additional attributes
529
+ #
530
+ # == Returns:
531
+ # A <Dial> element with a <Sip> child element
532
+ def sip(
533
+ uri,
534
+ username: nil,
535
+ password: nil,
536
+ url: nil,
537
+ method: nil,
538
+ status_callback: nil,
539
+ status_callback_event: nil,
540
+ status_callback_method: nil,
541
+ **keyword_args)
542
+
543
+ self.append(Sip.new(
544
+ uri,
545
+ username: username,
546
+ password: password,
547
+ url: url,
548
+ method: method,
549
+ status_callback: status_callback,
550
+ status_callback_event: status_callback_event,
551
+ status_callback_method: status_callback_method,
552
+ **keyword_args
553
+ ))
554
+ end
555
+ end
556
+
557
+ # <Client> element
558
+ class Client < TwiML
559
+ # Create a <Client> element
560
+ #
561
+ # == Parameters:
562
+ # name:: name of client
563
+ # keyword_args:: additional attributes
564
+ #
565
+ # == Returns:
566
+ # A <Client> element
567
+ def initialize(name, **keyword_args)
568
+ super(**keyword_args)
569
+ @value = name
570
+ end
571
+ end
572
+
573
+ # <Conference> element
574
+ class Conference < TwiML
575
+ # Create a <Conference> element
576
+ #
577
+ # == Parameters:
578
+ # name:: name of conference
579
+ # keyword_args:: additional attributes
580
+ #
581
+ # == Returns:
582
+ # A <Conference> element
583
+ def initialize(name, **keyword_args)
584
+ super(**keyword_args)
585
+ @value = name
586
+ end
587
+ end
588
+
589
+ # <Number> element
590
+ class Number < TwiML
591
+ # Create a <Number> element
592
+ #
593
+ # == Parameters:
594
+ # number:: phone number
595
+ # keyword_args:: additional attributes
596
+ #
597
+ # == Returns:
598
+ # A <Number> element
599
+ def initialize(number, **keyword_args)
600
+ super(**keyword_args)
601
+ @value = number
602
+ end
603
+ end
604
+
605
+ # <Queue> element
606
+ class Queue < TwiML
607
+ # Create a <Queue> element
608
+ #
609
+ # == Parameters:
610
+ # queue_name:: name of queues
611
+ # keyword_args:: additional attributes
612
+ #
613
+ # == Returns:
614
+ # A <Queue> element
615
+ def initialize(queue_name, **keyword_args)
616
+ super(**keyword_args)
617
+ @value = queue_name
618
+ end
619
+ end
620
+
621
+ # <Sim> element
622
+ class Sim < TwiML
623
+ # Create a <Sim> element
624
+ #
625
+ # == Parameters:
626
+ # sid:: sim sid
627
+ # keyword_args:: additional attributes
628
+ #
629
+ # == Returns:
630
+ # A <Sim> element
631
+ def initialize(sid, **keyword_args)
632
+ super(**keyword_args)
633
+ @value = sid
634
+ end
635
+ end
636
+ # <Sip> element
637
+ class Sip < TwiML
638
+ # Create a <Sip> element
639
+ #
640
+ # == Parameters:
641
+ # uri:: sip uri
642
+ # keyword_args:: additional attributes
643
+ #
644
+ # == Returns:
645
+ # A <Sip> element
646
+ def initialize(uri, **keyword_args)
647
+ super(**keyword_args)
648
+ @value = uri
649
+ end
650
+ end
651
+
652
+ # <Echo> element
653
+ class Echo < TwiML
654
+ # Create a <Echo> element
655
+ #
656
+ # == Parameters:
657
+ # keyword_args:: additional attributes
658
+ #
659
+ # == Returns:
660
+ # A <Echo> element
661
+ def initialize(**keyword_args)
662
+ super(**keyword_args)
663
+ end
664
+ end
665
+
666
+ # <Enqueue> element
667
+ class Enqueue < TwiML
668
+ # Create a <Enqueue> element
669
+ #
670
+ # == Parameters:
671
+ # name:: queue name
672
+ # keyword_args:: additional attributes
673
+ #
674
+ # == Returns:
675
+ # A <Enqueue> element
676
+ def initialize(name, **keyword_args)
677
+ super(**keyword_args)
678
+ @value = name
679
+ end
680
+
681
+ # Create a <Task> element
682
+ #
683
+ # == Parameters:
684
+ # attributes:: attributes for a task
685
+ # keyword_args:: additional attributes
686
+ #
687
+ # == Returns:
688
+ # An <Enqueue> element with a <Task> child element
689
+ def task(attributes, **keyword_args)
690
+ self.append(Task.new(attributes, **keyword_args))
691
+ end
692
+ end
693
+
694
+ # <Task> element
695
+ class Task < TwiML
696
+ # Create a <Task> element
697
+ #
698
+ # == Parameters:
699
+ # attributes:: attributes for a task
700
+ # keyword_args:: additional attributes
701
+ #
702
+ # == Returns:
703
+ # A <Task> element
704
+ def initialize(attributes, **keyword_args)
705
+ super(**keyword_args)
706
+ if attributes.is_a?(String)
707
+ @value = attributes
708
+ else
709
+ @value = JSON.generate(attributes)
710
+ end
711
+ end
712
+ end
713
+
714
+ # <Gather> element
715
+ class Gather < TwiML
716
+ # Create a <Gather> element
717
+ #
718
+ # == Parameters:
719
+ # keyword_args:: additional attributes
720
+ #
721
+ # == Returns:
722
+ # A <Gather> element
723
+ def initialize(**keyword_args)
724
+ super(**keyword_args)
725
+ end
726
+
727
+ # Create a <Say> element
728
+ #
729
+ # == Parameters:
730
+ # name:: name of client
731
+ # body:: message body
732
+ # loop:: times to loop
733
+ # language:: message language
734
+ # voice:: voice to use
735
+ # keyword_args:: additional attributes
736
+ #
737
+ # == Returns:
738
+ # A <Gather> element with a <Say> child element
739
+ def say(
740
+ body,
741
+ loop: nil,
742
+ language: nil,
743
+ voice: nil,
744
+ **keyword_args)
745
+
746
+ self.append(Say.new(
747
+ body,
748
+ loop: loop,
749
+ language: language,
750
+ voice: voice,
751
+ **keyword_args
752
+ ))
753
+ end
754
+
755
+ # Create a <Play> element
756
+ #
757
+ # == Parameters:
758
+ # url:: media URL
759
+ # loop:: times to loop
760
+ # digits:: digits to simulate
761
+ # keyword_args:: additional attributes
762
+ #
763
+ # == Returns:
764
+ # A <Gather> element with a <Play> child element
765
+ def play(
766
+ url,
767
+ loop: nil,
768
+ digits: nil,
769
+ **keyword_args)
770
+
771
+ self.append(Play.new(
772
+ url,
773
+ loop: loop,
774
+ digits: digits,
775
+ **keyword_args
776
+ ))
777
+ end
778
+
779
+ # Create a <Pause> element
780
+ #
781
+ # == Parameters:
782
+ # length:: time to pause
783
+ #
784
+ # == Returns:
785
+ # A <Gather> element with a <Pause> child element
786
+ def pause(length: nil)
787
+ self.append(Pause.new(length: length))
788
+ end
789
+ end
790
+
791
+ # <Pause> element
792
+ class Pause < TwiML
793
+ # Create a <Pause> element
794
+ #
795
+ # == Parameters:
796
+ # keyword_args:: additional attributes
797
+ #
798
+ # == Returns:
799
+ # A <Pause> element
800
+ def initialize(**keyword_args)
801
+ super(**keyword_args)
802
+ end
803
+ end
804
+
805
+ # <Play> element
806
+ class Play < TwiML
807
+ # Create a <Play> element
808
+ #
809
+ # == Parameters:
810
+ # url:: media URL
811
+ # keyword_args:: additional attributes
812
+ #
813
+ # == Returns:
814
+ # A <Play> element
815
+ def initialize(url, **keyword_args)
816
+ super(**keyword_args)
817
+ @value = url
818
+ end
819
+ end
820
+
821
+ # <Say> element
822
+ class Say < TwiML
823
+ # Create a <Say> element
824
+ #
825
+ # == Parameters:
826
+ # body:: message body
827
+ # keyword_args:: additional attributes
828
+ #
829
+ # == Returns:
830
+ # A <Say> element
831
+ def initialize(body, **keyword_args)
832
+ super(**keyword_args)
833
+ @value = body
834
+ end
835
+ end
836
+
837
+ # <Hangup> element
838
+ class Hangup < TwiML
839
+ # Create a <hangup_on_star> element
840
+ #
841
+ # == Parameters:
842
+ # keyword_args:: additional attributes
843
+ #
844
+ # == Returns:
845
+ # A <hangup_on_star> element
846
+ def initialize(**keyword_args)
847
+ super(**keyword_args)
848
+ end
849
+ end
850
+
851
+ # <Leave> element
852
+ class Leave < TwiML
853
+ # Create a <Leave> element
854
+ #
855
+ # == Parameters:
856
+ # keyword_args:: additional attributes
857
+ #
858
+ # == Returns:
859
+ # A <Leave> element
860
+ def initialize(**keyword_args)
861
+ super(**keyword_args)
862
+ end
863
+ end
864
+
865
+ # <Record> element
866
+ class Record < TwiML
867
+ # Create a <Record> element
868
+ #
869
+ # == Parameters:
870
+ # keyword_args:: additional attributes
871
+ #
872
+ # == Returns:
873
+ # A <Record> element
874
+ def initialize(**keyword_args)
875
+ super(**keyword_args)
876
+ end
877
+ end
878
+
879
+ # <Redirect> element
880
+ class Redirect < TwiML
881
+ # Create a <Redirect> element
882
+ #
883
+ # == Parameters:
884
+ # url:: TwiML URL
885
+ # keyword_args:: additional attributes
886
+ #
887
+ # == Returns:
888
+ # A <Redirect> element
889
+ def initialize(url, **keyword_args)
890
+ super(**keyword_args)
891
+ @value = url
892
+ end
893
+ end
894
+
895
+ # <Reject> element
896
+ class Reject < TwiML
897
+ # Create a <Reject> element
898
+ #
899
+ # == Parameters:
900
+ # keyword_args:: additional attributes
901
+ #
902
+ # == Returns:
903
+ # A <Reject> element
904
+ def initialize(**keyword_args)
905
+ super(**keyword_args)
906
+ end
907
+ end
908
+
909
+ # <Sms> element
910
+ class Sms < TwiML
911
+ # Create a <Sms> element
912
+ #
913
+ # == Parameters:
914
+ # body:: message body
915
+ # keyword_args:: additional attributes
916
+ #
917
+ # == Returns:
918
+ # A <Sms> element
919
+ def initialize(body, **keyword_args)
920
+ super(**keyword_args)
921
+ @value = body
922
+ end
923
+ end
924
+ end
925
+ end