twilio-ruby 5.0.0.rc26 → 5.0.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/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +187 -0
- data/.travis.yml +13 -0
- data/CHANGES.md +4 -0
- data/Gemfile +2 -2
- data/Makefile +8 -1
- data/Rakefile +3 -7
- data/examples/examples.rb +12 -10
- data/examples/{print-call-log.rb → print_call_log.rb} +4 -4
- data/lib/rack/twilio_webhook_authentication.rb +2 -3
- data/lib/twilio-ruby/framework/domain.rb +2 -6
- data/lib/twilio-ruby/framework/error.rb +0 -1
- data/lib/twilio-ruby/framework/helper.rb +1 -1
- data/lib/twilio-ruby/framework/page.rb +23 -25
- data/lib/twilio-ruby/framework/resource.rb +2 -2
- data/lib/twilio-ruby/framework/serialize.rb +5 -12
- data/lib/twilio-ruby/framework/twilio_response.rb +1 -1
- data/lib/twilio-ruby/framework/values.rb +2 -2
- data/lib/twilio-ruby/framework/version.rb +19 -37
- data/lib/twilio-ruby/http/http_client.rb +5 -6
- data/lib/twilio-ruby/jwt/access_token.rb +27 -41
- data/lib/twilio-ruby/jwt/client_capability.rb +11 -16
- data/lib/twilio-ruby/jwt/jwt.rb +7 -13
- data/lib/twilio-ruby/jwt/task_router.rb +40 -38
- data/lib/twilio-ruby/rest/accounts.rb +2 -0
- data/lib/twilio-ruby/rest/accounts/v1.rb +2 -0
- data/lib/twilio-ruby/rest/accounts/v1/credential.rb +2 -2
- data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +12 -7
- data/lib/twilio-ruby/rest/api.rb +96 -0
- data/lib/twilio-ruby/rest/api/v2010.rb +5 -0
- data/lib/twilio-ruby/rest/api/v2010/account.rb +66 -56
- data/lib/twilio-ruby/rest/api/v2010/account/address.rb +30 -13
- data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +22 -8
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +40 -11
- data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +20 -9
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +16 -15
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +26 -28
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +26 -28
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +26 -28
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +64 -34
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +12 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +28 -3
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +37 -16
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +25 -15
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +28 -27
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +28 -19
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +22 -9
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +62 -58
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +52 -12
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +52 -12
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +52 -12
- data/lib/twilio-ruby/rest/api/v2010/account/key.rb +8 -9
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +47 -20
- data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +12 -2
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +17 -17
- data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +10 -2
- data/lib/twilio-ruby/rest/api/v2010/account/new_signing_key.rb +10 -2
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +37 -16
- data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +14 -13
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +20 -10
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +10 -10
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +37 -21
- data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +22 -13
- data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +22 -13
- data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +26 -9
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +24 -13
- data/lib/twilio-ruby/rest/api/v2010/account/signing_key.rb +8 -9
- data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +8 -10
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +16 -11
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +14 -9
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +36 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +14 -10
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +14 -10
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +16 -11
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +16 -9
- data/lib/twilio-ruby/rest/api/v2010/account/token.rb +14 -2
- data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +26 -9
- data/lib/twilio-ruby/rest/api/v2010/account/usage.rb +4 -6
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +44 -33
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +28 -11
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +32 -15
- data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +10 -1
- data/lib/twilio-ruby/rest/chat.rb +8 -0
- data/lib/twilio-ruby/rest/chat/v1.rb +8 -0
- data/lib/twilio-ruby/rest/chat/v1/credential.rb +16 -7
- data/lib/twilio-ruby/rest/chat/v1/service.rb +48 -13
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +34 -15
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +20 -10
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +22 -10
- data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +26 -10
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +18 -8
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +30 -10
- data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +16 -8
- data/lib/twilio-ruby/rest/chat/v2.rb +8 -0
- data/lib/twilio-ruby/rest/chat/v2/credential.rb +16 -7
- data/lib/twilio-ruby/rest/chat/v2/service.rb +46 -13
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +34 -15
- data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +20 -10
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +22 -10
- data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +26 -10
- data/lib/twilio-ruby/rest/chat/v2/service/role.rb +18 -8
- data/lib/twilio-ruby/rest/chat/v2/service/user.rb +30 -10
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +16 -8
- data/lib/twilio-ruby/rest/client.rb +94 -45
- data/lib/twilio-ruby/rest/ip_messaging.rb +8 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1.rb +8 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +16 -7
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +48 -13
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +34 -15
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +20 -10
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +22 -10
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +26 -10
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +18 -8
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +30 -10
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +16 -8
- data/lib/twilio-ruby/rest/ip_messaging/v2.rb +8 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +16 -7
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +46 -13
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +34 -15
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +20 -10
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +22 -10
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +26 -10
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +18 -8
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +30 -10
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +16 -8
- data/lib/twilio-ruby/rest/lookups.rb +4 -0
- data/lib/twilio-ruby/rest/lookups/v1.rb +9 -5
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +14 -1
- data/lib/twilio-ruby/rest/monitor.rb +8 -0
- data/lib/twilio-ruby/rest/monitor/v1.rb +8 -0
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +34 -10
- data/lib/twilio-ruby/rest/monitor/v1/event.rb +28 -13
- data/lib/twilio-ruby/rest/pricing.rb +6 -0
- data/lib/twilio-ruby/rest/pricing/v1.rb +6 -0
- data/lib/twilio-ruby/rest/pricing/v1/messaging.rb +8 -2
- data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +12 -7
- data/lib/twilio-ruby/rest/pricing/v1/phone_number.rb +8 -2
- data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +10 -7
- data/lib/twilio-ruby/rest/pricing/v1/voice.rb +10 -4
- data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +12 -7
- data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +14 -1
- data/lib/twilio-ruby/rest/taskrouter.rb +4 -0
- data/lib/twilio-ruby/rest/taskrouter/v1.rb +4 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +46 -24
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +16 -10
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +30 -17
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +42 -19
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +22 -10
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +16 -8
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +34 -15
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +12 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +10 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +34 -23
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +22 -10
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +28 -9
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +10 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +10 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +28 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +12 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +10 -2
- data/lib/twilio-ruby/rest/trunking.rb +4 -0
- data/lib/twilio-ruby/rest/trunking/v1.rb +4 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +36 -15
- data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +14 -8
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +14 -8
- data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +22 -8
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +52 -8
- data/lib/twilio-ruby/rest/video.rb +8 -0
- data/lib/twilio-ruby/rest/video/v1.rb +8 -0
- data/lib/twilio-ruby/rest/video/v1/recording.rb +26 -12
- data/lib/twilio-ruby/rest/video/v1/room.rb +34 -13
- data/lib/twilio-ruby/rest/video/v1/room/recording.rb +28 -12
- data/lib/twilio-ruby/security/request_validator.rb +1 -2
- data/lib/twilio-ruby/twiml/messaging_response.rb +7 -19
- data/lib/twilio-ruby/twiml/twiml.rb +8 -14
- data/lib/twilio-ruby/twiml/voice_response.rb +157 -169
- data/lib/twilio-ruby/util.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/serialize_spec.rb +17 -30
- data/spec/holodeck/holodeck.rb +6 -6
- data/spec/jwt/access_token_spec.rb +0 -6
- data/spec/jwt/client_capability_spec.rb +3 -3
- data/spec/jwt/task_router_spec.rb +16 -21
- data/spec/rack/twilio_webhook_authentication_spec.rb +12 -16
- data/spec/spec_helper.rb +2 -2
- data/spec/support/fakeweb.rb +1 -1
- data/spec/twiml/voice_response_spec.rb +33 -20
- data/twilio-ruby.gemspec +7 -3
- metadata +21 -193
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +0 -420
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.rb +0 -345
- data/lib/twilio-ruby/rest/fax.rb +0 -40
- data/lib/twilio-ruby/rest/fax/v1.rb +0 -37
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -520
- data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +0 -321
- data/lib/twilio-ruby/rest/messaging.rb +0 -40
- data/lib/twilio-ruby/rest/messaging/v1.rb +0 -37
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +0 -604
- data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +0 -344
- data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +0 -349
- data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +0 -349
- data/lib/twilio-ruby/rest/notify.rb +0 -44
- data/lib/twilio-ruby/rest/notify/v1.rb +0 -48
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +0 -394
- data/lib/twilio-ruby/rest/notify/v1/service.rb +0 -611
- data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +0 -414
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +0 -249
- data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +0 -219
- data/lib/twilio-ruby/rest/notify/v1/service/user.rb +0 -437
- data/lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb +0 -247
- data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +0 -418
- data/lib/twilio-ruby/rest/preview.rb +0 -107
- data/lib/twilio-ruby/rest/preview/bulk_exports.rb +0 -48
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +0 -198
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +0 -209
- data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +0 -232
- data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +0 -37
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +0 -539
- data/lib/twilio-ruby/rest/preview/marketplace.rb +0 -48
- data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +0 -326
- data/lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb +0 -297
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +0 -427
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb +0 -335
- data/lib/twilio-ruby/rest/preview/proxy.rb +0 -37
- data/lib/twilio-ruby/rest/preview/proxy/service.rb +0 -489
- data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +0 -349
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +0 -525
- data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +0 -406
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +0 -495
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +0 -422
- data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +0 -349
- data/lib/twilio-ruby/rest/preview/sync.rb +0 -37
- data/lib/twilio-ruby/rest/preview/sync/service.rb +0 -491
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +0 -431
- data/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb +0 -390
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +0 -426
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +0 -422
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb +0 -390
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +0 -426
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +0 -424
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb +0 -390
- data/lib/twilio-ruby/rest/preview/wireless.rb +0 -59
- data/lib/twilio-ruby/rest/preview/wireless/command.rb +0 -371
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +0 -414
- data/lib/twilio-ruby/rest/preview/wireless/sim.rb +0 -512
- data/lib/twilio-ruby/rest/preview/wireless/sim/usage.rb +0 -220
- data/lib/twilio-ruby/rest/sync.rb +0 -40
- data/lib/twilio-ruby/rest/sync/v1.rb +0 -37
- data/lib/twilio-ruby/rest/sync/v1/service.rb +0 -491
- data/lib/twilio-ruby/rest/sync/v1/service/document.rb +0 -431
- data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +0 -390
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +0 -426
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +0 -422
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +0 -390
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +0 -426
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +0 -424
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +0 -390
- data/lib/twilio-ruby/rest/wireless.rb +0 -48
- data/lib/twilio-ruby/rest/wireless/v1.rb +0 -59
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +0 -357
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +0 -427
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +0 -516
- data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +0 -235
- data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension_spec.rb +0 -135
- data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on_spec.rb +0 -223
- data/spec/integration/fax/v1/fax/fax_media_spec.rb +0 -126
- data/spec/integration/fax/v1/fax_spec.rb +0 -272
- data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +0 -170
- data/spec/integration/messaging/v1/service/phone_number_spec.rb +0 -201
- data/spec/integration/messaging/v1/service/short_code_spec.rb +0 -173
- data/spec/integration/messaging/v1/service_spec.rb +0 -263
- data/spec/integration/notify/v1/credential_spec.rb +0 -223
- data/spec/integration/notify/v1/service/binding_spec.rb +0 -227
- data/spec/integration/notify/v1/service/notification_spec.rb +0 -97
- data/spec/integration/notify/v1/service/segment_spec.rb +0 -84
- data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +0 -118
- data/spec/integration/notify/v1/service/user/user_binding_spec.rb +0 -269
- data/spec/integration/notify/v1/service/user_spec.rb +0 -213
- data/spec/integration/notify/v1/service_spec.rb +0 -280
- data/spec/integration/preview/bulk_exports/export/day_spec.rb +0 -56
- data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +0 -79
- data/spec/integration/preview/bulk_exports/export_spec.rb +0 -43
- data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +0 -276
- data/spec/integration/preview/marketplace/available_add_on/available_add_on_extension_spec.rb +0 -121
- data/spec/integration/preview/marketplace/available_add_on_spec.rb +0 -142
- data/spec/integration/preview/marketplace/installed_add_on/installed_add_on_extension_spec.rb +0 -164
- data/spec/integration/preview/marketplace/installed_add_on_spec.rb +0 -252
- data/spec/integration/preview/proxy/service/phone_number_spec.rb +0 -173
- data/spec/integration/preview/proxy/service/session/interaction_spec.rb +0 -104
- data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +0 -164
- data/spec/integration/preview/proxy/service/session/participant_spec.rb +0 -226
- data/spec/integration/preview/proxy/service/session_spec.rb +0 -216
- data/spec/integration/preview/proxy/service/short_code_spec.rb +0 -173
- data/spec/integration/preview/proxy/service_spec.rb +0 -200
- data/spec/integration/preview/sync/service/document/document_permission_spec.rb +0 -206
- data/spec/integration/preview/sync/service/document_spec.rb +0 -254
- data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +0 -256
- data/spec/integration/preview/sync/service/sync_list/sync_list_permission_spec.rb +0 -206
- data/spec/integration/preview/sync/service/sync_list_spec.rb +0 -207
- data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +0 -257
- data/spec/integration/preview/sync/service/sync_map/sync_map_permission_spec.rb +0 -206
- data/spec/integration/preview/sync/service/sync_map_spec.rb +0 -207
- data/spec/integration/preview/sync/service_spec.rb +0 -244
- data/spec/integration/preview/wireless/command_spec.rb +0 -169
- data/spec/integration/preview/wireless/rate_plan_spec.rb +0 -260
- data/spec/integration/preview/wireless/sim/usage_spec.rb +0 -49
- data/spec/integration/preview/wireless/sim_spec.rb +0 -208
- data/spec/integration/sync/v1/service/document/document_permission_spec.rb +0 -206
- data/spec/integration/sync/v1/service/document_spec.rb +0 -254
- data/spec/integration/sync/v1/service/sync_list/sync_list_item_spec.rb +0 -256
- data/spec/integration/sync/v1/service/sync_list/sync_list_permission_spec.rb +0 -206
- data/spec/integration/sync/v1/service/sync_list_spec.rb +0 -207
- data/spec/integration/sync/v1/service/sync_map/sync_map_item_spec.rb +0 -257
- data/spec/integration/sync/v1/service/sync_map/sync_map_permission_spec.rb +0 -206
- data/spec/integration/sync/v1/service/sync_map_spec.rb +0 -207
- data/spec/integration/sync/v1/service_spec.rb +0 -244
- data/spec/integration/wireless/v1/command_spec.rb +0 -166
- data/spec/integration/wireless/v1/rate_plan_spec.rb +0 -268
- data/spec/integration/wireless/v1/sim/usage_record_spec.rb +0 -65
- data/spec/integration/wireless/v1/sim_spec.rb +0 -208
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This code was generated by
|
|
3
|
-
# \ / _ _ _| _ _
|
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
-
# / /
|
|
6
|
-
|
|
7
|
-
module Twilio
|
|
8
|
-
module REST
|
|
9
|
-
class Notify < Domain
|
|
10
|
-
class V1 < Version
|
|
11
|
-
class ServiceContext < InstanceContext
|
|
12
|
-
class SegmentList < ListResource
|
|
13
|
-
##
|
|
14
|
-
# Initialize the SegmentList
|
|
15
|
-
# @param [Version] version Version that contains the resource
|
|
16
|
-
# @param [String] service_sid The service_sid
|
|
17
|
-
# @return [SegmentList] SegmentList
|
|
18
|
-
def initialize(version, service_sid: nil)
|
|
19
|
-
super(version)
|
|
20
|
-
|
|
21
|
-
# Path Solution
|
|
22
|
-
@solution = {
|
|
23
|
-
service_sid: service_sid
|
|
24
|
-
}
|
|
25
|
-
@uri = "/Services/#{@solution[:service_sid]}/Segments"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
# Lists SegmentInstance records from the API as a list.
|
|
30
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
31
|
-
# memory before returning.
|
|
32
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
33
|
-
# guarantees to never return more than limit. Default is no limit
|
|
34
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
35
|
-
# the default value of 50 records. If no page_size is defined
|
|
36
|
-
# but a limit is defined, stream() will attempt to read the
|
|
37
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
38
|
-
# @return [Array] Array of up to limit results
|
|
39
|
-
def list(limit: nil, page_size: nil)
|
|
40
|
-
self.stream(
|
|
41
|
-
limit: limit,
|
|
42
|
-
page_size: page_size
|
|
43
|
-
).entries
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
##
|
|
47
|
-
# Streams SegmentInstance records from the API as an Enumerable.
|
|
48
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
|
49
|
-
# is reached.
|
|
50
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
51
|
-
# guarantees to never return more than limit. Default is no limit
|
|
52
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
53
|
-
# the default value of 50 records. If no page_size is defined
|
|
54
|
-
# but a limit is defined, stream() will attempt to read the
|
|
55
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
56
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
57
|
-
def stream(limit: nil, page_size: nil)
|
|
58
|
-
limits = @version.read_limits(limit, page_size)
|
|
59
|
-
|
|
60
|
-
page = self.page(
|
|
61
|
-
page_size: limits[:page_size],
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
##
|
|
68
|
-
# When passed a block, yields SegmentInstance records from the API.
|
|
69
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
|
70
|
-
# is reached.
|
|
71
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
72
|
-
# guarantees to never return more than limit. Default is no limit
|
|
73
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
74
|
-
# the default value of 50 records. If no page_size is defined
|
|
75
|
-
# but a limit is defined, stream() will attempt to read the
|
|
76
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
77
|
-
def each
|
|
78
|
-
limits = @version.read_limits
|
|
79
|
-
|
|
80
|
-
page = self.page(
|
|
81
|
-
page_size: limits[:page_size],
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
@version.stream(page,
|
|
85
|
-
limit: limits[:limit],
|
|
86
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
##
|
|
90
|
-
# Retrieve a single page of SegmentInstance records from the API.
|
|
91
|
-
# Request is executed immediately.
|
|
92
|
-
# @param [String] page_token PageToken provided by the API
|
|
93
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
94
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
95
|
-
# @return [Page] Page of SegmentInstance
|
|
96
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
|
97
|
-
params = Twilio::Values.of({
|
|
98
|
-
'PageToken' => page_token,
|
|
99
|
-
'Page' => page_number,
|
|
100
|
-
'PageSize' => page_size,
|
|
101
|
-
})
|
|
102
|
-
response = @version.page(
|
|
103
|
-
'GET',
|
|
104
|
-
@uri,
|
|
105
|
-
params
|
|
106
|
-
)
|
|
107
|
-
SegmentPage.new(@version, response, @solution)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
##
|
|
111
|
-
# Retrieve a single page of SegmentInstance records from the API.
|
|
112
|
-
# Request is executed immediately.
|
|
113
|
-
# @param [String] target_url API-generated URL for the requested results page
|
|
114
|
-
# @return [Page] Page of SegmentInstance
|
|
115
|
-
def get_page(target_url)
|
|
116
|
-
response = @version.domain.request(
|
|
117
|
-
'GET',
|
|
118
|
-
target_url
|
|
119
|
-
)
|
|
120
|
-
SegmentPage.new(@version, response, @solution)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
##
|
|
124
|
-
# Provide a user friendly representation
|
|
125
|
-
def to_s
|
|
126
|
-
'#<Twilio.Notify.V1.SegmentList>'
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
class SegmentPage < Page
|
|
131
|
-
##
|
|
132
|
-
# Initialize the SegmentPage
|
|
133
|
-
# @param [Version] version Version that contains the resource
|
|
134
|
-
# @param [Response] response Response from the API
|
|
135
|
-
# @param [Hash] solution Path solution for the resource
|
|
136
|
-
# @param [String] service_sid The service_sid
|
|
137
|
-
# @return [SegmentPage] SegmentPage
|
|
138
|
-
def initialize(version, response, solution)
|
|
139
|
-
super(version, response)
|
|
140
|
-
|
|
141
|
-
# Path Solution
|
|
142
|
-
@solution = solution
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
##
|
|
146
|
-
# Build an instance of SegmentInstance
|
|
147
|
-
# @param [Hash] payload Payload response from the API
|
|
148
|
-
# @return [SegmentInstance] SegmentInstance
|
|
149
|
-
def get_instance(payload)
|
|
150
|
-
SegmentInstance.new(
|
|
151
|
-
@version,
|
|
152
|
-
payload,
|
|
153
|
-
service_sid: @solution[:service_sid],
|
|
154
|
-
)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
##
|
|
158
|
-
# Provide a user friendly representation
|
|
159
|
-
def to_s
|
|
160
|
-
'<Twilio.Notify.V1.SegmentPage>'
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
class SegmentInstance < InstanceResource
|
|
165
|
-
##
|
|
166
|
-
# Initialize the SegmentInstance
|
|
167
|
-
# @param [Version] version Version that contains the resource
|
|
168
|
-
# @param [Hash] payload payload that contains response from Twilio
|
|
169
|
-
# @param [String] service_sid The service_sid
|
|
170
|
-
# @return [SegmentInstance] SegmentInstance
|
|
171
|
-
def initialize(version, payload, service_sid: nil)
|
|
172
|
-
super(version)
|
|
173
|
-
|
|
174
|
-
# Marshaled Properties
|
|
175
|
-
@properties = {
|
|
176
|
-
'sid' => payload['sid'],
|
|
177
|
-
'account_sid' => payload['account_sid'],
|
|
178
|
-
'service_sid' => payload['service_sid'],
|
|
179
|
-
'unique_name' => payload['unique_name'],
|
|
180
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
181
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
182
|
-
}
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
def sid
|
|
186
|
-
@properties['sid']
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
def account_sid
|
|
190
|
-
@properties['account_sid']
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def service_sid
|
|
194
|
-
@properties['service_sid']
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def unique_name
|
|
198
|
-
@properties['unique_name']
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def date_created
|
|
202
|
-
@properties['date_created']
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
def date_updated
|
|
206
|
-
@properties['date_updated']
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
##
|
|
210
|
-
# Provide a user friendly representation
|
|
211
|
-
def to_s
|
|
212
|
-
"<Twilio.Notify.V1.SegmentInstance>"
|
|
213
|
-
end
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
end
|
|
219
|
-
end
|
|
@@ -1,437 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This code was generated by
|
|
3
|
-
# \ / _ _ _| _ _
|
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
-
# / /
|
|
6
|
-
|
|
7
|
-
module Twilio
|
|
8
|
-
module REST
|
|
9
|
-
class Notify < Domain
|
|
10
|
-
class V1 < Version
|
|
11
|
-
class ServiceContext < InstanceContext
|
|
12
|
-
class UserList < ListResource
|
|
13
|
-
##
|
|
14
|
-
# Initialize the UserList
|
|
15
|
-
# @param [Version] version Version that contains the resource
|
|
16
|
-
# @param [String] service_sid The service_sid
|
|
17
|
-
# @return [UserList] UserList
|
|
18
|
-
def initialize(version, service_sid: nil)
|
|
19
|
-
super(version)
|
|
20
|
-
|
|
21
|
-
# Path Solution
|
|
22
|
-
@solution = {
|
|
23
|
-
service_sid: service_sid
|
|
24
|
-
}
|
|
25
|
-
@uri = "/Services/#{@solution[:service_sid]}/Users"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
# Retrieve a single page of UserInstance records from the API.
|
|
30
|
-
# Request is executed immediately.
|
|
31
|
-
# @param [String] identity The identity
|
|
32
|
-
# @param [String] segment The segment
|
|
33
|
-
# @return [UserInstance] Newly created UserInstance
|
|
34
|
-
def create(identity: nil, segment: :unset)
|
|
35
|
-
data = Twilio::Values.of({
|
|
36
|
-
'Identity' => identity,
|
|
37
|
-
'Segment' => segment,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
payload = @version.create(
|
|
41
|
-
'POST',
|
|
42
|
-
@uri,
|
|
43
|
-
data: data
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
UserInstance.new(
|
|
47
|
-
@version,
|
|
48
|
-
payload,
|
|
49
|
-
service_sid: @solution[:service_sid],
|
|
50
|
-
)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
##
|
|
54
|
-
# Lists UserInstance records from the API as a list.
|
|
55
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
56
|
-
# memory before returning.
|
|
57
|
-
# @param [String] identity The identity
|
|
58
|
-
# @param [String] segment The segment
|
|
59
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
60
|
-
# guarantees to never return more than limit. Default is no limit
|
|
61
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
62
|
-
# the default value of 50 records. If no page_size is defined
|
|
63
|
-
# but a limit is defined, stream() will attempt to read the
|
|
64
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
65
|
-
# @return [Array] Array of up to limit results
|
|
66
|
-
def list(identity: :unset, segment: :unset, limit: nil, page_size: nil)
|
|
67
|
-
self.stream(
|
|
68
|
-
identity: identity,
|
|
69
|
-
segment: segment,
|
|
70
|
-
limit: limit,
|
|
71
|
-
page_size: page_size
|
|
72
|
-
).entries
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
##
|
|
76
|
-
# Streams UserInstance records from the API as an Enumerable.
|
|
77
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
|
78
|
-
# is reached.
|
|
79
|
-
# @param [String] identity The identity
|
|
80
|
-
# @param [String] segment The segment
|
|
81
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
82
|
-
# guarantees to never return more than limit. Default is no limit
|
|
83
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
84
|
-
# the default value of 50 records. If no page_size is defined
|
|
85
|
-
# but a limit is defined, stream() will attempt to read the
|
|
86
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
87
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
88
|
-
def stream(identity: :unset, segment: :unset, limit: nil, page_size: nil)
|
|
89
|
-
limits = @version.read_limits(limit, page_size)
|
|
90
|
-
|
|
91
|
-
page = self.page(
|
|
92
|
-
identity: identity,
|
|
93
|
-
segment: segment,
|
|
94
|
-
page_size: limits[:page_size],
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
##
|
|
101
|
-
# When passed a block, yields UserInstance records from the API.
|
|
102
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
|
103
|
-
# is reached.
|
|
104
|
-
# @param [String] identity The identity
|
|
105
|
-
# @param [String] segment The segment
|
|
106
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
107
|
-
# guarantees to never return more than limit. Default is no limit
|
|
108
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
109
|
-
# the default value of 50 records. If no page_size is defined
|
|
110
|
-
# but a limit is defined, stream() will attempt to read the
|
|
111
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
112
|
-
def each
|
|
113
|
-
limits = @version.read_limits
|
|
114
|
-
|
|
115
|
-
page = self.page(
|
|
116
|
-
page_size: limits[:page_size],
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
@version.stream(page,
|
|
120
|
-
limit: limits[:limit],
|
|
121
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
##
|
|
125
|
-
# Retrieve a single page of UserInstance records from the API.
|
|
126
|
-
# Request is executed immediately.
|
|
127
|
-
# @param [String] identity The identity
|
|
128
|
-
# @param [String] segment The segment
|
|
129
|
-
# @param [String] page_token PageToken provided by the API
|
|
130
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
131
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
132
|
-
# @return [Page] Page of UserInstance
|
|
133
|
-
def page(identity: :unset, segment: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
134
|
-
params = Twilio::Values.of({
|
|
135
|
-
'Identity' => identity,
|
|
136
|
-
'Segment' => segment,
|
|
137
|
-
'PageToken' => page_token,
|
|
138
|
-
'Page' => page_number,
|
|
139
|
-
'PageSize' => page_size,
|
|
140
|
-
})
|
|
141
|
-
response = @version.page(
|
|
142
|
-
'GET',
|
|
143
|
-
@uri,
|
|
144
|
-
params
|
|
145
|
-
)
|
|
146
|
-
UserPage.new(@version, response, @solution)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
##
|
|
150
|
-
# Retrieve a single page of UserInstance records from the API.
|
|
151
|
-
# Request is executed immediately.
|
|
152
|
-
# @param [String] target_url API-generated URL for the requested results page
|
|
153
|
-
# @return [Page] Page of UserInstance
|
|
154
|
-
def get_page(target_url)
|
|
155
|
-
response = @version.domain.request(
|
|
156
|
-
'GET',
|
|
157
|
-
target_url
|
|
158
|
-
)
|
|
159
|
-
UserPage.new(@version, response, @solution)
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
##
|
|
163
|
-
# Provide a user friendly representation
|
|
164
|
-
def to_s
|
|
165
|
-
'#<Twilio.Notify.V1.UserList>'
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
class UserPage < Page
|
|
170
|
-
##
|
|
171
|
-
# Initialize the UserPage
|
|
172
|
-
# @param [Version] version Version that contains the resource
|
|
173
|
-
# @param [Response] response Response from the API
|
|
174
|
-
# @param [Hash] solution Path solution for the resource
|
|
175
|
-
# @param [String] service_sid The service_sid
|
|
176
|
-
# @return [UserPage] UserPage
|
|
177
|
-
def initialize(version, response, solution)
|
|
178
|
-
super(version, response)
|
|
179
|
-
|
|
180
|
-
# Path Solution
|
|
181
|
-
@solution = solution
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
##
|
|
185
|
-
# Build an instance of UserInstance
|
|
186
|
-
# @param [Hash] payload Payload response from the API
|
|
187
|
-
# @return [UserInstance] UserInstance
|
|
188
|
-
def get_instance(payload)
|
|
189
|
-
UserInstance.new(
|
|
190
|
-
@version,
|
|
191
|
-
payload,
|
|
192
|
-
service_sid: @solution[:service_sid],
|
|
193
|
-
)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
##
|
|
197
|
-
# Provide a user friendly representation
|
|
198
|
-
def to_s
|
|
199
|
-
'<Twilio.Notify.V1.UserPage>'
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
class UserContext < InstanceContext
|
|
204
|
-
##
|
|
205
|
-
# Initialize the UserContext
|
|
206
|
-
# @param [Version] version Version that contains the resource
|
|
207
|
-
# @param [String] service_sid The service_sid
|
|
208
|
-
# @param [String] identity The identity
|
|
209
|
-
# @return [UserContext] UserContext
|
|
210
|
-
def initialize(version, service_sid, identity)
|
|
211
|
-
super(version)
|
|
212
|
-
|
|
213
|
-
# Path Solution
|
|
214
|
-
@solution = {
|
|
215
|
-
service_sid: service_sid,
|
|
216
|
-
identity: identity,
|
|
217
|
-
}
|
|
218
|
-
@uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}"
|
|
219
|
-
|
|
220
|
-
# Dependents
|
|
221
|
-
@bindings = nil
|
|
222
|
-
@segment_memberships = nil
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
##
|
|
226
|
-
# Deletes the UserInstance
|
|
227
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
|
228
|
-
def delete
|
|
229
|
-
@version.delete('delete', @uri)
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
##
|
|
233
|
-
# Fetch a UserInstance
|
|
234
|
-
# @return [UserInstance] Fetched UserInstance
|
|
235
|
-
def fetch
|
|
236
|
-
params = Twilio::Values.of({})
|
|
237
|
-
|
|
238
|
-
payload = @version.fetch(
|
|
239
|
-
'GET',
|
|
240
|
-
@uri,
|
|
241
|
-
params,
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
UserInstance.new(
|
|
245
|
-
@version,
|
|
246
|
-
payload,
|
|
247
|
-
service_sid: @solution[:service_sid],
|
|
248
|
-
identity: @solution[:identity],
|
|
249
|
-
)
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
##
|
|
253
|
-
# Access the bindings
|
|
254
|
-
# @return [UserBindingList] if a(n) UserBindingList object was created.
|
|
255
|
-
# @return [UserBindingContext] if a(n) UserBindingContext object was created.
|
|
256
|
-
def bindings(sid=:unset)
|
|
257
|
-
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
258
|
-
|
|
259
|
-
if sid != :unset
|
|
260
|
-
return UserBindingContext.new(
|
|
261
|
-
@version,
|
|
262
|
-
@solution[:service_sid],
|
|
263
|
-
@solution[:identity],
|
|
264
|
-
sid,
|
|
265
|
-
)
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
unless @bindings
|
|
269
|
-
@bindings = UserBindingList.new(
|
|
270
|
-
@version,
|
|
271
|
-
service_sid: @solution[:service_sid],
|
|
272
|
-
identity: @solution[:identity],
|
|
273
|
-
)
|
|
274
|
-
end
|
|
275
|
-
|
|
276
|
-
@bindings
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
##
|
|
280
|
-
# Access the segment_memberships
|
|
281
|
-
# @return [SegmentMembershipList] if a(n) SegmentMembershipList object was created.
|
|
282
|
-
# @return [SegmentMembershipContext] if a(n) SegmentMembershipContext object was created.
|
|
283
|
-
def segment_memberships(segment=:unset)
|
|
284
|
-
raise ArgumentError, 'segment cannot be nil' if segment.nil?
|
|
285
|
-
|
|
286
|
-
if segment != :unset
|
|
287
|
-
return SegmentMembershipContext.new(
|
|
288
|
-
@version,
|
|
289
|
-
@solution[:service_sid],
|
|
290
|
-
@solution[:identity],
|
|
291
|
-
segment,
|
|
292
|
-
)
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
unless @segment_memberships
|
|
296
|
-
@segment_memberships = SegmentMembershipList.new(
|
|
297
|
-
@version,
|
|
298
|
-
service_sid: @solution[:service_sid],
|
|
299
|
-
identity: @solution[:identity],
|
|
300
|
-
)
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
@segment_memberships
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
##
|
|
307
|
-
# Provide a user friendly representation
|
|
308
|
-
def to_s
|
|
309
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
310
|
-
"#<Twilio.Notify.V1.UserContext #{context}>"
|
|
311
|
-
end
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
class UserInstance < InstanceResource
|
|
315
|
-
##
|
|
316
|
-
# Initialize the UserInstance
|
|
317
|
-
# @param [Version] version Version that contains the resource
|
|
318
|
-
# @param [Hash] payload payload that contains response from Twilio
|
|
319
|
-
# @param [String] service_sid The service_sid
|
|
320
|
-
# @param [String] identity The identity
|
|
321
|
-
# @return [UserInstance] UserInstance
|
|
322
|
-
def initialize(version, payload, service_sid: nil, identity: nil)
|
|
323
|
-
super(version)
|
|
324
|
-
|
|
325
|
-
# Marshaled Properties
|
|
326
|
-
@properties = {
|
|
327
|
-
'sid' => payload['sid'],
|
|
328
|
-
'account_sid' => payload['account_sid'],
|
|
329
|
-
'service_sid' => payload['service_sid'],
|
|
330
|
-
'identity' => payload['identity'],
|
|
331
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
332
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
333
|
-
'segments' => payload['segments'],
|
|
334
|
-
'url' => payload['url'],
|
|
335
|
-
'links' => payload['links'],
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
# Context
|
|
339
|
-
@instance_context = nil
|
|
340
|
-
@params = {
|
|
341
|
-
'service_sid' => service_sid,
|
|
342
|
-
'identity' => identity || @properties['identity'],
|
|
343
|
-
}
|
|
344
|
-
end
|
|
345
|
-
|
|
346
|
-
##
|
|
347
|
-
# Generate an instance context for the instance, the context is capable of
|
|
348
|
-
# performing various actions. All instance actions are proxied to the context
|
|
349
|
-
# @param [Version] version Version that contains the resource
|
|
350
|
-
# @return [UserContext] UserContext for this UserInstance
|
|
351
|
-
def context
|
|
352
|
-
unless @instance_context
|
|
353
|
-
@instance_context = UserContext.new(
|
|
354
|
-
@version,
|
|
355
|
-
@params['service_sid'],
|
|
356
|
-
@params['identity'],
|
|
357
|
-
)
|
|
358
|
-
end
|
|
359
|
-
@instance_context
|
|
360
|
-
end
|
|
361
|
-
|
|
362
|
-
def sid
|
|
363
|
-
@properties['sid']
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
def account_sid
|
|
367
|
-
@properties['account_sid']
|
|
368
|
-
end
|
|
369
|
-
|
|
370
|
-
def service_sid
|
|
371
|
-
@properties['service_sid']
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
def identity
|
|
375
|
-
@properties['identity']
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
def date_created
|
|
379
|
-
@properties['date_created']
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
def date_updated
|
|
383
|
-
@properties['date_updated']
|
|
384
|
-
end
|
|
385
|
-
|
|
386
|
-
def segments
|
|
387
|
-
@properties['segments']
|
|
388
|
-
end
|
|
389
|
-
|
|
390
|
-
def url
|
|
391
|
-
@properties['url']
|
|
392
|
-
end
|
|
393
|
-
|
|
394
|
-
def links
|
|
395
|
-
@properties['links']
|
|
396
|
-
end
|
|
397
|
-
|
|
398
|
-
##
|
|
399
|
-
# Deletes the UserInstance
|
|
400
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
|
401
|
-
def delete
|
|
402
|
-
context.delete
|
|
403
|
-
end
|
|
404
|
-
|
|
405
|
-
##
|
|
406
|
-
# Fetch a UserInstance
|
|
407
|
-
# @return [UserInstance] Fetched UserInstance
|
|
408
|
-
def fetch
|
|
409
|
-
context.fetch
|
|
410
|
-
end
|
|
411
|
-
|
|
412
|
-
##
|
|
413
|
-
# Access the bindings
|
|
414
|
-
# @return [bindings] bindings
|
|
415
|
-
def bindings
|
|
416
|
-
context.bindings
|
|
417
|
-
end
|
|
418
|
-
|
|
419
|
-
##
|
|
420
|
-
# Access the segment_memberships
|
|
421
|
-
# @return [segment_memberships] segment_memberships
|
|
422
|
-
def segment_memberships
|
|
423
|
-
context.segment_memberships
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
##
|
|
427
|
-
# Provide a user friendly representation
|
|
428
|
-
def to_s
|
|
429
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
430
|
-
"<Twilio.Notify.V1.UserInstance #{values}>"
|
|
431
|
-
end
|
|
432
|
-
end
|
|
433
|
-
end
|
|
434
|
-
end
|
|
435
|
-
end
|
|
436
|
-
end
|
|
437
|
-
end
|