Class: Twilio::REST::Preview::Sync::ServiceContext::SyncListContext::SyncListPermissionContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, list_sid, identity) ⇒ SyncListPermissionContext

Initialize the SyncListPermissionContext



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 179

def initialize(version, service_sid, list_sid, identity)
  super(version)

  # Path Solution
  @solution = {
      service_sid: service_sid,
      list_sid: list_sid,
      identity: identity,
  }
  @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Permissions/#{@solution[:identity]}"
end

Instance Method Details

#deleteBoolean

Deletes the SyncListPermissionInstance



215
216
217
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 215

def delete
  @version.delete('delete', @uri)
end

#fetchSyncListPermissionInstance

Fetch a SyncListPermissionInstance



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 194

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  SyncListPermissionInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      list_sid: @solution[:list_sid],
      identity: @solution[:identity],
  )
end

#to_sObject

Provide a user friendly representation



252
253
254
255
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 252

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Sync.SyncListPermissionContext #{context}>"
end

#update(read: nil, write: nil, manage: nil) ⇒ SyncListPermissionInstance

Update the SyncListPermissionInstance



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 228

def update(read: nil, write: nil, manage: nil)
  data = Twilio::Values.of({
      'Read' => read,
      'Write' => write,
      'Manage' => manage,
  })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  SyncListPermissionInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      list_sid: @solution[:list_sid],
      identity: @solution[:identity],
  )
end