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
data/twilio-ruby.gemspec CHANGED
@@ -12,16 +12,17 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'A simple library for communicating with the Twilio REST API, building TwiML, and generating Twilio Client Capability Tokens'
13
13
  spec.homepage = 'http://github.com/twilio/twilio-ruby'
14
14
  spec.license = 'MIT'
15
+ spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0")
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ['lib']
20
- spec.required_ruby_version = '>= 1.9.3'
21
+ spec.required_ruby_version = '>= 2.0.0'
21
22
  spec.extra_rdoc_files = ['README.md', 'LICENSE.md']
22
23
  spec.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'twilio-ruby', '--main', 'README.md']
23
24
 
24
- spec.add_dependency('builder', '>= 2.1.2')
25
+ spec.add_dependency('libxml-ruby', '3.0.0')
25
26
  spec.add_dependency('jwt', '~> 1.5')
26
27
  spec.add_dependency('faraday', '~>0.9')
27
28
  spec.add_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'
@@ -29,6 +30,7 @@ Gem::Specification.new do |spec|
29
30
  spec.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
30
31
 
31
32
  spec.add_development_dependency 'bundler', '~> 1.5'
33
+ spec.add_development_dependency 'yard', '~> 0.9.9'
32
34
  spec.extra_rdoc_files = ['README.md', 'LICENSE.md']
33
35
  spec.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'twilio-ruby', '--main', 'README.md']
34
36
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc21
4
+ version: 5.0.0.rc22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Benton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: builder
14
+ name: libxml-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.2
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.2
26
+ version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jwt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.9
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.9
69
83
  description: A simple library for communicating with the Twilio REST API, building
70
84
  TwiML, and generating Twilio Client Capability Tokens
71
85
  email:
@@ -91,8 +105,6 @@ files:
91
105
  - examples/print-call-log.rb
92
106
  - lib/rack/twilio_webhook_authentication.rb
93
107
  - lib/twilio-ruby.rb
94
- - lib/twilio-ruby/compatibility/v2010/account/call/feedback.rb
95
- - lib/twilio-ruby/compatibility/v2010/account/queue/member.rb
96
108
  - lib/twilio-ruby/framework/domain.rb
97
109
  - lib/twilio-ruby/framework/error.rb
98
110
  - lib/twilio-ruby/framework/helper.rb
@@ -100,10 +112,12 @@ files:
100
112
  - lib/twilio-ruby/framework/resource.rb
101
113
  - lib/twilio-ruby/framework/serialize.rb
102
114
  - lib/twilio-ruby/framework/twilio_response.rb
115
+ - lib/twilio-ruby/framework/values.rb
103
116
  - lib/twilio-ruby/framework/version.rb
104
117
  - lib/twilio-ruby/http/http_client.rb
105
118
  - lib/twilio-ruby/jwt/access_token.rb
106
- - lib/twilio-ruby/jwt/capability.rb
119
+ - lib/twilio-ruby/jwt/client_capability.rb
120
+ - lib/twilio-ruby/jwt/jwt.rb
107
121
  - lib/twilio-ruby/jwt/task_router.rb
108
122
  - lib/twilio-ruby/rest/accounts.rb
109
123
  - lib/twilio-ruby/rest/accounts/v1.rb
@@ -335,7 +349,9 @@ files:
335
349
  - lib/twilio-ruby/rest/wireless/v1/sim.rb
336
350
  - lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb
337
351
  - lib/twilio-ruby/security/request_validator.rb
338
- - lib/twilio-ruby/twiml/response.rb
352
+ - lib/twilio-ruby/twiml/messaging_response.rb
353
+ - lib/twilio-ruby/twiml/twiml.rb
354
+ - lib/twilio-ruby/twiml/voice_response.rb
339
355
  - lib/twilio-ruby/util.rb
340
356
  - lib/twilio-ruby/util/configuration.rb
