twilio-ruby 5.0.0.rc19 → 5.0.0.rc20
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/CHANGES.md +8 -0
- data/README.md +2 -2
- data/VERSIONS.md +64 -0
- data/lib/twilio-ruby/framework/{exception.rb → error.rb} +3 -2
- data/lib/twilio-ruby/framework/page.rb +3 -3
- data/lib/twilio-ruby/framework/serialize.rb +9 -0
- data/lib/twilio-ruby/framework/version.rb +1 -1
- data/lib/twilio-ruby/http/http_client.rb +1 -0
- data/lib/twilio-ruby/jwt/access_token.rb +28 -0
- data/lib/twilio-ruby/rest/client.rb +64 -42
- data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +303 -0
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +80 -6
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +50 -3
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +2 -2
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +38 -17
- data/lib/twilio-ruby/rest/preview/wireless/sim.rb +74 -2
- data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +377 -0
- data/lib/twilio-ruby/rest/sync/v1/service/document.rb +415 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +409 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +377 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +407 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +411 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +377 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +407 -0
- data/lib/twilio-ruby/rest/sync/v1/service.rb +469 -0
- data/lib/twilio-ruby/rest/sync/v1.rb +35 -0
- data/lib/twilio-ruby/rest/sync.rb +40 -0
- data/lib/twilio-ruby/rest/video/v1/room/recording.rb +324 -0
- data/lib/twilio-ruby/rest/video/v1/room.rb +37 -0
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +344 -0
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +399 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +222 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +502 -0
- data/lib/twilio-ruby/rest/wireless/v1.rb +53 -0
- data/lib/twilio-ruby/rest/wireless.rb +48 -0
- data/lib/twilio-ruby/security/request_validator.rb +19 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/serialize_spec.rb +20 -1
- data/spec/integration/accounts/v1/credential/public_key_spec.rb +5 -5
- data/spec/integration/api/v2010/account/address/dependent_phone_number_spec.rb +1 -1
- data/spec/integration/api/v2010/account/address_spec.rb +5 -5
- data/spec/integration/api/v2010/account/application_spec.rb +5 -5
- data/spec/integration/api/v2010/account/authorized_connect_app_spec.rb +2 -2
- data/spec/integration/api/v2010/account/available_phone_number/local_spec.rb +1 -1
- data/spec/integration/api/v2010/account/available_phone_number/mobile_spec.rb +1 -1
- data/spec/integration/api/v2010/account/available_phone_number/toll_free_spec.rb +1 -1
- data/spec/integration/api/v2010/account/available_phone_number_spec.rb +2 -2
- data/spec/integration/api/v2010/account/call/feedback_spec.rb +3 -3
- data/spec/integration/api/v2010/account/call/feedback_summary_spec.rb +3 -3
- data/spec/integration/api/v2010/account/call/notification_spec.rb +3 -3
- data/spec/integration/api/v2010/account/call/recording_spec.rb +3 -3
- data/spec/integration/api/v2010/account/call_spec.rb +5 -5
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +5 -5
- data/spec/integration/api/v2010/account/conference_spec.rb +3 -3
- data/spec/integration/api/v2010/account/connect_app_spec.rb +3 -3
- data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension_spec.rb +2 -2
- data/spec/integration/api/v2010/account/incoming_phone_number/assigned_add_on_spec.rb +4 -4
- data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +2 -2
- data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +2 -2
- data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +2 -2
- data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +5 -5
- data/spec/integration/api/v2010/account/key_spec.rb +4 -4
- data/spec/integration/api/v2010/account/message/feedback_spec.rb +1 -1
- data/spec/integration/api/v2010/account/message/media_spec.rb +3 -3
- data/spec/integration/api/v2010/account/message_spec.rb +5 -5
- data/spec/integration/api/v2010/account/new_key_spec.rb +1 -1
- data/spec/integration/api/v2010/account/new_signing_key_spec.rb +1 -1
- data/spec/integration/api/v2010/account/notification_spec.rb +3 -3
- data/spec/integration/api/v2010/account/outgoing_caller_id_spec.rb +4 -4
- data/spec/integration/api/v2010/account/queue/member_spec.rb +3 -3
- data/spec/integration/api/v2010/account/queue_spec.rb +5 -5
- data/spec/integration/api/v2010/account/recording/add_on_result/payload_spec.rb +3 -3
- data/spec/integration/api/v2010/account/recording/add_on_result_spec.rb +3 -3
- data/spec/integration/api/v2010/account/recording/transcription_spec.rb +3 -3
- data/spec/integration/api/v2010/account/recording_spec.rb +3 -3
- data/spec/integration/api/v2010/account/short_code_spec.rb +3 -3
- data/spec/integration/api/v2010/account/signing_key_spec.rb +4 -4
- data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +5 -5
- data/spec/integration/api/v2010/account/sip/credential_list_spec.rb +5 -5
- data/spec/integration/api/v2010/account/sip/domain/credential_list_mapping_spec.rb +4 -4
- data/spec/integration/api/v2010/account/sip/domain/ip_access_control_list_mapping_spec.rb +4 -4
- data/spec/integration/api/v2010/account/sip/domain_spec.rb +5 -5
- data/spec/integration/api/v2010/account/sip/ip_access_control_list/ip_address_spec.rb +5 -5
- data/spec/integration/api/v2010/account/sip/ip_access_control_list_spec.rb +5 -5
- data/spec/integration/api/v2010/account/token_spec.rb +1 -1
- data/spec/integration/api/v2010/account/transcription_spec.rb +3 -3
- data/spec/integration/api/v2010/account/usage/record/all_time_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/daily_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/last_month_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/monthly_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/this_month_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/today_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/yearly_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record/yesterday_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/record_spec.rb +1 -1
- data/spec/integration/api/v2010/account/usage/trigger_spec.rb +5 -5
- data/spec/integration/api/v2010/account/validation_request_spec.rb +1 -1
- data/spec/integration/api/v2010/account_spec.rb +4 -4
- data/spec/integration/chat/v1/credential_spec.rb +5 -5
- data/spec/integration/chat/v1/service/channel/invite_spec.rb +4 -4
- data/spec/integration/chat/v1/service/channel/member_spec.rb +5 -5
- data/spec/integration/chat/v1/service/channel/message_spec.rb +5 -5
- data/spec/integration/chat/v1/service/channel_spec.rb +5 -5
- data/spec/integration/chat/v1/service/role_spec.rb +5 -5
- data/spec/integration/chat/v1/service/user/user_channel_spec.rb +1 -1
- data/spec/integration/chat/v1/service/user_spec.rb +5 -5
- data/spec/integration/chat/v1/service_spec.rb +5 -5
- data/spec/integration/chat/v2/credential_spec.rb +5 -5
- data/spec/integration/chat/v2/service/channel/invite_spec.rb +4 -4
- data/spec/integration/chat/v2/service/channel/member_spec.rb +5 -5
- data/spec/integration/chat/v2/service/channel/message_spec.rb +5 -5
- data/spec/integration/chat/v2/service/channel_spec.rb +5 -5
- data/spec/integration/chat/v2/service/role_spec.rb +5 -5
- data/spec/integration/chat/v2/service/user/user_channel_spec.rb +1 -1
- data/spec/integration/chat/v2/service/user_spec.rb +5 -5
- data/spec/integration/chat/v2/service_spec.rb +5 -5
- data/spec/integration/fax/v1/fax/fax_media_spec.rb +126 -0
- data/spec/integration/fax/v1/fax_spec.rb +48 -7
- data/spec/integration/ip_messaging/v1/credential_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +4 -4
- data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +1 -1
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/credential_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +4 -4
- data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/role_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +1 -1
- data/spec/integration/ip_messaging/v2/service/user_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service_spec.rb +5 -5
- data/spec/integration/lookups/v1/phone_number_spec.rb +1 -1
- data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +4 -4
- data/spec/integration/messaging/v1/service/phone_number_spec.rb +4 -4
- data/spec/integration/messaging/v1/service/short_code_spec.rb +4 -4
- data/spec/integration/messaging/v1/service_spec.rb +21 -5
- data/spec/integration/monitor/v1/alert_spec.rb +3 -3
- data/spec/integration/monitor/v1/event_spec.rb +2 -2
- data/spec/integration/notify/v1/credential_spec.rb +5 -5
- data/spec/integration/notify/v1/service/binding_spec.rb +4 -4
- data/spec/integration/notify/v1/service/notification_spec.rb +1 -1
- data/spec/integration/notify/v1/service/segment_spec.rb +1 -1
- data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +3 -3
- data/spec/integration/notify/v1/service/user/user_binding_spec.rb +4 -4
- data/spec/integration/notify/v1/service/user_spec.rb +4 -4
- data/spec/integration/notify/v1/service_spec.rb +5 -5
- data/spec/integration/preview/marketplace/available_add_on/available_add_on_extension_spec.rb +2 -2
- data/spec/integration/preview/marketplace/available_add_on_spec.rb +2 -2
- data/spec/integration/preview/marketplace/installed_add_on/installed_add_on_extension_spec.rb +3 -3
- data/spec/integration/preview/marketplace/installed_add_on_spec.rb +5 -5
- data/spec/integration/preview/sync/service/document/document_permission_spec.rb +4 -4
- data/spec/integration/preview/sync/service/document_spec.rb +6 -6
- data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +7 -7
- data/spec/integration/preview/sync/service/sync_list/sync_list_permission_spec.rb +4 -4
- data/spec/integration/preview/sync/service/sync_list_spec.rb +4 -4
- data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +7 -7
- data/spec/integration/preview/sync/service/sync_map/sync_map_permission_spec.rb +4 -4
- data/spec/integration/preview/sync/service/sync_map_spec.rb +4 -4
- data/spec/integration/preview/sync/service_spec.rb +5 -5
- data/spec/integration/preview/wireless/command_spec.rb +3 -3
- data/spec/integration/preview/wireless/rate_plan_spec.rb +45 -45
- data/spec/integration/preview/wireless/sim/usage_spec.rb +1 -1
- data/spec/integration/preview/wireless/sim_spec.rb +27 -3
- data/spec/integration/pricing/v1/messaging/country_spec.rb +2 -2
- data/spec/integration/pricing/v1/phone_number/country_spec.rb +2 -2
- data/spec/integration/pricing/v1/voice/country_spec.rb +2 -2
- data/spec/integration/pricing/v1/voice/number_spec.rb +1 -1
- data/spec/integration/sync/v1/service/document/document_permission_spec.rb +206 -0
- data/spec/integration/sync/v1/service/document_spec.rb +254 -0
- data/spec/integration/sync/v1/service/sync_list/sync_list_item_spec.rb +256 -0
- data/spec/integration/sync/v1/service/sync_list/sync_list_permission_spec.rb +206 -0
- data/spec/integration/sync/v1/service/sync_list_spec.rb +207 -0
- data/spec/integration/sync/v1/service/sync_map/sync_map_item_spec.rb +257 -0
- data/spec/integration/sync/v1/service/sync_map/sync_map_permission_spec.rb +206 -0
- data/spec/integration/sync/v1/service/sync_map_spec.rb +207 -0
- data/spec/integration/sync/v1/service_spec.rb +244 -0
- data/spec/integration/taskrouter/v1/workspace/activity_spec.rb +5 -5
- data/spec/integration/taskrouter/v1/workspace/event_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/task/reservation_spec.rb +3 -3
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queues_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +5 -5
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +5 -5
- data/spec/integration/taskrouter/v1/workspace/worker/reservation_spec.rb +3 -3
- data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +3 -3
- data/spec/integration/taskrouter/v1/workspace/worker/worker_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace/worker/workers_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace/worker_spec.rb +5 -5
- data/spec/integration/taskrouter/v1/workspace/workflow/workflow_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +5 -5
- data/spec/integration/taskrouter/v1/workspace/workspace_statistics_spec.rb +1 -1
- data/spec/integration/taskrouter/v1/workspace_spec.rb +5 -5
- data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +4 -4
- data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +4 -4
- data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +5 -5
- data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +4 -4
- data/spec/integration/trunking/v1/trunk_spec.rb +5 -5
- data/spec/integration/video/v1/recording_spec.rb +3 -3
- data/spec/integration/video/v1/room/recording_spec.rb +145 -0
- data/spec/integration/video/v1/room_spec.rb +20 -8
- data/spec/integration/wireless/v1/command_spec.rb +166 -0
- data/spec/integration/wireless/v1/rate_plan_spec.rb +260 -0
- data/spec/integration/wireless/v1/sim/usage_record_spec.rb +65 -0
- data/spec/integration/wireless/v1/sim_spec.rb +208 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +55 -5
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Sync < Domain
|
|
10
|
+
class V1 < Version
|
|
11
|
+
class ServiceContext < InstanceContext
|
|
12
|
+
class SyncMapList < ListResource
|
|
13
|
+
##
|
|
14
|
+
# Initialize the SyncMapList
|
|
15
|
+
# @param [Version] version Version that contains the resource
|
|
16
|
+
# @param [String] service_sid The service_sid
|
|
17
|
+
# @return [SyncMapList] SyncMapList
|
|
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]}/Maps"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Retrieve a single page of SyncMapInstance records from the API.
|
|
30
|
+
# Request is executed immediately.
|
|
31
|
+
# @param [String] unique_name The unique_name
|
|
32
|
+
# @return [SyncMapInstance] Newly created SyncMapInstance
|
|
33
|
+
def create(unique_name: nil)
|
|
34
|
+
data = {
|
|
35
|
+
'UniqueName' => unique_name,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
payload = @version.create(
|
|
39
|
+
'POST',
|
|
40
|
+
@uri,
|
|
41
|
+
data: data
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return SyncMapInstance.new(
|
|
45
|
+
@version,
|
|
46
|
+
payload,
|
|
47
|
+
service_sid: @solution[:service_sid],
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
##
|
|
52
|
+
# Lists SyncMapInstance records from the API as a list.
|
|
53
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
54
|
+
# memory before returning.
|
|
55
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
56
|
+
# guarantees to never return more than limit. Default is no limit
|
|
57
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
58
|
+
# the default value of 50 records. If no page_size is defined
|
|
59
|
+
# but a limit is defined, stream() will attempt to read the
|
|
60
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
61
|
+
# @return [Array] Array of up to limit results
|
|
62
|
+
def list(limit: nil, page_size: nil)
|
|
63
|
+
self.stream(
|
|
64
|
+
limit: limit,
|
|
65
|
+
page_size: page_size
|
|
66
|
+
).entries
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
##
|
|
70
|
+
# Streams SyncMapInstance records from the API as an Enumerable.
|
|
71
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
72
|
+
# is reached.
|
|
73
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
74
|
+
# guarantees to never return more than limit. Default is no limit
|
|
75
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
76
|
+
# the default value of 50 records. If no page_size is defined
|
|
77
|
+
# but a limit is defined, stream() will attempt to read the
|
|
78
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
79
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
80
|
+
def stream(limit: nil, page_size: nil)
|
|
81
|
+
limits = @version.read_limits(limit, page_size)
|
|
82
|
+
|
|
83
|
+
page = self.page(
|
|
84
|
+
page_size: limits[:page_size],
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
##
|
|
91
|
+
# When passed a block, yields SyncMapInstance records from the API.
|
|
92
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
93
|
+
# is reached.
|
|
94
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
95
|
+
# guarantees to never return more than limit. Default is no limit
|
|
96
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
97
|
+
# the default value of 50 records. If no page_size is defined
|
|
98
|
+
# but a limit is defined, stream() will attempt to read the
|
|
99
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
100
|
+
def each
|
|
101
|
+
limits = @version.read_limits
|
|
102
|
+
|
|
103
|
+
page = self.page(
|
|
104
|
+
page_size: limits[:page_size],
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
@version.stream(page,
|
|
108
|
+
limit: limits[:limit],
|
|
109
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Retrieve a single page of SyncMapInstance records from the API.
|
|
114
|
+
# Request is executed immediately.
|
|
115
|
+
# @param [String] page_token PageToken provided by the API
|
|
116
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
117
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
118
|
+
# @return [Page] Page of SyncMapInstance
|
|
119
|
+
def page(page_token: nil, page_number: nil, page_size: nil)
|
|
120
|
+
params = {
|
|
121
|
+
'PageToken' => page_token,
|
|
122
|
+
'Page' => page_number,
|
|
123
|
+
'PageSize' => page_size,
|
|
124
|
+
}
|
|
125
|
+
response = @version.page(
|
|
126
|
+
'GET',
|
|
127
|
+
@uri,
|
|
128
|
+
params
|
|
129
|
+
)
|
|
130
|
+
return SyncMapPage.new(@version, response, @solution)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
# Provide a user friendly representation
|
|
135
|
+
def to_s
|
|
136
|
+
'#<Twilio.Sync.V1.SyncMapList>'
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
class SyncMapPage < Page
|
|
141
|
+
##
|
|
142
|
+
# Initialize the SyncMapPage
|
|
143
|
+
# @param [Version] version Version that contains the resource
|
|
144
|
+
# @param [Response] response Response from the API
|
|
145
|
+
# @param [Hash] solution Path solution for the resource
|
|
146
|
+
# @param [String] service_sid The service_sid
|
|
147
|
+
# @return [SyncMapPage] SyncMapPage
|
|
148
|
+
def initialize(version, response, solution)
|
|
149
|
+
super(version, response)
|
|
150
|
+
|
|
151
|
+
# Path Solution
|
|
152
|
+
@solution = solution
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
##
|
|
156
|
+
# Build an instance of SyncMapInstance
|
|
157
|
+
# @param [Hash] payload Payload response from the API
|
|
158
|
+
# @return [SyncMapInstance] SyncMapInstance
|
|
159
|
+
def get_instance(payload)
|
|
160
|
+
return SyncMapInstance.new(
|
|
161
|
+
@version,
|
|
162
|
+
payload,
|
|
163
|
+
service_sid: @solution[:service_sid],
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
##
|
|
168
|
+
# Provide a user friendly representation
|
|
169
|
+
def to_s
|
|
170
|
+
'<Twilio.Sync.V1.SyncMapPage>'
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
class SyncMapContext < InstanceContext
|
|
175
|
+
##
|
|
176
|
+
# Initialize the SyncMapContext
|
|
177
|
+
# @param [Version] version Version that contains the resource
|
|
178
|
+
# @param [String] service_sid The service_sid
|
|
179
|
+
# @param [String] sid The sid
|
|
180
|
+
# @return [SyncMapContext] SyncMapContext
|
|
181
|
+
def initialize(version, service_sid, sid)
|
|
182
|
+
super(version)
|
|
183
|
+
|
|
184
|
+
# Path Solution
|
|
185
|
+
@solution = {
|
|
186
|
+
service_sid: service_sid,
|
|
187
|
+
sid: sid,
|
|
188
|
+
}
|
|
189
|
+
@uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:sid]}"
|
|
190
|
+
|
|
191
|
+
# Dependents
|
|
192
|
+
@sync_map_items = nil
|
|
193
|
+
@sync_map_permissions = nil
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
##
|
|
197
|
+
# Fetch a SyncMapInstance
|
|
198
|
+
# @return [SyncMapInstance] Fetched SyncMapInstance
|
|
199
|
+
def fetch
|
|
200
|
+
params = {}
|
|
201
|
+
|
|
202
|
+
payload = @version.fetch(
|
|
203
|
+
'GET',
|
|
204
|
+
@uri,
|
|
205
|
+
params,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
return SyncMapInstance.new(
|
|
209
|
+
@version,
|
|
210
|
+
payload,
|
|
211
|
+
service_sid: @solution[:service_sid],
|
|
212
|
+
sid: @solution[:sid],
|
|
213
|
+
)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
##
|
|
217
|
+
# Deletes the SyncMapInstance
|
|
218
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
219
|
+
def delete
|
|
220
|
+
return @version.delete('delete', @uri)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
##
|
|
224
|
+
# Access the sync_map_items
|
|
225
|
+
# @return [SyncMapItemList] SyncMapItemList
|
|
226
|
+
def sync_map_items(key=:unset)
|
|
227
|
+
if key != :unset
|
|
228
|
+
return SyncMapItemContext.new(
|
|
229
|
+
@version,
|
|
230
|
+
@solution[:service_sid],
|
|
231
|
+
@solution[:sid],
|
|
232
|
+
key,
|
|
233
|
+
)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
unless @sync_map_items
|
|
237
|
+
@sync_map_items = SyncMapItemList.new(
|
|
238
|
+
@version,
|
|
239
|
+
service_sid: @solution[:service_sid],
|
|
240
|
+
map_sid: @solution[:sid],
|
|
241
|
+
)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
@sync_map_items
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
##
|
|
248
|
+
# Access the sync_map_permissions
|
|
249
|
+
# @return [SyncMapPermissionList] SyncMapPermissionList
|
|
250
|
+
def sync_map_permissions(identity=:unset)
|
|
251
|
+
if identity != :unset
|
|
252
|
+
return SyncMapPermissionContext.new(
|
|
253
|
+
@version,
|
|
254
|
+
@solution[:service_sid],
|
|
255
|
+
@solution[:sid],
|
|
256
|
+
identity,
|
|
257
|
+
)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
unless @sync_map_permissions
|
|
261
|
+
@sync_map_permissions = SyncMapPermissionList.new(
|
|
262
|
+
@version,
|
|
263
|
+
service_sid: @solution[:service_sid],
|
|
264
|
+
map_sid: @solution[:sid],
|
|
265
|
+
)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
@sync_map_permissions
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
##
|
|
272
|
+
# Provide a user friendly representation
|
|
273
|
+
def to_s
|
|
274
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
275
|
+
"#<Twilio.Sync.V1.SyncMapContext #{context}>"
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
class SyncMapInstance < InstanceResource
|
|
280
|
+
##
|
|
281
|
+
# Initialize the SyncMapInstance
|
|
282
|
+
# @param [Version] version Version that contains the resource
|
|
283
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
284
|
+
# @param [String] service_sid The service_sid
|
|
285
|
+
# @param [String] sid The sid
|
|
286
|
+
# @return [SyncMapInstance] SyncMapInstance
|
|
287
|
+
def initialize(version, payload, service_sid: nil, sid: nil)
|
|
288
|
+
super(version)
|
|
289
|
+
|
|
290
|
+
# Marshaled Properties
|
|
291
|
+
@properties = {
|
|
292
|
+
'sid' => payload['sid'],
|
|
293
|
+
'unique_name' => payload['unique_name'],
|
|
294
|
+
'account_sid' => payload['account_sid'],
|
|
295
|
+
'service_sid' => payload['service_sid'],
|
|
296
|
+
'url' => payload['url'],
|
|
297
|
+
'links' => payload['links'],
|
|
298
|
+
'revision' => payload['revision'],
|
|
299
|
+
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
|
|
300
|
+
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
|
|
301
|
+
'created_by' => payload['created_by'],
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
# Context
|
|
305
|
+
@instance_context = nil
|
|
306
|
+
@params = {
|
|
307
|
+
'service_sid' => service_sid,
|
|
308
|
+
'sid' => sid || @properties['sid'],
|
|
309
|
+
}
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
##
|
|
313
|
+
# Generate an instance context for the instance, the context is capable of
|
|
314
|
+
# performing various actions. All instance actions are proxied to the context
|
|
315
|
+
# @param [Version] version Version that contains the resource
|
|
316
|
+
# @return [SyncMapContext] SyncMapContext for this SyncMapInstance
|
|
317
|
+
def context
|
|
318
|
+
unless @instance_context
|
|
319
|
+
@instance_context = SyncMapContext.new(
|
|
320
|
+
@version,
|
|
321
|
+
@params['service_sid'],
|
|
322
|
+
@params['sid'],
|
|
323
|
+
)
|
|
324
|
+
end
|
|
325
|
+
@instance_context
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def sid
|
|
329
|
+
@properties['sid']
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
def unique_name
|
|
333
|
+
@properties['unique_name']
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def account_sid
|
|
337
|
+
@properties['account_sid']
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
def service_sid
|
|
341
|
+
@properties['service_sid']
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def url
|
|
345
|
+
@properties['url']
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def links
|
|
349
|
+
@properties['links']
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def revision
|
|
353
|
+
@properties['revision']
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def date_created
|
|
357
|
+
@properties['date_created']
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def date_updated
|
|
361
|
+
@properties['date_updated']
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
def created_by
|
|
365
|
+
@properties['created_by']
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
##
|
|
369
|
+
# Fetch a SyncMapInstance
|
|
370
|
+
# @return [SyncMapInstance] Fetched SyncMapInstance
|
|
371
|
+
def fetch
|
|
372
|
+
context.fetch
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
##
|
|
376
|
+
# Deletes the SyncMapInstance
|
|
377
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
378
|
+
def delete
|
|
379
|
+
context.delete
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
##
|
|
383
|
+
# Access the sync_map_items
|
|
384
|
+
# @return [sync_map_items] sync_map_items
|
|
385
|
+
def sync_map_items
|
|
386
|
+
context.sync_map_items
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
##
|
|
390
|
+
# Access the sync_map_permissions
|
|
391
|
+
# @return [sync_map_permissions] sync_map_permissions
|
|
392
|
+
def sync_map_permissions
|
|
393
|
+
context.sync_map_permissions
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
##
|
|
397
|
+
# Provide a user friendly representation
|
|
398
|
+
def to_s
|
|
399
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
400
|
+
"<Twilio.Sync.V1.SyncMapInstance #{values}>"
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
end
|
|
406
|
+
end
|
|
407
|
+
end
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Sync < Domain
|
|
10
|
+
class V1 < Version
|
|
11
|
+
class ServiceList < ListResource
|
|
12
|
+
##
|
|
13
|
+
# Initialize the ServiceList
|
|
14
|
+
# @param [Version] version Version that contains the resource
|
|
15
|
+
# @return [ServiceList] ServiceList
|
|
16
|
+
def initialize(version)
|
|
17
|
+
super(version)
|
|
18
|
+
|
|
19
|
+
# Path Solution
|
|
20
|
+
@solution = {}
|
|
21
|
+
@uri = "/Services"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
|
26
|
+
# Request is executed immediately.
|
|
27
|
+
# @param [String] friendly_name The friendly_name
|
|
28
|
+
# @param [String] webhook_url The webhook_url
|
|
29
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
|
30
|
+
# @param [Boolean] acl_enabled The acl_enabled
|
|
31
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
|
32
|
+
def create(friendly_name: nil, webhook_url: nil, reachability_webhooks_enabled: nil, acl_enabled: nil)
|
|
33
|
+
data = {
|
|
34
|
+
'FriendlyName' => friendly_name,
|
|
35
|
+
'WebhookUrl' => webhook_url,
|
|
36
|
+
'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled,
|
|
37
|
+
'AclEnabled' => acl_enabled,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
payload = @version.create(
|
|
41
|
+
'POST',
|
|
42
|
+
@uri,
|
|
43
|
+
data: data
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return ServiceInstance.new(
|
|
47
|
+
@version,
|
|
48
|
+
payload,
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Lists ServiceInstance records from the API as a list.
|
|
54
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
55
|
+
# memory before returning.
|
|
56
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
57
|
+
# guarantees to never return more than limit. Default is no limit
|
|
58
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
59
|
+
# the default value of 50 records. If no page_size is defined
|
|
60
|
+
# but a limit is defined, stream() will attempt to read the
|
|
61
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
62
|
+
# @return [Array] Array of up to limit results
|
|
63
|
+
def list(limit: nil, page_size: nil)
|
|
64
|
+
self.stream(
|
|
65
|
+
limit: limit,
|
|
66
|
+
page_size: page_size
|
|
67
|
+
).entries
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
|
72
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
73
|
+
# is reached.
|
|
74
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
75
|
+
# guarantees to never return more than limit. Default is no limit
|
|
76
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
77
|
+
# the default value of 50 records. If no page_size is defined
|
|
78
|
+
# but a limit is defined, stream() will attempt to read the
|
|
79
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
80
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
81
|
+
def stream(limit: nil, page_size: nil)
|
|
82
|
+
limits = @version.read_limits(limit, page_size)
|
|
83
|
+
|
|
84
|
+
page = self.page(
|
|
85
|
+
page_size: limits[:page_size],
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
##
|
|
92
|
+
# When passed a block, yields ServiceInstance records from the API.
|
|
93
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
94
|
+
# is reached.
|
|
95
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
96
|
+
# guarantees to never return more than limit. Default is no limit
|
|
97
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
98
|
+
# the default value of 50 records. If no page_size is defined
|
|
99
|
+
# but a limit is defined, stream() will attempt to read the
|
|
100
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
101
|
+
def each
|
|
102
|
+
limits = @version.read_limits
|
|
103
|
+
|
|
104
|
+
page = self.page(
|
|
105
|
+
page_size: limits[:page_size],
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
@version.stream(page,
|
|
109
|
+
limit: limits[:limit],
|
|
110
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
##
|
|
114
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
|
115
|
+
# Request is executed immediately.
|
|
116
|
+
# @param [String] page_token PageToken provided by the API
|
|
117
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
118
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
119
|
+
# @return [Page] Page of ServiceInstance
|
|
120
|
+
def page(page_token: nil, page_number: nil, page_size: nil)
|
|
121
|
+
params = {
|
|
122
|
+
'PageToken' => page_token,
|
|
123
|
+
'Page' => page_number,
|
|
124
|
+
'PageSize' => page_size,
|
|
125
|
+
}
|
|
126
|
+
response = @version.page(
|
|
127
|
+
'GET',
|
|
128
|
+
@uri,
|
|
129
|
+
params
|
|
130
|
+
)
|
|
131
|
+
return ServicePage.new(@version, response, @solution)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
##
|
|
135
|
+
# Provide a user friendly representation
|
|
136
|
+
def to_s
|
|
137
|
+
'#<Twilio.Sync.V1.ServiceList>'
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
class ServicePage < Page
|
|
142
|
+
##
|
|
143
|
+
# Initialize the ServicePage
|
|
144
|
+
# @param [Version] version Version that contains the resource
|
|
145
|
+
# @param [Response] response Response from the API
|
|
146
|
+
# @param [Hash] solution Path solution for the resource
|
|
147
|
+
# @return [ServicePage] ServicePage
|
|
148
|
+
def initialize(version, response, solution)
|
|
149
|
+
super(version, response)
|
|
150
|
+
|
|
151
|
+
# Path Solution
|
|
152
|
+
@solution = solution
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
##
|
|
156
|
+
# Build an instance of ServiceInstance
|
|
157
|
+
# @param [Hash] payload Payload response from the API
|
|
158
|
+
# @return [ServiceInstance] ServiceInstance
|
|
159
|
+
def get_instance(payload)
|
|
160
|
+
return ServiceInstance.new(
|
|
161
|
+
@version,
|
|
162
|
+
payload,
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
##
|
|
167
|
+
# Provide a user friendly representation
|
|
168
|
+
def to_s
|
|
169
|
+
'<Twilio.Sync.V1.ServicePage>'
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
class ServiceContext < InstanceContext
|
|
174
|
+
##
|
|
175
|
+
# Initialize the ServiceContext
|
|
176
|
+
# @param [Version] version Version that contains the resource
|
|
177
|
+
# @param [String] sid The sid
|
|
178
|
+
# @return [ServiceContext] ServiceContext
|
|
179
|
+
def initialize(version, sid)
|
|
180
|
+
super(version)
|
|
181
|
+
|
|
182
|
+
# Path Solution
|
|
183
|
+
@solution = {
|
|
184
|
+
sid: sid,
|
|
185
|
+
}
|
|
186
|
+
@uri = "/Services/#{@solution[:sid]}"
|
|
187
|
+
|
|
188
|
+
# Dependents
|
|
189
|
+
@documents = nil
|
|
190
|
+
@sync_lists = nil
|
|
191
|
+
@sync_maps = nil
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
##
|
|
195
|
+
# Fetch a ServiceInstance
|
|
196
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
|
197
|
+
def fetch
|
|
198
|
+
params = {}
|
|
199
|
+
|
|
200
|
+
payload = @version.fetch(
|
|
201
|
+
'GET',
|
|
202
|
+
@uri,
|
|
203
|
+
params,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
return ServiceInstance.new(
|
|
207
|
+
@version,
|
|
208
|
+
payload,
|
|
209
|
+
sid: @solution[:sid],
|
|
210
|
+
)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
##
|
|
214
|
+
# Deletes the ServiceInstance
|
|
215
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
216
|
+
def delete
|
|
217
|
+
return @version.delete('delete', @uri)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
##
|
|
221
|
+
# Update the ServiceInstance
|
|
222
|
+
# @param [String] webhook_url The webhook_url
|
|
223
|
+
# @param [String] friendly_name The friendly_name
|
|
224
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
|
225
|
+
# @param [Boolean] acl_enabled The acl_enabled
|
|
226
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
|
227
|
+
def update(webhook_url: nil, friendly_name: nil, reachability_webhooks_enabled: nil, acl_enabled: nil)
|
|
228
|
+
data = {
|
|
229
|
+
'WebhookUrl' => webhook_url,
|
|
230
|
+
'FriendlyName' => friendly_name,
|
|
231
|
+
'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled,
|
|
232
|
+
'AclEnabled' => acl_enabled,
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
payload = @version.update(
|
|
236
|
+
'POST',
|
|
237
|
+
@uri,
|
|
238
|
+
data: data,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
return ServiceInstance.new(
|
|
242
|
+
@version,
|
|
243
|
+
payload,
|
|
244
|
+
sid: @solution[:sid],
|
|
245
|
+
)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
##
|
|
249
|
+
# Access the documents
|
|
250
|
+
# @return [DocumentList] DocumentList
|
|
251
|
+
def documents(sid=:unset)
|
|
252
|
+
if sid != :unset
|
|
253
|
+
return DocumentContext.new(
|
|
254
|
+
@version,
|
|
255
|
+
@solution[:sid],
|
|
256
|
+
sid,
|
|
257
|
+
)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
unless @documents
|
|
261
|
+
@documents = DocumentList.new(
|
|
262
|
+
@version,
|
|
263
|
+
service_sid: @solution[:sid],
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
@documents
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
##
|
|
271
|
+
# Access the sync_lists
|
|
272
|
+
# @return [SyncListList] SyncListList
|
|
273
|
+
def sync_lists(sid=:unset)
|
|
274
|
+
if sid != :unset
|
|
275
|
+
return SyncListContext.new(
|
|
276
|
+
@version,
|
|
277
|
+
@solution[:sid],
|
|
278
|
+
sid,
|
|
279
|
+
)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
unless @sync_lists
|
|
283
|
+
@sync_lists = SyncListList.new(
|
|
284
|
+
@version,
|
|
285
|
+
service_sid: @solution[:sid],
|
|
286
|
+
)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
@sync_lists
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
##
|
|
293
|
+
# Access the sync_maps
|
|
294
|
+
# @return [SyncMapList] SyncMapList
|
|
295
|
+
def sync_maps(sid=:unset)
|
|
296
|
+
if sid != :unset
|
|
297
|
+
return SyncMapContext.new(
|
|
298
|
+
@version,
|
|
299
|
+
@solution[:sid],
|
|
300
|
+
sid,
|
|
301
|
+
)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
unless @sync_maps
|
|
305
|
+
@sync_maps = SyncMapList.new(
|
|
306
|
+
@version,
|
|
307
|
+
service_sid: @solution[:sid],
|
|
308
|
+
)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
@sync_maps
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
##
|
|
315
|
+
# Provide a user friendly representation
|
|
316
|
+
def to_s
|
|
317
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
318
|
+
"#<Twilio.Sync.V1.ServiceContext #{context}>"
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
class ServiceInstance < InstanceResource
|
|
323
|
+
##
|
|
324
|
+
# Initialize the ServiceInstance
|
|
325
|
+
# @param [Version] version Version that contains the resource
|
|
326
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
327
|
+
# @param [String] sid The sid
|
|
328
|
+
# @return [ServiceInstance] ServiceInstance
|
|
329
|
+
def initialize(version, payload, sid: nil)
|
|
330
|
+
super(version)
|
|
331
|
+
|
|
332
|
+
# Marshaled Properties
|
|
333
|
+
@properties = {
|
|
334
|
+
'sid' => payload['sid'],
|
|
335
|
+
'account_sid' => payload['account_sid'],
|
|
336
|
+
'friendly_name' => payload['friendly_name'],
|
|
337
|
+
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
|
|
338
|
+
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
|
|
339
|
+
'url' => payload['url'],
|
|
340
|
+
'webhook_url' => payload['webhook_url'],
|
|
341
|
+
'reachability_webhooks_enabled' => payload['reachability_webhooks_enabled'],
|
|
342
|
+
'acl_enabled' => payload['acl_enabled'],
|
|
343
|
+
'links' => payload['links'],
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
# Context
|
|
347
|
+
@instance_context = nil
|
|
348
|
+
@params = {
|
|
349
|
+
'sid' => sid || @properties['sid'],
|
|
350
|
+
}
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
##
|
|
354
|
+
# Generate an instance context for the instance, the context is capable of
|
|
355
|
+
# performing various actions. All instance actions are proxied to the context
|
|
356
|
+
# @param [Version] version Version that contains the resource
|
|
357
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
|
358
|
+
def context
|
|
359
|
+
unless @instance_context
|
|
360
|
+
@instance_context = ServiceContext.new(
|
|
361
|
+
@version,
|
|
362
|
+
@params['sid'],
|
|
363
|
+
)
|
|
364
|
+
end
|
|
365
|
+
@instance_context
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def sid
|
|
369
|
+
@properties['sid']
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def account_sid
|
|
373
|
+
@properties['account_sid']
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
def friendly_name
|
|
377
|
+
@properties['friendly_name']
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def date_created
|
|
381
|
+
@properties['date_created']
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def date_updated
|
|
385
|
+
@properties['date_updated']
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def url
|
|
389
|
+
@properties['url']
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def webhook_url
|
|
393
|
+
@properties['webhook_url']
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
def reachability_webhooks_enabled
|
|
397
|
+
@properties['reachability_webhooks_enabled']
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
def acl_enabled
|
|
401
|
+
@properties['acl_enabled']
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def links
|
|
405
|
+
@properties['links']
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
##
|
|
409
|
+
# Fetch a ServiceInstance
|
|
410
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
|
411
|
+
def fetch
|
|
412
|
+
context.fetch
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
##
|
|
416
|
+
# Deletes the ServiceInstance
|
|
417
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
418
|
+
def delete
|
|
419
|
+
context.delete
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
##
|
|
423
|
+
# Update the ServiceInstance
|
|
424
|
+
# @param [String] webhook_url The webhook_url
|
|
425
|
+
# @param [String] friendly_name The friendly_name
|
|
426
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
|
427
|
+
# @param [Boolean] acl_enabled The acl_enabled
|
|
428
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
|
429
|
+
def update(webhook_url: nil, friendly_name: nil, reachability_webhooks_enabled: nil, acl_enabled: nil)
|
|
430
|
+
context.update(
|
|
431
|
+
webhook_url: webhook_url,
|
|
432
|
+
friendly_name: friendly_name,
|
|
433
|
+
reachability_webhooks_enabled: reachability_webhooks_enabled,
|
|
434
|
+
acl_enabled: acl_enabled,
|
|
435
|
+
)
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
##
|
|
439
|
+
# Access the documents
|
|
440
|
+
# @return [documents] documents
|
|
441
|
+
def documents
|
|
442
|
+
context.documents
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
##
|
|
446
|
+
# Access the sync_lists
|
|
447
|
+
# @return [sync_lists] sync_lists
|
|
448
|
+
def sync_lists
|
|
449
|
+
context.sync_lists
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
##
|
|
453
|
+
# Access the sync_maps
|
|
454
|
+
# @return [sync_maps] sync_maps
|
|
455
|
+
def sync_maps
|
|
456
|
+
context.sync_maps
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
##
|
|
460
|
+
# Provide a user friendly representation
|
|
461
|
+
def to_s
|
|
462
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
463
|
+
"<Twilio.Sync.V1.ServiceInstance #{values}>"
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
end
|
|
469
|
+
end
|