twilio-ruby 4.6.1 → 6.9.0
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.
- checksums.yaml +4 -4
- data/.dockerignore +1 -0
- data/.github/workflows/pr-lint.yml +21 -0
- data/.github/workflows/test-and-deploy.yml +139 -0
- data/.gitignore +14 -1
- data/.rubocop.yml +59 -0
- data/.rubocop_todo.yml +261 -0
- data/AUTHORS.md +46 -32
- data/CHANGES.md +3355 -22
- data/CODE_OF_CONDUCT.md +73 -0
- data/CONTRIBUTING.md +163 -0
- data/Dockerfile +9 -0
- data/Gemfile +1 -8
- data/ISSUE_TEMPLATE.md +30 -0
- data/{LICENSE.md → LICENSE} +12 -12
- data/Makefile +28 -6
- data/PULL_REQUEST_TEMPLATE.md +31 -0
- data/README.md +233 -143
- data/UPGRADE.md +40 -0
- data/VERSIONS.md +35 -0
- data/advanced-examples/custom-http-client.md +170 -0
- data/cluster_spec.rb +77 -0
- data/examples/examples.rb +47 -58
- data/examples/{print-call-log.rb → print_call_log.rb} +6 -6
- data/githooks/pre-commit +1 -0
- data/lib/rack/twilio_webhook_authentication.rb +32 -7
- data/lib/twilio-ruby/base/client_base.rb +121 -0
- data/lib/twilio-ruby/framework/request.rb +41 -0
- data/lib/twilio-ruby/framework/response.rb +18 -0
- data/lib/twilio-ruby/framework/rest/domain.rb +36 -0
- data/lib/twilio-ruby/framework/rest/error.rb +39 -0
- data/lib/twilio-ruby/framework/rest/helper.rb +11 -0
- data/lib/twilio-ruby/framework/rest/obsolete_client.rb +12 -0
- data/lib/twilio-ruby/framework/rest/page.rb +103 -0
- data/lib/twilio-ruby/framework/rest/resource.rb +23 -0
- data/lib/twilio-ruby/framework/rest/version.rb +153 -0
- data/lib/twilio-ruby/framework/serialize.rb +81 -0
- data/lib/twilio-ruby/framework/values.rb +9 -0
- data/lib/twilio-ruby/http/http_client.rb +79 -0
- data/lib/twilio-ruby/http.rb +5 -0
- data/lib/twilio-ruby/jwt/access_token.rb +226 -0
- data/lib/twilio-ruby/jwt/client_capability.rb +102 -0
- data/lib/twilio-ruby/jwt/jwt.rb +59 -0
- data/lib/twilio-ruby/jwt/task_router.rb +172 -0
- data/lib/twilio-ruby/rest/accounts/v1/auth_token_promotion.rb +206 -0
- data/lib/twilio-ruby/rest/accounts/v1/credential/aws.rb +378 -0
- data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +378 -0
- data/lib/twilio-ruby/rest/accounts/v1/credential.rb +129 -0
- data/lib/twilio-ruby/rest/accounts/v1/safelist.rb +169 -0
- data/lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb +222 -0
- data/lib/twilio-ruby/rest/accounts/v1.rb +58 -0
- data/lib/twilio-ruby/rest/accounts.rb +20 -10
- data/lib/twilio-ruby/rest/accounts_base.rb +38 -0
- data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +377 -0
- data/lib/twilio-ruby/rest/api/v2010/account/address.rb +558 -0
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +622 -0
- data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +320 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/local.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/machine_to_machine.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/national.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/shared_cost.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/toll_free.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/voip.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country.rb +432 -0
- data/lib/twilio-ruby/rest/api/v2010/account/balance.rb +143 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +209 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +264 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +328 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +411 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +324 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +505 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +872 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +872 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message.rb +163 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb +239 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +959 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +663 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +462 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +496 -0
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +433 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +337 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +411 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +543 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +543 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +543 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +848 -0
- data/lib/twilio-ruby/rest/api/v2010/account/key.rb +342 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +174 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +351 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +622 -0
- data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +164 -0
- data/lib/twilio-ruby/rest/api/v2010/account/new_signing_key.rb +164 -0
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +407 -0
- data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +375 -0
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +351 -0
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +433 -0
- data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +365 -0
- data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +381 -0
- data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +375 -0
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +514 -0
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +424 -0
- data/lib/twilio-ruby/rest/api/v2010/account/signing_key.rb +342 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +394 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +412 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.rb +346 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.rb +346 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.rb +140 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.rb +346 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.rb +126 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb +126 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +356 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +356 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +664 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +423 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +412 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +148 -0
- data/lib/twilio-ruby/rest/api/v2010/account/token.rb +178 -0
- data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +371 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +326 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +388 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +496 -0
- data/lib/twilio-ruby/rest/api/v2010/account/usage.rb +128 -0
- data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +179 -0
- data/lib/twilio-ruby/rest/api/v2010/account.rb +989 -0
- data/lib/twilio-ruby/rest/api/v2010.rb +132 -0
- data/lib/twilio-ruby/rest/api.rb +238 -0
- data/lib/twilio-ruby/rest/api_base.rb +38 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +241 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +217 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +389 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +435 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +409 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +473 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +241 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +373 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +436 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +253 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb +226 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +525 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb +433 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +683 -0
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +207 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +55 -0
- data/lib/twilio-ruby/rest/autopilot.rb +22 -0
- data/lib/twilio-ruby/rest/autopilot_base.rb +38 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +306 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +305 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +278 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +254 -0
- data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +253 -0
- data/lib/twilio-ruby/rest/bulkexports/v1.rb +64 -0
- data/lib/twilio-ruby/rest/bulkexports.rb +25 -0
- data/lib/twilio-ruby/rest/bulkexports_base.rb +38 -0
- data/lib/twilio-ruby/rest/chat/v1/credential.rb +429 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +385 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +433 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +449 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +541 -0
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +403 -0
- data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +251 -0
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +472 -0
- data/lib/twilio-ruby/rest/chat/v1/service.rb +871 -0
- data/lib/twilio-ruby/rest/chat/v1.rb +64 -0
- data/lib/twilio-ruby/rest/chat/v2/credential.rb +429 -0
- data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +378 -0
- data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +385 -0
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +497 -0
- data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +524 -0
- data/lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb +451 -0
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +613 -0
- data/lib/twilio-ruby/rest/chat/v2/service/role.rb +403 -0
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +375 -0
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +417 -0
- data/lib/twilio-ruby/rest/chat/v2/service/user.rb +516 -0
- data/lib/twilio-ruby/rest/chat/v2/service.rb +774 -0
- data/lib/twilio-ruby/rest/chat/v2.rb +64 -0
- data/lib/twilio-ruby/rest/chat/v3/channel.rb +297 -0
- data/lib/twilio-ruby/rest/chat/v3.rb +71 -0
- data/lib/twilio-ruby/rest/chat.rb +35 -0
- data/lib/twilio-ruby/rest/chat_base.rb +48 -0
- data/lib/twilio-ruby/rest/client.rb +340 -164
- data/lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb +208 -0
- data/lib/twilio-ruby/rest/content/v1/content.rb +363 -0
- data/lib/twilio-ruby/rest/content/v1/content_and_approvals.rb +251 -0
- data/lib/twilio-ruby/rest/content/v1/legacy_content.rb +265 -0
- data/lib/twilio-ruby/rest/content/v1.rb +61 -0
- data/lib/twilio-ruby/rest/content.rb +15 -0
- data/lib/twilio-ruby/rest/content_base.rb +38 -0
- data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +482 -0
- data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +281 -0
- data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +287 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +345 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +544 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +505 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +432 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +630 -0
- data/lib/twilio-ruby/rest/conversations/v1/credential.rb +435 -0
- data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
- data/lib/twilio-ruby/rest/conversations/v1/role.rb +394 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +371 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +334 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +280 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +314 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +356 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +557 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +518 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +445 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +639 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +317 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +403 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +457 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +491 -0
- data/lib/twilio-ruby/rest/conversations/v1/service.rb +486 -0
- data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +452 -0
- data/lib/twilio-ruby/rest/conversations/v1/user.rb +482 -0
- data/lib/twilio-ruby/rest/conversations/v1.rb +136 -0
- data/lib/twilio-ruby/rest/conversations.rb +79 -0
- data/lib/twilio-ruby/rest/conversations_base.rb +38 -0
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +312 -0
- data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +299 -0
- data/lib/twilio-ruby/rest/events/v1/schema.rb +235 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +129 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +136 -0
- data/lib/twilio-ruby/rest/events/v1/sink.rb +444 -0
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +372 -0
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +426 -0
- data/lib/twilio-ruby/rest/events/v1.rb +94 -0
- data/lib/twilio-ruby/rest/events.rb +43 -0
- data/lib/twilio-ruby/rest/events_base.rb +38 -0
- data/lib/twilio-ruby/rest/flex_api/v1/assessments.rb +448 -0
- data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +375 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +518 -0
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +573 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_assessments_comment.rb +327 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_conversations.rb +228 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb +442 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_category.rb +358 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb +443 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_segments.rb +361 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_session.rb +217 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_answer_sets.rb +155 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_comment.rb +141 -0
- data/lib/twilio-ruby/rest/flex_api/v1/insights_user_roles.rb +196 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +251 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +339 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +406 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +267 -0
- data/lib/twilio-ruby/rest/flex_api/v1/provisioning_status.rb +187 -0
- data/lib/twilio-ruby/rest/flex_api/v1/web_channel.rb +388 -0
- data/lib/twilio-ruby/rest/flex_api/v1.rb +208 -0
- data/lib/twilio-ruby/rest/flex_api/v2/web_channels.rb +146 -0
- data/lib/twilio-ruby/rest/flex_api/v2.rb +40 -0
- data/lib/twilio-ruby/rest/flex_api.rb +73 -0
- data/lib/twilio-ruby/rest/flex_api_base.rb +43 -0
- data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +275 -0
- data/lib/twilio-ruby/rest/frontline_api/v1.rb +49 -0
- data/lib/twilio-ruby/rest/frontline_api.rb +15 -0
- data/lib/twilio-ruby/rest/frontline_api_base.rb +38 -0
- data/lib/twilio-ruby/rest/insights/v1/call/annotation.rb +319 -0
- data/lib/twilio-ruby/rest/insights/v1/call/call_summary.rb +350 -0
- data/lib/twilio-ruby/rest/insights/v1/call/event.rb +276 -0
- data/lib/twilio-ruby/rest/insights/v1/call/metric.rb +268 -0
- data/lib/twilio-ruby/rest/insights/v1/call.rb +268 -0
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +493 -0
- data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +488 -0
- data/lib/twilio-ruby/rest/insights/v1/conference.rb +505 -0
- data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +385 -0
- data/lib/twilio-ruby/rest/insights/v1/room.rb +500 -0
- data/lib/twilio-ruby/rest/insights/v1/setting.rb +254 -0
- data/lib/twilio-ruby/rest/insights/v1.rb +91 -0
- data/lib/twilio-ruby/rest/insights.rb +46 -0
- data/lib/twilio-ruby/rest/insights_base.rb +38 -0
- data/lib/twilio-ruby/rest/intelligence/v2/service.rb +510 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb +226 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb +388 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript/sentence.rb +248 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript.rb +520 -0
- data/lib/twilio-ruby/rest/intelligence/v2.rb +64 -0
- data/lib/twilio-ruby/rest/intelligence.rb +6 -0
- data/lib/twilio-ruby/rest/intelligence_base.rb +38 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +429 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +385 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +433 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +449 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +541 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +403 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +251 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +472 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +871 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1.rb +64 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +429 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +378 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +385 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +497 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +524 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +451 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +613 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +403 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +375 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +408 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +516 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +774 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2.rb +64 -0
- data/lib/twilio-ruby/rest/ip_messaging.rb +23 -0
- data/lib/twilio-ruby/rest/ip_messaging_base.rb +43 -0
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +251 -0
- data/lib/twilio-ruby/rest/lookups/v1.rb +49 -0
- data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +370 -0
- data/lib/twilio-ruby/rest/lookups/v2.rb +49 -0
- data/lib/twilio-ruby/rest/lookups.rb +16 -0
- data/lib/twilio-ruby/rest/lookups_base.rb +43 -0
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +420 -0
- data/lib/twilio-ruby/rest/media/v1/media_recording.rb +404 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +252 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +432 -0
- data/lib/twilio-ruby/rest/media/v1.rb +79 -0
- data/lib/twilio-ruby/rest/media.rb +28 -7
- data/lib/twilio-ruby/rest/media_base.rb +38 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_registration_otp.rb +136 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +365 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +497 -0
- data/lib/twilio-ruby/rest/messaging/v1/deactivations.rb +189 -0
- data/lib/twilio-ruby/rest/messaging/v1/domain_certs.rb +280 -0
- data/lib/twilio-ruby/rest/messaging/v1/domain_config.rb +289 -0
- data/lib/twilio-ruby/rest/messaging/v1/domain_config_messaging_service.rb +238 -0
- data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +161 -0
- data/lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb +214 -0
- data/lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service_domain_association.rb +196 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +358 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/channel_sender.rb +329 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +365 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +365 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +513 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +135 -0
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +777 -0
- data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +777 -0
- data/lib/twilio-ruby/rest/messaging/v1/usecase.rb +123 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +194 -0
- data/lib/twilio-ruby/rest/messaging.rb +74 -0
- data/lib/twilio-ruby/rest/messaging_base.rb +38 -0
- data/lib/twilio-ruby/rest/microvisor/v1/account_config.rb +358 -0
- data/lib/twilio-ruby/rest/microvisor/v1/account_secret.rb +351 -0
- data/lib/twilio-ruby/rest/microvisor/v1/app/app_manifest.rb +208 -0
- data/lib/twilio-ruby/rest/microvisor/v1/app.rb +349 -0
- data/lib/twilio-ruby/rest/microvisor/v1/device/device_config.rb +374 -0
- data/lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb +367 -0
- data/lib/twilio-ruby/rest/microvisor/v1/device.rb +427 -0
- data/lib/twilio-ruby/rest/microvisor/v1.rb +94 -0
- data/lib/twilio-ruby/rest/microvisor.rb +24 -0
- data/lib/twilio-ruby/rest/microvisor_base.rb +38 -0
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +408 -0
- data/lib/twilio-ruby/rest/monitor/v1/event.rb +391 -0
- data/lib/twilio-ruby/rest/monitor/v1.rb +64 -0
- data/lib/twilio-ruby/rest/monitor.rb +25 -0
- data/lib/twilio-ruby/rest/monitor_base.rb +38 -0
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +431 -0
- data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +444 -0
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +320 -0
- data/lib/twilio-ruby/rest/notify/v1/service.rb +636 -0
- data/lib/twilio-ruby/rest/notify/v1.rb +64 -0
- data/lib/twilio-ruby/rest/notify.rb +25 -0
- data/lib/twilio-ruby/rest/notify_base.rb +38 -0
- data/lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb +224 -0
- data/lib/twilio-ruby/rest/numbers/v1/porting_bulk_portability.rb +229 -0
- data/lib/twilio-ruby/rest/numbers/v1/porting_port_in_fetch.rb +245 -0
- data/lib/twilio-ruby/rest/numbers/v1/porting_portability.rb +263 -0
- data/lib/twilio-ruby/rest/numbers/v1.rb +94 -0
- data/lib/twilio-ruby/rest/numbers/v2/authorization_document/dependent_hosted_number_order.rb +343 -0
- data/lib/twilio-ruby/rest/numbers/v2/authorization_document.rb +403 -0
- data/lib/twilio-ruby/rest/numbers/v2/bulk_hosted_number_order.rb +249 -0
- data/lib/twilio-ruby/rest/numbers/v2/hosted_number_order.rb +502 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +285 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +335 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb +344 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +201 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +608 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +398 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user_type.rb +297 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb +329 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +419 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb +297 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +185 -0
- data/lib/twilio-ruby/rest/numbers/v2.rb +85 -0
- data/lib/twilio-ruby/rest/numbers.rb +12 -0
- data/lib/twilio-ruby/rest/numbers_base.rb +43 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb +417 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb +401 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb +456 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb +414 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb +504 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices.rb +49 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +377 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +456 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +620 -0
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +64 -0
- data/lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb +308 -0
- data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +335 -0
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb +349 -0
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +439 -0
- data/lib/twilio-ruby/rest/preview/marketplace.rb +64 -0
- data/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb +389 -0
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +449 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +445 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb +389 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +426 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +448 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb +389 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +426 -0
- data/lib/twilio-ruby/rest/preview/sync/service.rb +505 -0
- data/lib/twilio-ruby/rest/preview/sync.rb +49 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb +241 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb +241 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb +217 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb +389 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +435 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb +409 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +463 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +241 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb +373 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb +436 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb +253 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +226 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +525 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +663 -0
- data/lib/twilio-ruby/rest/preview/understand.rb +49 -0
- data/lib/twilio-ruby/rest/preview/wireless/command.rb +397 -0
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +458 -0
- data/lib/twilio-ruby/rest/preview/wireless/sim/usage.rb +260 -0
- data/lib/twilio-ruby/rest/preview/wireless/sim.rb +584 -0
- data/lib/twilio-ruby/rest/preview/wireless.rb +79 -0
- data/lib/twilio-ruby/rest/preview.rb +102 -0
- data/lib/twilio-ruby/rest/preview_base.rb +63 -0
- data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +304 -0
- data/lib/twilio-ruby/rest/pricing/v1/messaging.rb +115 -0
- data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +297 -0
- data/lib/twilio-ruby/rest/pricing/v1/phone_number.rb +115 -0
- data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +304 -0
- data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +227 -0
- data/lib/twilio-ruby/rest/pricing/v1/voice.rb +129 -0
- data/lib/twilio-ruby/rest/pricing/v1.rb +52 -0
- data/lib/twilio-ruby/rest/pricing/v2/country.rb +299 -0
- data/lib/twilio-ruby/rest/pricing/v2/number.rb +240 -0
- data/lib/twilio-ruby/rest/pricing/v2/voice/country.rb +304 -0
- data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +245 -0
- data/lib/twilio-ruby/rest/pricing/v2/voice.rb +129 -0
- data/lib/twilio-ruby/rest/pricing/v2.rb +70 -0
- data/lib/twilio-ruby/rest/pricing.rb +43 -2
- data/lib/twilio-ruby/rest/pricing_base.rb +43 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +426 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +419 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +439 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +434 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +529 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +406 -0
- data/lib/twilio-ruby/rest/proxy/v1/service.rb +569 -0
- data/lib/twilio-ruby/rest/proxy/v1.rb +49 -0
- data/lib/twilio-ruby/rest/proxy.rb +15 -0
- data/lib/twilio-ruby/rest/proxy_base.rb +38 -0
- data/lib/twilio-ruby/rest/routes/v2/phone_number.rb +268 -0
- data/lib/twilio-ruby/rest/routes/v2/sip_domain.rb +268 -0
- data/lib/twilio-ruby/rest/routes/v2/trunk.rb +268 -0
- data/lib/twilio-ruby/rest/routes/v2.rb +79 -0
- data/lib/twilio-ruby/rest/routes.rb +32 -0
- data/lib/twilio-ruby/rest/routes_base.rb +38 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +326 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +419 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/build/build_status.rb +219 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +414 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +347 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +372 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +414 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +463 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +230 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +353 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +419 -0
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +533 -0
- data/lib/twilio-ruby/rest/serverless/v1.rb +49 -0
- data/lib/twilio-ruby/rest/serverless.rb +15 -0
- data/lib/twilio-ruby/rest/serverless_base.rb +38 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb +217 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb +228 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb +372 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +429 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb +217 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb +228 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step.rb +372 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +475 -0
- data/lib/twilio-ruby/rest/studio/v1/flow.rb +390 -0
- data/lib/twilio-ruby/rest/studio/v1.rb +49 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +217 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +228 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +372 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +468 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +348 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb +232 -0
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +529 -0
- data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +139 -0
- data/lib/twilio-ruby/rest/studio/v2.rb +55 -0
- data/lib/twilio-ruby/rest/studio.rb +22 -0
- data/lib/twilio-ruby/rest/studio_base.rb +43 -0
- data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +403 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +482 -0
- data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +408 -0
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +312 -0
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +344 -0
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +390 -0
- data/lib/twilio-ruby/rest/supersim/v1/settings_update.rb +256 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +249 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim/sim_ip_address.rb +207 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +470 -0
- data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +368 -0
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +313 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +151 -0
- data/lib/twilio-ruby/rest/supersim.rb +88 -0
- data/lib/twilio-ruby/rest/supersim_base.rb +38 -0
- data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +387 -0
- data/lib/twilio-ruby/rest/sync/v1/service/document.rb +463 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +477 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +387 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +477 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +480 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +387 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +477 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +146 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +426 -0
- data/lib/twilio-ruby/rest/sync/v1/service.rb +585 -0
- data/lib/twilio-ruby/rest/sync/v1.rb +49 -0
- data/lib/twilio-ruby/rest/sync.rb +15 -0
- data/lib/twilio-ruby/rest/sync_base.rb +38 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +412 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +449 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +716 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +630 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +416 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +371 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +291 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +259 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +266 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +581 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +698 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +400 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +246 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb +293 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.rb +226 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +262 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +630 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +371 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.rb +256 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +259 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +530 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +360 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +259 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +248 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +730 -0
- data/lib/twilio-ruby/rest/taskrouter/v1.rb +49 -0
- data/lib/twilio-ruby/rest/taskrouter.rb +15 -0
- data/lib/twilio-ruby/rest/taskrouter_base.rb +38 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +349 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +349 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +447 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +482 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +231 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +633 -0
- data/lib/twilio-ruby/rest/trunking/v1.rb +49 -0
- data/lib/twilio-ruby/rest/trunking.rb +15 -0
- data/lib/twilio-ruby/rest/trunking_base.rb +38 -0
- data/lib/twilio-ruby/rest/trusthub/v1/compliance_inquiries.rb +232 -0
- data/lib/twilio-ruby/rest/trusthub/v1/compliance_tollfree_inquiries.rb +211 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +364 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb +342 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb +340 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +535 -0
- data/lib/twilio-ruby/rest/trusthub/v1/end_user.rb +393 -0
- data/lib/twilio-ruby/rest/trusthub/v1/end_user_type.rb +292 -0
- data/lib/twilio-ruby/rest/trusthub/v1/policies.rb +285 -0
- data/lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb +407 -0
- data/lib/twilio-ruby/rest/trusthub/v1/supporting_document_type.rb +292 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +364 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb +342 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb +340 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +535 -0
- data/lib/twilio-ruby/rest/trusthub/v1.rb +160 -0
- data/lib/twilio-ruby/rest/trusthub.rb +74 -0
- data/lib/twilio-ruby/rest/trusthub_base.rb +38 -0
- data/lib/twilio-ruby/rest/verify/v2/form.rb +203 -0
- data/lib/twilio-ruby/rest/verify/v2/safelist.rb +231 -0
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +279 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +198 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +508 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +458 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +269 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +429 -0
- data/lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb +386 -0
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb +412 -0
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +427 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +387 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +225 -0
- data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +454 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +792 -0
- data/lib/twilio-ruby/rest/verify/v2/template.rb +229 -0
- data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +382 -0
- data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +247 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +106 -0
- data/lib/twilio-ruby/rest/verify.rb +58 -0
- data/lib/twilio-ruby/rest/verify_base.rb +38 -0
- data/lib/twilio-ruby/rest/video/v1/composition.rb +487 -0
- data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +535 -0
- data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +289 -0
- data/lib/twilio-ruby/rest/video/v1/recording.rb +436 -0
- data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +289 -0
- data/lib/twilio-ruby/rest/video/v1/room/participant/anonymize.rb +259 -0
- data/lib/twilio-ruby/rest/video/v1/room/participant/published_track.rb +331 -0
- data/lib/twilio-ruby/rest/video/v1/room/participant/subscribe_rules.rb +181 -0
- data/lib/twilio-ruby/rest/video/v1/room/participant/subscribed_track.rb +338 -0
- data/lib/twilio-ruby/rest/video/v1/room/participant.rb +498 -0
- data/lib/twilio-ruby/rest/video/v1/room/recording_rules.rb +170 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_recording.rb +423 -0
- data/lib/twilio-ruby/rest/video/v1/room.rb +616 -0
- data/lib/twilio-ruby/rest/video/v1.rb +106 -0
- data/lib/twilio-ruby/rest/video.rb +59 -0
- data/lib/twilio-ruby/rest/video_base.rb +38 -0
- data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +168 -0
- data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +511 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +447 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +401 -0
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/bulk_country_update.rb +142 -0
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.rb +202 -0
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +382 -0
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/settings.rb +224 -0
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +130 -0
- data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +387 -0
- data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +370 -0
- data/lib/twilio-ruby/rest/voice/v1.rb +137 -0
- data/lib/twilio-ruby/rest/voice.rb +61 -0
- data/lib/twilio-ruby/rest/voice_base.rb +38 -0
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +418 -0
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +473 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +305 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +246 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +644 -0
- data/lib/twilio-ruby/rest/wireless/v1/usage_record.rb +234 -0
- data/lib/twilio-ruby/rest/wireless/v1.rb +85 -0
- data/lib/twilio-ruby/rest/wireless.rb +42 -0
- data/lib/twilio-ruby/rest/wireless_base.rb +38 -0
- data/lib/twilio-ruby/rest.rb +14 -0
- data/lib/twilio-ruby/security/request_validator.rb +150 -0
- data/lib/twilio-ruby/twiml/fax_response.rb +45 -0
- data/lib/twilio-ruby/twiml/messaging_response.rb +107 -0
- data/lib/twilio-ruby/twiml/twiml.rb +126 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +1952 -0
- data/lib/twilio-ruby/util/configuration.rb +27 -1
- data/lib/twilio-ruby/util.rb +5 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/lib/twilio-ruby.rb +18 -95
- data/sonar-project.properties +13 -0
- data/twilio-ruby.gemspec +22 -15
- metadata +807 -248
- data/.travis.yml +0 -31
- data/conf/cacert.pem +0 -3376
- data/docs/Makefile +0 -130
- data/docs/_themes/LICENSE +0 -45
- data/docs/_themes/README.rst +0 -25
- data/docs/_themes/flask_theme_support.py +0 -86
- data/docs/_themes/kr/layout.html +0 -32
- data/docs/_themes/kr/relations.html +0 -19
- data/docs/_themes/kr/static/flasky.css_t +0 -469
- data/docs/_themes/kr/static/small_flask.css +0 -70
- data/docs/_themes/kr/theme.conf +0 -7
- data/docs/_themes/kr_small/layout.html +0 -22
- data/docs/_themes/kr_small/static/flasky.css_t +0 -287
- data/docs/_themes/kr_small/theme.conf +0 -10
- data/docs/changelog.rst +0 -1
- data/docs/conf.py +0 -266
- data/docs/faq.rst +0 -42
- data/docs/getting-started.rst +0 -117
- data/docs/index.rst +0 -135
- data/docs/make.bat +0 -170
- data/docs/src/pip-delete-this-directory.txt +0 -5
- data/docs/usage/accounts.rst +0 -89
- data/docs/usage/addresses.rst +0 -101
- data/docs/usage/applications.rst +0 -108
- data/docs/usage/basics.rst +0 -115
- data/docs/usage/caller-ids.rst +0 -47
- data/docs/usage/conferences.rst +0 -108
- data/docs/usage/errors.rst +0 -29
- data/docs/usage/lookups.rst +0 -62
- data/docs/usage/messages.rst +0 -137
- data/docs/usage/notifications.rst +0 -72
- data/docs/usage/phone-calls.rst +0 -185
- data/docs/usage/phone-numbers.rst +0 -189
- data/docs/usage/pricing.rst +0 -169
- data/docs/usage/queues.rst +0 -112
- data/docs/usage/recordings.rst +0 -98
- data/docs/usage/sip.rst +0 -104
- data/docs/usage/taskrouter-tokens.rst +0 -98
- data/docs/usage/taskrouter.rst +0 -440
- data/docs/usage/token-generation.rst +0 -115
- data/docs/usage/transcriptions.rst +0 -32
- data/docs/usage/twiml.rst +0 -69
- data/docs/usage/validation.rst +0 -107
- data/examples/taskrouter.examples.rb +0 -86
- data/lib/twilio-ruby/rest/addresses/dependent_phone_numbers.rb +0 -6
- data/lib/twilio-ruby/rest/addresses.rb +0 -12
- data/lib/twilio-ruby/rest/applications.rb +0 -6
- data/lib/twilio-ruby/rest/authorized_connect_apps.rb +0 -6
- data/lib/twilio-ruby/rest/available_phone_numbers/country.rb +0 -10
- data/lib/twilio-ruby/rest/available_phone_numbers/local.rb +0 -11
- data/lib/twilio-ruby/rest/available_phone_numbers/mobile.rb +0 -11
- data/lib/twilio-ruby/rest/available_phone_numbers/toll_free.rb +0 -11
- data/lib/twilio-ruby/rest/available_phone_numbers.rb +0 -13
- data/lib/twilio-ruby/rest/base_client.rb +0 -130
- data/lib/twilio-ruby/rest/call_feedback.rb +0 -28
- data/lib/twilio-ruby/rest/call_feedback_summary.rb +0 -13
- data/lib/twilio-ruby/rest/calls.rb +0 -33
- data/lib/twilio-ruby/rest/conferences/participants.rb +0 -23
- data/lib/twilio-ruby/rest/conferences.rb +0 -12
- data/lib/twilio-ruby/rest/connect_apps.rb +0 -6
- data/lib/twilio-ruby/rest/errors.rb +0 -14
- data/lib/twilio-ruby/rest/incoming_phone_numbers/local.rb +0 -13
- data/lib/twilio-ruby/rest/incoming_phone_numbers/mobile.rb +0 -13
- data/lib/twilio-ruby/rest/incoming_phone_numbers/toll_free.rb +0 -13
- data/lib/twilio-ruby/rest/incoming_phone_numbers.rb +0 -17
- data/lib/twilio-ruby/rest/instance_resource.rb +0 -87
- data/lib/twilio-ruby/rest/keys.rb +0 -6
- data/lib/twilio-ruby/rest/list_resource.rb +0 -100
- data/lib/twilio-ruby/rest/lookups/phone_numbers.rb +0 -17
- data/lib/twilio-ruby/rest/lookups_client.rb +0 -99
- data/lib/twilio-ruby/rest/messages.rb +0 -22
- data/lib/twilio-ruby/rest/monitor/alerts.rb +0 -8
- data/lib/twilio-ruby/rest/monitor/events.rb +0 -8
- data/lib/twilio-ruby/rest/monitor_client.rb +0 -101
- data/lib/twilio-ruby/rest/next_gen_list_resource.rb +0 -36
- data/lib/twilio-ruby/rest/notifications.rb +0 -6
- data/lib/twilio-ruby/rest/outgoing_caller_ids.rb +0 -25
- data/lib/twilio-ruby/rest/pricing/countries.rb +0 -21
- data/lib/twilio-ruby/rest/pricing/messaging.rb +0 -15
- data/lib/twilio-ruby/rest/pricing/phone_numbers.rb +0 -14
- data/lib/twilio-ruby/rest/pricing/voice/numbers.rb +0 -19
- data/lib/twilio-ruby/rest/pricing/voice.rb +0 -15
- data/lib/twilio-ruby/rest/pricing_client.rb +0 -108
- data/lib/twilio-ruby/rest/queues/members.rb +0 -29
- data/lib/twilio-ruby/rest/queues.rb +0 -12
- data/lib/twilio-ruby/rest/recordings.rb +0 -35
- data/lib/twilio-ruby/rest/sandbox.rb +0 -5
- data/lib/twilio-ruby/rest/sip/credential_lists/credentials.rb +0 -6
- data/lib/twilio-ruby/rest/sip/credential_lists.rb +0 -11
- data/lib/twilio-ruby/rest/sip/domains/credential_list_mappings.rb +0 -6
- data/lib/twilio-ruby/rest/sip/domains/ip_access_control_list_mappings.rb +0 -6
- data/lib/twilio-ruby/rest/sip/domains.rb +0 -12
- data/lib/twilio-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb +0 -6
- data/lib/twilio-ruby/rest/sip/ip_access_control_lists.rb +0 -11
- data/lib/twilio-ruby/rest/sip.rb +0 -10
- data/lib/twilio-ruby/rest/sms/messages.rb +0 -38
- data/lib/twilio-ruby/rest/sms/short_codes.rb +0 -8
- data/lib/twilio-ruby/rest/sms.rb +0 -11
- data/lib/twilio-ruby/rest/task_router/activities.rb +0 -8
- data/lib/twilio-ruby/rest/task_router/events.rb +0 -8
- data/lib/twilio-ruby/rest/task_router/reservations.rb +0 -8
- data/lib/twilio-ruby/rest/task_router/statistics.rb +0 -26
- data/lib/twilio-ruby/rest/task_router/task_queues.rb +0 -17
- data/lib/twilio-ruby/rest/task_router/task_queues_statistics.rb +0 -15
- data/lib/twilio-ruby/rest/task_router/tasks.rb +0 -15
- data/lib/twilio-ruby/rest/task_router/workers.rb +0 -19
- data/lib/twilio-ruby/rest/task_router/workers_statistics.rb +0 -8
- data/lib/twilio-ruby/rest/task_router/workflow_statistics.rb +0 -7
- data/lib/twilio-ruby/rest/task_router/workflows.rb +0 -11
- data/lib/twilio-ruby/rest/task_router/workspace_statistics.rb +0 -7
- data/lib/twilio-ruby/rest/task_router/workspaces.rb +0 -17
- data/lib/twilio-ruby/rest/task_router_client.rb +0 -176
- data/lib/twilio-ruby/rest/tokens.rb +0 -7
- data/lib/twilio-ruby/rest/transcriptions.rb +0 -6
- data/lib/twilio-ruby/rest/trunking/credential_lists.rb +0 -8
- data/lib/twilio-ruby/rest/trunking/ip_access_control_lists.rb +0 -8
- data/lib/twilio-ruby/rest/trunking/origination_urls.rb +0 -8
- data/lib/twilio-ruby/rest/trunking/phone_numbers.rb +0 -8
- data/lib/twilio-ruby/rest/trunking/trunks.rb +0 -19
- data/lib/twilio-ruby/rest/trunking_client.rb +0 -106
- data/lib/twilio-ruby/rest/usage/records.rb +0 -21
- data/lib/twilio-ruby/rest/usage/triggers.rb +0 -12
- data/lib/twilio-ruby/rest/usage.rb +0 -10
- data/lib/twilio-ruby/rest/utils.rb +0 -49
- data/lib/twilio-ruby/task_router/capability.rb +0 -224
- data/lib/twilio-ruby/task_router/workflow_builder.rb +0 -129
- data/lib/twilio-ruby/task_router.rb +0 -0
- data/lib/twilio-ruby/twiml/response.rb +0 -16
- data/lib/twilio-ruby/util/capability.rb +0 -64
- data/lib/twilio-ruby/util/client_config.rb +0 -29
- data/lib/twilio-ruby/util/request_validator.rb +0 -37
- data/spec/rack/twilio_webhook_authentication_spec.rb +0 -110
- data/spec/rest/account_spec.rb +0 -89
- data/spec/rest/address_spec.rb +0 -11
- data/spec/rest/call_feedback_spec.rb +0 -12
- data/spec/rest/call_feedback_summary_spec.rb +0 -9
- data/spec/rest/call_spec.rb +0 -22
- data/spec/rest/client_spec.rb +0 -277
- data/spec/rest/conference_spec.rb +0 -11
- data/spec/rest/instance_resource_spec.rb +0 -15
- data/spec/rest/key_spec.rb +0 -11
- data/spec/rest/lookups/phone_number_spec.rb +0 -28
- data/spec/rest/message_spec.rb +0 -12
- data/spec/rest/monitor_client_spec.rb +0 -17
- data/spec/rest/numbers_spec.rb +0 -58
- data/spec/rest/pricing_client_spec.rb +0 -45
- data/spec/rest/queue_spec.rb +0 -11
- data/spec/rest/recording_spec.rb +0 -11
- data/spec/rest/sms/message_spec.rb +0 -37
- data/spec/rest/sms/messages_spec.rb +0 -31
- data/spec/rest/task_router/reservation_spec.rb +0 -14
- data/spec/rest/task_router/statistics_spec.rb +0 -37
- data/spec/rest/task_router/task_queue_spec.rb +0 -9
- data/spec/rest/token_spec.rb +0 -7
- data/spec/rest/trunking/trunk_spec.rb +0 -36
- data/spec/rest/utils_spec.rb +0 -45
- data/spec/spec_helper.rb +0 -15
- data/spec/support/fakeweb.rb +0 -2
- data/spec/task_router_deprecated_spec.rb +0 -130
- data/spec/task_router_spec.rb +0 -110
- data/spec/task_router_taskqueue_spec.rb +0 -111
- data/spec/task_router_worker_spec.rb +0 -129
- data/spec/task_router_workspace_spec.rb +0 -110
- data/spec/twilio_spec.rb +0 -15
- data/spec/util/capability_spec.rb +0 -186
- data/spec/util/client_config_spec.rb +0 -21
- data/spec/util/configuration_spec.rb +0 -15
- data/spec/util/request_validator_spec.rb +0 -113
- data/spec/util/url_encode_spec.rb +0 -12
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Custom HTTP Clients for the Twilio Ruby Helper Library
|
|
2
|
+
|
|
3
|
+
If you are working with the Twilio Ruby Helper Library, and you need to be able to modify the HTTP requests that the library makes to the Twilio servers, you’re in the right place. The most common need to alter the HTTP request is to connect and authenticate with an enterprise’s proxy server. We’ll provide sample code that you can drop right into your app to handle this use case.
|
|
4
|
+
|
|
5
|
+
Connect and authenticate with a proxy server
|
|
6
|
+
To connect and provide credentials to a proxy server that may be between your app and Twilio, you need a way to modify the HTTP requests that the Twilio helper library makes on your behalf to invoke the Twilio REST API.
|
|
7
|
+
|
|
8
|
+
The Twilio Ruby helper library uses the [Faraday](https://rubygems.org/gems/faraday) gem under the hood to make the HTTP requests. The following example shows a typical request, without a custom `http_client`:
|
|
9
|
+
|
|
10
|
+
```rb
|
|
11
|
+
@client = Twilio::REST::Client.new(account_sid, auth_token)
|
|
12
|
+
|
|
13
|
+
message = @client.messages
|
|
14
|
+
.create(
|
|
15
|
+
to: "+15558675310",
|
|
16
|
+
body: "Hey there!",
|
|
17
|
+
from: "+15017122661",
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Out of the box, the helper library is creating a default `Twilio::Http::Client` for you, using the Twilio credentials you provide. However, you can create your own `Twilio::Http::Client`, and pass it to any Twilio REST API resource action you want.
|
|
22
|
+
|
|
23
|
+
Here’s an example of sending an SMS message with a custom client:
|
|
24
|
+
|
|
25
|
+
```rb
|
|
26
|
+
# Download the helper library from https://www.twilio.com/docs/ruby/install
|
|
27
|
+
require "rubygems"
|
|
28
|
+
require "twilio-ruby"
|
|
29
|
+
require "dotenv/load"
|
|
30
|
+
|
|
31
|
+
# Custom HTTP Client
|
|
32
|
+
require_relative "MyRequestClass"
|
|
33
|
+
|
|
34
|
+
# Your Account Sid and Auth Token from twilio.com/console
|
|
35
|
+
account_sid = ENV["ACCOUNT_SID"]
|
|
36
|
+
auth_token = ENV["AUTH_TOKEN"]
|
|
37
|
+
proxy_address = ENV["PROXY_ADDRESS"]
|
|
38
|
+
proxy_protocol = ENV["PROXY_PROTOCOL"]
|
|
39
|
+
proxy_port = ENV["PROXY_PORT"]
|
|
40
|
+
|
|
41
|
+
my_request_client = MyRequestClass.new(proxy_protocol, proxy_address, proxy_port)
|
|
42
|
+
|
|
43
|
+
@client = Twilio::REST::Client.new(account_sid, auth_token,
|
|
44
|
+
nil, nil, my_request_client)
|
|
45
|
+
|
|
46
|
+
message = @client.messages
|
|
47
|
+
.create(
|
|
48
|
+
to: "+593978613041",
|
|
49
|
+
body: "RB This is the ship that made the Kesssssel Run in fourteen parsecs?",
|
|
50
|
+
from: "+13212855389",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
puts "Message SID: #{message.sid}"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Create your custom TwilioRestClient
|
|
57
|
+
|
|
58
|
+
When you take a closer look at the constructor for `Twilio::Http::Client`, you see that this class provides it to the Twilio helper library to make the necessary HTTP requests.
|
|
59
|
+
|
|
60
|
+
## Call Twilio through the proxy server
|
|
61
|
+
|
|
62
|
+
Now that we understand how all the components fit together, we can create our own `http_client` that can connect through a proxy server. To make this reusable, here’s a class that you can use to create this `http_client` whenever you need one.
|
|
63
|
+
|
|
64
|
+
```rb
|
|
65
|
+
class MyRequestClass
|
|
66
|
+
attr_accessor :adapter
|
|
67
|
+
attr_reader :timeout, :last_response, :last_request
|
|
68
|
+
|
|
69
|
+
def initialize(proxy_prot = nil, proxy_addr = nil, proxy_port = nil, timeout: nil)
|
|
70
|
+
@proxy_prot = proxy_prot
|
|
71
|
+
@proxy_addr = proxy_addr
|
|
72
|
+
@proxy_port = proxy_port
|
|
73
|
+
@timeout = timeout
|
|
74
|
+
@adapter = Faraday.default_adapter
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def _request(request)
|
|
78
|
+
@connection = Faraday.new(url: request.host + ":" + request.port.to_s, ssl: { verify: true }) do |f|
|
|
79
|
+
f.options.params_encoder = Faraday::FlatParamsEncoder
|
|
80
|
+
f.request :url_encoded
|
|
81
|
+
f.adapter @adapter
|
|
82
|
+
f.headers = request.headers
|
|
83
|
+
f.basic_auth(request.auth[0], request.auth[1])
|
|
84
|
+
if @proxy_addr
|
|
85
|
+
f.proxy = "#{@proxy_prot}://#{@proxy_addr}:#{@proxy_port}"
|
|
86
|
+
end
|
|
87
|
+
f.options.open_timeout = request.timeout || @timeout
|
|
88
|
+
f.options.timeout = request.timeout || @timeout
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
@last_request = request
|
|
92
|
+
@last_response = nil
|
|
93
|
+
response = @connection.send(request.method.downcase.to_sym,
|
|
94
|
+
request.url,
|
|
95
|
+
request.method == "GET" ? request.params : request.data)
|
|
96
|
+
|
|
97
|
+
if response.body && !response.body.empty?
|
|
98
|
+
object = response.body
|
|
99
|
+
elsif response.status == 400
|
|
100
|
+
object = { message: "Bad request", code: 400 }.to_json
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
twilio_response = Twilio::Response.new(response.status, object, headers: response.headers)
|
|
104
|
+
@last_response = twilio_response
|
|
105
|
+
|
|
106
|
+
twilio_response
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def request(host, port, method, url, params = {}, data = {}, headers = {}, auth = nil, timeout = nil)
|
|
110
|
+
request = Twilio::Request.new(host, port, method, url, params, data, headers, auth, timeout)
|
|
111
|
+
_request(request)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
In this example, we are using some environment variables loaded at the program startup to retrieve various configuration settings:
|
|
117
|
+
|
|
118
|
+
- Your Twilio Account Sid and Auth Token ([found here, in the Twilio console](https://console.twilio.com))
|
|
119
|
+
- A proxy address in the form of `http://127.0.0.1:8888`
|
|
120
|
+
|
|
121
|
+
These settings are located in a file like `.env` like so:
|
|
122
|
+
|
|
123
|
+
```env
|
|
124
|
+
ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
125
|
+
AUTH_TOKEN= your_auth_token
|
|
126
|
+
|
|
127
|
+
HTTPS_PROXY=https://127.0.0.1:8888
|
|
128
|
+
HTTP_PROXY=http://127.0.0.1:8888
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Here’s the full console program that sends a text message and shows how it all can work together. It loads the `.env` file.
|
|
132
|
+
|
|
133
|
+
```rb
|
|
134
|
+
# Download the helper library from https://www.twilio.com/docs/ruby/install
|
|
135
|
+
require "rubygems"
|
|
136
|
+
require "twilio-ruby"
|
|
137
|
+
require "dotenv/load"
|
|
138
|
+
|
|
139
|
+
# Custom HTTP Client
|
|
140
|
+
require_relative "MyRequestClass"
|
|
141
|
+
|
|
142
|
+
# Your Account Sid and Auth Token from twilio.com/console
|
|
143
|
+
account_sid = ENV["ACCOUNT_SID"]
|
|
144
|
+
auth_token = ENV["AUTH_TOKEN"]
|
|
145
|
+
proxy_address = ENV["PROXY_ADDRESS"]
|
|
146
|
+
proxy_protocol = ENV["PROXY_PROTOCOL"]
|
|
147
|
+
proxy_port = ENV["PROXY_PORT"]
|
|
148
|
+
|
|
149
|
+
my_request_client = MyRequestClass.new(proxy_protocol, proxy_address, proxy_port)
|
|
150
|
+
|
|
151
|
+
@client = Twilio::REST::Client.new(account_sid, auth_token,
|
|
152
|
+
nil, nil, my_request_client)
|
|
153
|
+
|
|
154
|
+
message = @client.messages
|
|
155
|
+
.create(
|
|
156
|
+
to: "+593978613041",
|
|
157
|
+
body: "RB This is the ship that made the Kesssssel Run in fourteen parsecs?",
|
|
158
|
+
from: "+13212855389",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
puts "Message SID: #{message.sid}"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## What else can this technique be used for?
|
|
165
|
+
|
|
166
|
+
Now that you know how to inject your own `http_client` into the Twilio API request pipeline, you could use this technique to add custom HTTP headers and authorization to the requests (perhaps as required by an upstream proxy server).
|
|
167
|
+
|
|
168
|
+
You could also implement your own `http_client` to mock the Twilio API responses so your unit and integration tests can run quickly without the need to make a connection to Twilio. In fact, there’s already an example online showing [how to do exactly that with Node.js and Prism](https://www.twilio.com/docs/openapi/mock-api-generation-with-twilio-openapi-spec).
|
|
169
|
+
|
|
170
|
+
We can’t wait to see what you build!
|
data/cluster_spec.rb
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'rspec/matchers'
|
|
2
|
+
require 'twilio-ruby'
|
|
3
|
+
|
|
4
|
+
# rubocop:disable Metrics/BlockLength
|
|
5
|
+
describe 'Cluster Test' do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@account_sid = ENV['TWILIO_ACCOUNT_SID']
|
|
8
|
+
@secret = ENV['TWILIO_API_SECRET']
|
|
9
|
+
@api_key = ENV['TWILIO_API_KEY']
|
|
10
|
+
@to_number = ENV['TWILIO_TO_NUMBER']
|
|
11
|
+
@from_number = ENV['TWILIO_FROM_NUMBER']
|
|
12
|
+
@client = Twilio::REST::Client.new @api_key, @secret, @account_sid
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'can send a text' do
|
|
16
|
+
message = @client.messages.create(
|
|
17
|
+
to: @to_number,
|
|
18
|
+
from: @from_number,
|
|
19
|
+
body: 'Cluster test message from twilio-ruby'
|
|
20
|
+
)
|
|
21
|
+
expect(message).to_not eq(nil)
|
|
22
|
+
expect(message.body.include?('Cluster test message from twilio-ruby')).to eq(true)
|
|
23
|
+
expect(message.from).to eq(@from_number)
|
|
24
|
+
expect(message.to).to eq(@to_number)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'can list numbers' do
|
|
28
|
+
phone_numbers = @client.incoming_phone_numbers.list
|
|
29
|
+
expect(phone_numbers).to_not eq(nil)
|
|
30
|
+
expect(phone_numbers).to_not match_array([])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'list a number' do
|
|
34
|
+
phone_numbers = @client.incoming_phone_numbers.list(phone_number: @from_number)
|
|
35
|
+
expect(phone_numbers).to_not eq(nil)
|
|
36
|
+
expect(phone_numbers[0].phone_number).to eq(@from_number)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'allows special characters for friendly and identity name' do
|
|
40
|
+
service = @client.chat.v2.services.create(friendly_name: 'service|friendly&name')
|
|
41
|
+
expect(service).to_not eq(nil)
|
|
42
|
+
|
|
43
|
+
user = @client.chat.v2.services(service.sid).users.create(identity: 'user|identity&string')
|
|
44
|
+
expect(user).to_not eq(nil)
|
|
45
|
+
|
|
46
|
+
is_user_deleted = @client.chat.v2.services(service.sid).users(user.sid).delete
|
|
47
|
+
expect(is_user_deleted).to eq(true)
|
|
48
|
+
|
|
49
|
+
is_service_deleted = @client.chat.v2.services(service.sid).delete
|
|
50
|
+
expect(is_service_deleted).to eq(true)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'test list params' do
|
|
54
|
+
sink_configuration = { 'destination' => 'http://example.org/webhook', 'method' => 'post',
|
|
55
|
+
'batch_events' => false }
|
|
56
|
+
types = [{ 'type' => 'com.twilio.messaging.message.delivered' },
|
|
57
|
+
{ 'type' => 'com.twilio.messaging.message.sent' }]
|
|
58
|
+
|
|
59
|
+
sink = @client.events.v1.sinks.create(
|
|
60
|
+
description: 'test sink ruby',
|
|
61
|
+
sink_configuration: sink_configuration,
|
|
62
|
+
sink_type: 'webhook'
|
|
63
|
+
)
|
|
64
|
+
expect(sink).to_not eq(nil)
|
|
65
|
+
|
|
66
|
+
subscription = @client.events.v1.subscriptions.create(
|
|
67
|
+
description: 'test subscription ruby',
|
|
68
|
+
types: types,
|
|
69
|
+
sink_sid: sink.sid
|
|
70
|
+
)
|
|
71
|
+
expect(subscription).to_not eq(nil)
|
|
72
|
+
|
|
73
|
+
expect(@client.events.v1.subscriptions(subscription.sid).delete).to eq(true)
|
|
74
|
+
expect(@client.events.v1.sinks(sink.sid).delete).to eq(true)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
# rubocop:enable Metrics/BlockLength
|
data/examples/examples.rb
CHANGED
|
@@ -1,148 +1,137 @@
|
|
|
1
|
-
# examples version
|
|
1
|
+
# examples version
|
|
2
2
|
|
|
3
|
-
@account_sid = '
|
|
4
|
-
@auth_token = '
|
|
3
|
+
@account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
|
4
|
+
@auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
5
5
|
# set up a client
|
|
6
6
|
@client = Twilio::REST::Client.new(@account_sid, @auth_token)
|
|
7
7
|
|
|
8
8
|
################ ACCOUNTS ################
|
|
9
9
|
|
|
10
10
|
# shortcut to grab your account object (account_sid is inferred from the client's auth credentials)
|
|
11
|
-
@account = @client.account
|
|
11
|
+
@account = @client.api.account
|
|
12
12
|
|
|
13
13
|
# list your (sub)accounts
|
|
14
|
-
@client.accounts.
|
|
14
|
+
@accounts = @client.api.accounts.each do |account|
|
|
15
|
+
puts(account)
|
|
16
|
+
end
|
|
15
17
|
|
|
16
18
|
# grab an account instance resource if you know the sid
|
|
17
|
-
@account = @client.accounts
|
|
18
|
-
|
|
19
|
-
puts @account.friendly_name
|
|
19
|
+
@account = @client.api.accounts(account_sid).fetch
|
|
20
|
+
puts(@account.friendly_name)
|
|
20
21
|
|
|
21
22
|
# update an account's friendly name
|
|
22
|
-
@client.accounts
|
|
23
|
+
@client.api.accounts(account_sid).update(friendly_name: 'A Fabulous Friendly Name')
|
|
23
24
|
|
|
24
25
|
################ CALLS ################
|
|
25
26
|
|
|
26
27
|
# print a list of calls (all parameters optional)
|
|
27
|
-
@
|
|
28
|
-
page: 0,
|
|
29
|
-
page_size: 1000,
|
|
30
|
-
start_time: '2010-09-01'
|
|
31
|
-
).each do |call|
|
|
28
|
+
@client.calls.list(limit: 10, start_time: '2010-09-01').each do |call|
|
|
32
29
|
puts call.sid
|
|
33
30
|
end
|
|
34
31
|
|
|
35
32
|
# get a particular call and list its recording urls
|
|
36
|
-
@
|
|
33
|
+
@client.calls('CAXXXXXXX').recordings.each do |r|
|
|
37
34
|
puts r.wav
|
|
38
35
|
end
|
|
39
36
|
|
|
40
37
|
# make a new outgoing call. returns a call object just like calls.get
|
|
41
|
-
@call = @
|
|
38
|
+
@call = @client.calls.create(
|
|
42
39
|
from: '+14159341234',
|
|
43
40
|
to: '+18004567890',
|
|
44
41
|
url: 'http://example.com/call-handler'
|
|
45
42
|
)
|
|
46
43
|
|
|
47
44
|
# cancel the call if not already in progress
|
|
48
|
-
@
|
|
49
|
-
# or equivalently
|
|
50
|
-
@call.update(status: 'canceled')
|
|
51
|
-
# or simply
|
|
52
|
-
@call.cancel
|
|
45
|
+
@client.calls(@call.sid).update(status: 'canceled')
|
|
53
46
|
|
|
54
47
|
# redirect and then terminate a call
|
|
55
|
-
@call =
|
|
48
|
+
@call = client.calls('CAXXXXXXX')
|
|
56
49
|
@call.update(url: 'http://example.com/call-redirect')
|
|
57
50
|
@call.update(status: 'completed')
|
|
58
|
-
# or, use the aliases...
|
|
59
|
-
@call.redirect_to('http://example.com/call-redirect')
|
|
60
|
-
@call.hangup
|
|
61
51
|
|
|
62
52
|
################ SMS MESSAGES ################
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
puts message.body
|
|
54
|
+
@client.messages.list(date_sent: '2010-09-01').each do |message|
|
|
55
|
+
puts message.date_created
|
|
67
56
|
end
|
|
68
57
|
|
|
69
58
|
# print a particular sms message
|
|
70
|
-
puts @
|
|
59
|
+
puts @client.messages('SMXXXXXXXX').fetch.body
|
|
71
60
|
|
|
72
61
|
# send an sms
|
|
73
|
-
@
|
|
62
|
+
@client.messages.create(
|
|
74
63
|
from: '+14159341234',
|
|
75
64
|
to: '+16105557069',
|
|
76
65
|
body: 'Hey there!'
|
|
77
66
|
)
|
|
78
67
|
|
|
79
68
|
# send an mms
|
|
80
|
-
@
|
|
69
|
+
@client.messages.create(
|
|
81
70
|
from: '+14159341234',
|
|
82
71
|
to: '+16105557069',
|
|
83
|
-
|
|
72
|
+
media_url: 'http://example.com/media.png'
|
|
84
73
|
)
|
|
85
74
|
|
|
86
75
|
################ PHONE NUMBERS ################
|
|
87
76
|
|
|
88
77
|
# get a list of supported country codes
|
|
89
|
-
@
|
|
78
|
+
@client.available_phone_numbers.list
|
|
90
79
|
|
|
91
80
|
# print some available numbers
|
|
92
|
-
@
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
@client.available_phone_numbers('US').local.list.each do |num|
|
|
82
|
+
puts num
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
@numbers = @client.available_phone_numbers('US').local.list(area_code: '908')
|
|
95
86
|
@numbers.each { |num| puts num.phone_number }
|
|
96
87
|
|
|
97
88
|
# buy the first one
|
|
98
|
-
@
|
|
89
|
+
@client.incoming_phone_numbers.create(phone_number: @numbers[0].phone_number)
|
|
99
90
|
|
|
100
91
|
# update an existing phone number's voice url
|
|
101
|
-
|
|
102
|
-
number.update(voice_url: 'http://example.com/voice')
|
|
92
|
+
@client.incoming_phone_numbers('PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').update(voice_url: 'http://example.com/voice')
|
|
103
93
|
|
|
104
94
|
# decommission an existing phone number
|
|
105
|
-
numbers = @
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
|
|
95
|
+
numbers = @client.incoming_phone_numbers.list(friendly_name: 'A Fabulous Friendly Name')
|
|
96
|
+
number = numbers[0].sid
|
|
97
|
+
@client.incoming_phone_numbers(number).delete
|
|
98
|
+
|
|
109
99
|
################ CONFERENCES ################
|
|
110
100
|
|
|
111
101
|
# get a particular conference's participants object and stash it
|
|
112
|
-
conference = @
|
|
102
|
+
conference = @client.conferences('CFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').fetch
|
|
113
103
|
@participants = conference.participants
|
|
114
104
|
|
|
115
105
|
# list participants
|
|
116
|
-
@participants.
|
|
106
|
+
@participants.each do |p|
|
|
117
107
|
puts p.sid
|
|
118
108
|
end
|
|
119
109
|
|
|
120
110
|
# update a conference participant
|
|
121
|
-
@
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
# and, since we're lazy loading, this would only incur one http request
|
|
126
|
-
@account.conferences.get('CFbbe46ff1274e283f7e3ac1df0072ab39').participants
|
|
127
|
-
.get('CA386025c9bf5d6052a1d1ea42b4d16662').update(muted: 'true')
|
|
111
|
+
@client
|
|
112
|
+
.conferences('CFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
|
|
113
|
+
.participants('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
|
|
114
|
+
.update(muted: 'true')
|
|
128
115
|
|
|
129
116
|
################ QUEUES ###################
|
|
130
117
|
|
|
131
118
|
# create a new queue
|
|
132
|
-
@queue = @
|
|
119
|
+
@queue = @client.queues.create(friendly_name: 'MyQueue', max_size: 50)
|
|
133
120
|
|
|
134
121
|
# get a list of queues for this account
|
|
135
|
-
@queues = @
|
|
122
|
+
@queues = @client.queues.list
|
|
136
123
|
|
|
137
124
|
# get a particular queue and its members
|
|
138
|
-
@queue = @
|
|
125
|
+
@queue = @client.queues('QQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').fetch
|
|
139
126
|
@members = @queue.members
|
|
140
127
|
|
|
141
|
-
#list members
|
|
128
|
+
# list members
|
|
142
129
|
@members.list.each do |m|
|
|
143
130
|
puts m.wait_time
|
|
144
131
|
end
|
|
145
132
|
|
|
146
133
|
# dequeue a particular user and run twiml at a specific url
|
|
147
|
-
@
|
|
148
|
-
|
|
134
|
+
@client
|
|
135
|
+
.queues('QQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
|
|
136
|
+
.members('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
|
|
137
|
+
.update(url: 'http://myapp.com/deque', method: 'POST')
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
1
|
require 'twilio-ruby'
|
|
3
2
|
|
|
4
3
|
# print a list of all phone calls, what phone number each was to/from, and how
|
|
@@ -7,18 +6,19 @@ require 'twilio-ruby'
|
|
|
7
6
|
# put your Twilio credentials here. you can find your AccountSid and AuthToken
|
|
8
7
|
# at the top of your account dashboard page located at:
|
|
9
8
|
# https://www.twilio.com/user/account
|
|
10
|
-
account_sid = '
|
|
11
|
-
auth_token = '
|
|
9
|
+
account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
|
10
|
+
auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
12
11
|
|
|
13
12
|
# set up a client
|
|
14
13
|
client = Twilio::REST::Client.new(account_sid, auth_token)
|
|
15
14
|
|
|
16
15
|
calls = client.calls.list
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
loop do
|
|
19
18
|
calls.each do |call|
|
|
20
19
|
price = call.price || '0.00' # since apparently prices can be nil...
|
|
21
|
-
puts call.sid + "\t" + call.from + "\t" + call.to + "\t" + price
|
|
20
|
+
puts call.sid + "\t" + call.from + "\t" + call.to + "\t" + price.to_s
|
|
22
21
|
end
|
|
23
22
|
calls = calls.next_page
|
|
24
|
-
|
|
23
|
+
break if calls.nil?
|
|
24
|
+
end
|
data/githooks/pre-commit
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
make test
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rack/media_type'
|
|
4
|
+
|
|
1
5
|
module Rack
|
|
2
6
|
# Middleware that authenticates webhooks from Twilio using the request
|
|
3
7
|
# validator.
|
|
@@ -17,6 +21,10 @@ module Rack
|
|
|
17
21
|
# doesn't validate then the middleware responds immediately with a 403 status.
|
|
18
22
|
|
|
19
23
|
class TwilioWebhookAuthentication
|
|
24
|
+
# Rack's FORM_DATA_MEDIA_TYPES can be modified to taste, so we're slightly
|
|
25
|
+
# more conservative in what we consider form data.
|
|
26
|
+
FORM_URLENCODED_MEDIA_TYPE = Rack::MediaType.type('application/x-www-form-urlencoded')
|
|
27
|
+
|
|
20
28
|
def initialize(app, auth_token, *paths, &auth_token_lookup)
|
|
21
29
|
@app = app
|
|
22
30
|
@auth_token = auth_token
|
|
@@ -25,23 +33,40 @@ module Rack
|
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
def call(env)
|
|
28
|
-
return @app.call(env) unless env[
|
|
36
|
+
return @app.call(env) unless env['PATH_INFO'].match(@path_regex)
|
|
29
37
|
request = Rack::Request.new(env)
|
|
30
38
|
original_url = request.url
|
|
31
|
-
params = request
|
|
39
|
+
params = extract_params!(request)
|
|
32
40
|
auth_token = @auth_token || get_auth_token(params['AccountSid'])
|
|
33
|
-
validator = Twilio::
|
|
34
|
-
signature = env['HTTP_X_TWILIO_SIGNATURE'] ||
|
|
41
|
+
validator = Twilio::Security::RequestValidator.new(auth_token)
|
|
42
|
+
signature = env['HTTP_X_TWILIO_SIGNATURE'] || ''
|
|
35
43
|
if validator.validate(original_url, params, signature)
|
|
36
44
|
@app.call(env)
|
|
37
45
|
else
|
|
38
46
|
[
|
|
39
47
|
403,
|
|
40
|
-
{'Content-Type' => 'text/plain'},
|
|
41
|
-
[
|
|
48
|
+
{ 'Content-Type' => 'text/plain' },
|
|
49
|
+
['Twilio Request Validation Failed.']
|
|
42
50
|
]
|
|
43
51
|
end
|
|
44
52
|
end
|
|
45
|
-
end
|
|
46
53
|
|
|
54
|
+
# Extract the params from the the request that we can use to determine the
|
|
55
|
+
# signature. This _may_ modify the passed in request since it may read/rewind
|
|
56
|
+
# the body.
|
|
57
|
+
def extract_params!(request)
|
|
58
|
+
return {} unless request.post?
|
|
59
|
+
|
|
60
|
+
if request.media_type == FORM_URLENCODED_MEDIA_TYPE
|
|
61
|
+
request.POST
|
|
62
|
+
else
|
|
63
|
+
request.body.rewind
|
|
64
|
+
body = request.body.read
|
|
65
|
+
request.body.rewind
|
|
66
|
+
body
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private :extract_params!
|
|
71
|
+
end
|
|
47
72
|
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
module Twilio
|
|
2
|
+
module REST
|
|
3
|
+
class ClientBase
|
|
4
|
+
# rubocop:disable Style/ClassVars
|
|
5
|
+
@@default_region = 'us1'
|
|
6
|
+
# rubocop:enable Style/ClassVars
|
|
7
|
+
|
|
8
|
+
attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :edge, :logger,
|
|
9
|
+
:user_agent_extensions
|
|
10
|
+
|
|
11
|
+
# rubocop:disable Metrics/ParameterLists
|
|
12
|
+
def initialize(username = nil, password = nil, account_sid = nil, region = nil, http_client = nil, logger = nil,
|
|
13
|
+
user_agent_extensions = nil)
|
|
14
|
+
@username = username || Twilio.account_sid
|
|
15
|
+
@password = password || Twilio.auth_token
|
|
16
|
+
@region = region || Twilio.region
|
|
17
|
+
@edge = Twilio.edge
|
|
18
|
+
@account_sid = account_sid || @username
|
|
19
|
+
@auth_token = @password
|
|
20
|
+
@auth = [@username, @password]
|
|
21
|
+
@http_client = http_client || Twilio.http_client || Twilio::HTTP::Client.new
|
|
22
|
+
@logger = logger || Twilio.logger
|
|
23
|
+
@user_agent_extensions = user_agent_extensions || []
|
|
24
|
+
end
|
|
25
|
+
# rubocop:enable Metrics/ParameterLists
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Makes a request to the Twilio API using the configured http client
|
|
29
|
+
# Authentication information is automatically added if none is provided
|
|
30
|
+
def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) # rubocop:disable Metrics/MethodLength
|
|
31
|
+
auth ||= @auth
|
|
32
|
+
headers = generate_headers(method, headers)
|
|
33
|
+
uri = build_uri(uri)
|
|
34
|
+
|
|
35
|
+
if @logger
|
|
36
|
+
@logger.debug('--BEGIN Twilio API Request--')
|
|
37
|
+
@logger.debug("Request Method: <#{method}>")
|
|
38
|
+
|
|
39
|
+
headers.each do |key, value|
|
|
40
|
+
@logger.debug("#{key}:#{value}") unless key.downcase == 'authorization'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
url = URI(uri)
|
|
44
|
+
@logger.debug("Host:#{url.host}")
|
|
45
|
+
@logger.debug("Path:#{url.path}")
|
|
46
|
+
@logger.debug("Query:#{url.query}")
|
|
47
|
+
@logger.debug("Request Params:#{params}")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
response = @http_client.request(
|
|
51
|
+
host,
|
|
52
|
+
port,
|
|
53
|
+
method,
|
|
54
|
+
uri,
|
|
55
|
+
params,
|
|
56
|
+
data,
|
|
57
|
+
headers,
|
|
58
|
+
auth,
|
|
59
|
+
timeout
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if @logger
|
|
63
|
+
@logger.debug("Response Status Code:#{response.status_code}")
|
|
64
|
+
@logger.debug("Response Headers:#{response.headers}")
|
|
65
|
+
@logger.debug('--END TWILIO API REQUEST--')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
response
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
##
|
|
72
|
+
# Build the final request uri
|
|
73
|
+
def build_uri(uri)
|
|
74
|
+
return uri if @region.nil? && @edge.nil?
|
|
75
|
+
|
|
76
|
+
parsed_url = URI(uri)
|
|
77
|
+
pieces = parsed_url.host.split('.')
|
|
78
|
+
product = pieces[0]
|
|
79
|
+
domain = pieces[-2, 2]
|
|
80
|
+
new_edge = @edge
|
|
81
|
+
new_region = @region
|
|
82
|
+
|
|
83
|
+
case pieces.length
|
|
84
|
+
when 4
|
|
85
|
+
new_region ||= pieces[1]
|
|
86
|
+
when 5
|
|
87
|
+
new_edge ||= pieces[1]
|
|
88
|
+
new_region ||= pieces[2]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
new_region = @@default_region if !new_edge.nil? && new_region.nil?
|
|
92
|
+
|
|
93
|
+
parsed_url.host = [product, new_edge, new_region, domain].reject(&:nil?).join('.')
|
|
94
|
+
parsed_url.to_s
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
##
|
|
98
|
+
# Validate the SSL certificates for the Twilio API
|
|
99
|
+
def validate_ssl_certificate
|
|
100
|
+
response = request('tls-test.twilio.com', '443', 'GET', 'https://tls-test.twilio.com')
|
|
101
|
+
return unless response.status_code < 200 || response.status_code >= 300
|
|
102
|
+
|
|
103
|
+
raise RestError.new 'Unexpected response from certificate endpoint', response
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def generate_headers(method, headers)
|
|
107
|
+
ruby_config = RbConfig::CONFIG
|
|
108
|
+
headers['User-Agent'] =
|
|
109
|
+
"twilio-ruby/#{Twilio::VERSION} (#{ruby_config['host_os']} #{ruby_config['host_cpu']}) Ruby/#{RUBY_VERSION}"
|
|
110
|
+
headers['Accept-Charset'] = 'utf-8'
|
|
111
|
+
|
|
112
|
+
user_agent_extensions.each { |extension| headers['User-Agent'] += " #{extension}" }
|
|
113
|
+
|
|
114
|
+
headers['Content-Type'] = 'application/x-www-form-urlencoded' if method == 'POST' && !headers['Content-Type']
|
|
115
|
+
|
|
116
|
+
headers['Accept'] = 'application/json' unless headers['Accept']
|
|
117
|
+
headers
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|