341
357
  - lib/twilio-ruby/version.rb
@@ -532,24 +548,23 @@ files:
532
548
  - spec/integration/wireless/v1/sim/usage_record_spec.rb
533
549
  - spec/integration/wireless/v1/sim_spec.rb
534
550
  - spec/jwt/access_token_spec.rb
535
- - spec/jwt/capability_spec.rb
551
+ - spec/jwt/client_capability_spec.rb
536
552
  - spec/jwt/task_router_spec.rb
537
- - spec/jwt/task_router_taskqueue_spec.rb
538
- - spec/jwt/task_router_worker_spec.rb
539
- - spec/jwt/task_router_workspace_spec.rb
540
553
  - spec/rack/twilio_webhook_authentication_spec.rb
541
554
  - spec/security/request_validator_spec.rb
542
555
  - spec/spec_helper.rb
543
556
  - spec/support/fakeweb.rb
544
557
  - spec/twilio_spec.rb
545
- - spec/twiml/twiml_response_spec.rb
558
+ - spec/twiml/messaging_response_spec.rb
559
+ - spec/twiml/voice_response_spec.rb
546
560
  - spec/util/configuration_spec.rb
547
561
  - spec/util/url_encode_spec.rb
548
562
  - twilio-ruby.gemspec
549
563
  homepage: http://github.com/twilio/twilio-ruby
550
564
  licenses:
551
565
  - MIT
552
- metadata: {}
566
+ metadata:
567
+ yard.run: yri
553
568
  post_install_message:
554
569
  rdoc_options:
555
570
  - "--line-numbers"
@@ -564,7 +579,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
564
579
  requirements:
565
580
  - - ">="
566
581
  - !ruby/object:Gem::Version
567
- version: 1.9.3
582
+ version: 2.0.0
568
583
  required_rubygems_version: !ruby/object:Gem::Requirement
569
584
  requirements:
570
585
  - - ">"
@@ -771,16 +786,14 @@ test_files:
771
786
  - spec/integration/wireless/v1/sim/usage_record_spec.rb
772
787
  - spec/integration/wireless/v1/sim_spec.rb
773
788
  - spec/jwt/access_token_spec.rb
774
- - spec/jwt/capability_spec.rb
789
+ - spec/jwt/client_capability_spec.rb
775
790
  - spec/jwt/task_router_spec.rb
776
- - spec/jwt/task_router_taskqueue_spec.rb
777
- - spec/jwt/task_router_worker_spec.rb
778
- - spec/jwt/task_router_workspace_spec.rb
779
791
  - spec/rack/twilio_webhook_authentication_spec.rb
780
792
  - spec/security/request_validator_spec.rb
781
793
  - spec/spec_helper.rb
782
794
  - spec/support/fakeweb.rb
783
795
  - spec/twilio_spec.rb
784
- - spec/twiml/twiml_response_spec.rb
796
+ - spec/twiml/messaging_response_spec.rb
797
+ - spec/twiml/voice_response_spec.rb
785
798
  - spec/util/configuration_spec.rb
786
799
  - spec/util/url_encode_spec.rb
