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

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The service_sid

  • list_sid (String)

    Identifier of the Sync List. Either a SID or a unique name.

  • identity (String)

    Arbitrary string identifier representing a user associated with an FPA token, assigned by the developer.


169
170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 169

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

Delete the SyncListPermissionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


195
196
197
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 195

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

#fetchSyncListPermissionInstance

Fetch the SyncListPermissionInstance

Returns:


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

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

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

#inspectObject

Provide a detailed, user friendly representation


231
232
233
234
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 231

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

#to_sObject

Provide a user friendly representation


224
225
226
227
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 224

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

Parameters:

  • read (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can read the Sync List.

  • write (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can create, update and delete Items of the Sync List.

  • manage (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can delete the Sync List.

Returns:


208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb', line 208

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