@@ -1,15 +0,0 @@
1
- module Twilio
2
- module Resources
3
- module V2010
4
- class AccountInstance < Twilio::REST::InstanceResource
5
- class CallInstance < Twilio::REST::InstanceResource
6
- class FeedbackList < Twilio::REST::ListResource
7
- def get(sid=nil)
8
- internal_get sid
9
- end
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,23 +0,0 @@
1
- module Twilio
2
- module Resources
3
- module V2010
4
- class AccountInstance < Twilio::REST::InstanceResource
5
- class QueueInstance < Twilio::REST::InstanceResource
6
- class MemberList < Twilio::REST::ListResource
7
- def front
8
- get "Front"
9
- end
10
-
11
- def front!
12
- front.refresh
13
- end
14
-
15
- def dequeue(url, method='POST')
16
- front.dequeue url, method
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,64 +0,0 @@
1
- module Twilio
2
- module JWT
3
- class Capability
4
-
5
- include Twilio::Util
6
-
7
- def initialize(account_sid = nil, auth_token = nil)
8
- @account_sid = account_sid || Twilio.account_sid
9
- @auth_token = auth_token || Twilio.auth_token
10
- if @account_sid.nil? || @auth_token.nil?
11
- raise ArgumentError, 'Account SID and auth token are required'
12
- end
13
- @capabilities = []
14
- end
15
-
16
- def allow_client_incoming(client_name)
17
- @client_name = client_name # stash for use in outgoing
18
- scope_params = { clientName: client_name }
19
- @capabilities << scope_uri_for('client', 'incoming', scope_params)
20
- end
21
-
22
- def allow_client_outgoing(app_sid, params = {})
23
- @allow_client_outgoing = true
24
- @outgoing_scope_params = { appSid: app_sid }
25
- unless params.empty?
26
- @outgoing_scope_params['appParams'] = url_encode params
27
- end
28
- end
29
-
30
- def allow_event_stream(filters = {})
31
- scope_params = { path: '/2010-04-01/Events' }
32
- scope_params[:params] = filters unless filters.empty?
33
- @capabilities << scope_uri_for('stream', 'subscribe', scope_params)
34
- end
35
-
36
- def scope_uri_for(service, privilege, params = {})
37
- scope_uri = "scope:#{service}:#{privilege}"
38
- scope_uri << "?#{url_encode(params)}" unless params.empty?
39
- end
40
-
41
- def generate(ttl = 3600)
42
-
43
- capabilities = @capabilities.clone # we need a local copy to work on
44
-
45
- # build the outgoing scope lazily so that we can use @client_name
46
- if @allow_client_outgoing
47
- params = @outgoing_scope_params
48
- params.merge!('clientName' => @client_name) if @client_name
49
- capabilities << scope_uri_for('client', 'outgoing', params)
50
- end
51
-
52
- payload = {
53
- scope: capabilities.join(' '),
54
- iss: @account_sid,
55
- exp: (Time.now.to_i + ttl),
56
- }
57
-
58
- ::JWT.encode payload, @auth_token
59
-
60
- end
61
-
62
- end
63
- end
64
- end
@@ -1,16 +0,0 @@
1
- module Twilio
2
- module TwiML
3
- class Response
4
-
5
- attr_reader :text
6
- alias_method :to_xml , :text
7
-
8
- def initialize(&block)
9
- xml = Builder::XmlMarkup.new
10
- xml.instruct!
11
- @text = xml.Response &block
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,186 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Twilio::JWT::Capability do
4
- describe 'config' do
5
- after(:each) do
6
- Twilio.instance_variable_set('@configuration', nil)
7
- end
8
-
9
- it 'should set the account sid and auth token from a configuration block' do
10
- Twilio.configure do |config|
11
- config.account_sid = 'someSid'
12
- config.auth_token = 'someToken'
13
- end
14
-
15
- capability = Twilio::JWT::Capability.new
16
- expect(capability.instance_variable_get('@account_sid')).to eq('someSid')
17
- expect(capability.instance_variable_get('@auth_token')).to eq('someToken')
18
- end
19
-
20
- it 'should overwrite account sid and auth token if passed to initializer' do
21
- Twilio.configure do |config|
22
- config.account_sid = 'someSid'
23
- config.auth_token = 'someToken'
24
- end
25
-
26
- capability = Twilio::JWT::Capability.new'otherSid', 'otherToken'
27
- expect(capability.instance_variable_get('@account_sid')).to eq('otherSid')
28
- expect(capability.instance_variable_get('@auth_token')).to eq('otherToken')
29
- end
30
-
31
- it 'should overwrite the account sid if only the sid is given' do
32
- Twilio.configure do |config|
33
- config.account_sid = 'someSid'
34
- config.auth_token = 'someToken'
35
- end
36
-
37
- capability = Twilio::JWT::Capability.new 'otherSid'
38
- expect(capability.instance_variable_get('@account_sid')).to eq('otherSid')
39
- expect(capability.instance_variable_get('@auth_token')).to eq('someToken')
40
- end
41
-
42
- it 'should throw an argument error if the sid and token isn\'t set' do
43
- expect { Twilio::JWT::Capability.new }.to raise_error(ArgumentError)
44
- end
45
-
46
- it 'should throw an argument error if only the account_sid is set' do
47
- expect { Twilio::JWT::Capability.new 'someSid' }.to raise_error(ArgumentError)
48
- end
49
- end
50
-
51
- describe 'with a capability' do
52
- before :each do
53
- @capability = Twilio::JWT::Capability.new 'myAccountSid', 'myAuthToken'
54
- end
55
-
56
- def queries(q)
57
- q.scan(/scope:client:(incoming|outgoing)\?(\S+)/).map{|(type, query)| [type, Rack::Utils.parse_query(query)]}
58
- end
59
-
60
- it 'should return a valid jwt when #generate is called' do
61
- token = @capability.generate
62
- decoded, header = JWT.decode token, 'myAuthToken'
63
- expect(decoded['scope']).not_to be_nil
64
- expect(decoded['iss']).not_to be_nil
65
- expect(decoded['exp']).not_to be_nil
66
- end
67
-
68
- it 'should properly set the iss key in the payload' do
69
- token = @capability.generate
70
- decoded, header = JWT.decode token, 'myAuthToken'
71
- expect(decoded['iss']).to eq('myAccountSid')
72
- end
73
-
74
- it 'should properly set the exp key based on the default hour ttl' do
75
- seconds = Time.now.to_i
76
- token = @capability.generate
77
- decoded, header = JWT.decode token, 'myAuthToken'
78
- expect(decoded['exp']).to eq(seconds + 3600)
79
- end
80
-
81
- it 'should properly set the exp key based on the ttl passed to #generate' do
82
- ttl = rand 10000
83
- seconds = Time.now.to_i
84
- token = @capability.generate ttl
85
- decoded, header = JWT.decode token, 'myAuthToken'
86
- expect(decoded['exp']).to eq(seconds + ttl)
87
- end
88
-
89
- it 'should generate a proper incoming client scope string' do
90
- @capability.allow_client_incoming 'andrew'
91
- token = @capability.generate
92
- decoded, header = JWT.decode token, 'myAuthToken'
93
- expect(queries(decoded['scope'])).to eq([['incoming', {'clientName' => 'andrew'}]])
94
- end
95
-
96
- it 'should generate multiple proper incoming client scope strings' do
97
- @capability.allow_client_incoming 'andrew'
98
- @capability.allow_client_incoming 'bridget'
99
- token = @capability.generate
100
- decoded, header = JWT.decode token, 'myAuthToken'
101
- expect(queries(decoded['scope'])).to eq([
102
- ['incoming', {'clientName' => 'andrew'}],
103
- ['incoming', {'clientName' => 'bridget'}]
104
- ])
105
- end
106
-
107
- it 'should generate a proper outgoing client scope string' do
108
- @capability.allow_client_outgoing 'myAppSid'
109
- token = @capability.generate
110
- decoded, header = JWT.decode token, 'myAuthToken'
111
- expect(queries(decoded['scope'])).to eq([['outgoing', {'appSid' => 'myAppSid'}]])
112
- end
113
-
114
- it 'should generate a proper outgoing client scope string with parameters' do
115
- app_params_hash = {'key' => 'a value', :foo => 'bar/baz'}
116
- @capability.allow_client_outgoing 'myAppSid', app_params_hash
117
- app_params = @capability.instance_eval {url_encode(app_params_hash)}
118
- params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params}
119
- @capability.instance_eval {url_encode(params_hash)}
120
- token = @capability.generate
121
- decoded, header= JWT.decode token, 'myAuthToken'
122
- expect(queries(decoded['scope'])).to eq([['outgoing', params_hash]])
123
- end
124
-
125
- it 'should generate a proper outgoing client scope string based on the ' +
126
- 'client name when calling #allow_client_incoming first' do
127
- @capability.allow_client_incoming 'andrew'
128
- @capability.allow_client_outgoing 'myAppSid'
129
- token = @capability.generate
130
- decoded, header = JWT.decode token, 'myAuthToken'
131
- expect(queries(decoded['scope'])).to eq([
132
- ['incoming', {'clientName' => 'andrew'}],
133
- ['outgoing', {'clientName' => 'andrew', 'appSid' => 'myAppSid'}]
134
- ])
135
- end
136
-
137
- it 'should generate a proper outgoing client scope string based on the ' +
138
- 'client name when calling #allow_client_incoming second' do
139
- @capability.allow_client_outgoing 'myAppSid'
140
- @capability.allow_client_incoming 'andrew'
141
- token = @capability.generate
142
- decoded, header = JWT.decode token, 'myAuthToken'
143
- expect(queries(decoded['scope'])).to eq([["incoming", {"clientName"=>"andrew"}], ["outgoing", {"clientName"=>"andrew", "appSid"=>"myAppSid"}]])
144
- end
145
-
146
- it 'should generate a proper outgoing client scope string with parameters ' +
147
- 'and a client name when calling #allow_client_incoming first' do
148
- @capability.allow_client_incoming 'andrew'
149
- app_params_hash = {'key' => 'a value', :foo => 'bar/baz'}
150
- @capability.allow_client_outgoing 'myAppSid', app_params_hash
151
- app_params = @capability.instance_eval {url_encode(app_params_hash)}
152
- params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params, 'clientName' => 'andrew'}
153
- @capability.instance_eval {url_encode(params_hash)}
154
- token = @capability.generate
155
- decoded, header = JWT.decode token, 'myAuthToken'
156
- scopes = queries(decoded['scope'])
157
- expect(scopes.shift).to eq(["incoming", {"clientName"=>"andrew"}])
158
- scope = scopes.shift
159
- expect(scope.first).to eq('outgoing')
160
- expect(Rack::Utils.parse_query(scope.last['appParams'])).to eq({'key' => 'a value', 'foo' => 'bar/baz'})
161
- expect(scope.last["clientName"]).to eq("andrew")
162
- expect(scope.last["appSid"]).to eq("myAppSid")
163
- expect(scopes).to be_empty
164
- end
165
-
166
- it 'should generate a proper outgoing client scope string with parameters ' +
167
- 'and a client name when calling #allow_client_incoming second' do
168
- app_params_hash = {'key' => 'a value', :foo => 'bar/baz'}
169
- @capability.allow_client_outgoing 'myAppSid', app_params_hash
170
- @capability.allow_client_incoming 'andrew'
171
- app_params = @capability.instance_eval {url_encode(app_params_hash)}
172
- params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params, 'clientName' => 'andrew'}
173
- @capability.instance_eval {url_encode(params_hash)}
174
- token = @capability.generate
175
- decoded, header = JWT.decode token, 'myAuthToken'
176
- scopes = queries(decoded['scope'])
177
- expect(scopes.shift).to eq(["incoming", {"clientName"=>"andrew"}])
178
- scope = scopes.shift
179
- expect(scope.first).to eq('outgoing')
180
- expect(Rack::Utils.parse_query(scope.last['appParams'])).to eq({'key' => 'a value', 'foo' => 'bar/baz'})
181
- expect(scope.last["clientName"]).to eq("andrew")
182
- expect(scope.last["appSid"]).to eq("myAppSid")
183
- expect(scopes).to be_empty
184
- end
185
- end
186
- end