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

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

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 SID of the Sync Service with the Sync List Permission resource to fetch.

  • list_sid (String)

    The SID of the Sync List with the Sync List Permission resource to fetch. Can be the Sync List resource's `sid` or its `unique_name`.

  • identity (String)

    The application-defined string that uniquely identifies the User's Sync List Permission resource to fetch.


166
167
168
169
170
171
172
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb', line 166

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


192
193
194
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb', line 192

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

#fetchSyncListPermissionInstance

Fetch the SyncListPermissionInstance

Returns:


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

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


228
229
230
231
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb', line 228

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

#to_sObject

Provide a user friendly representation


221
222
223
224
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb', line 221

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

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

Update the SyncListPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

    Whether the identity can read the Sync List and its Items. Default value is `false`.

  • write (Boolean) (defaults to: nil)

    Whether the identity can create, update, and delete Items in the Sync List. Default value is `false`.

  • manage (Boolean) (defaults to: nil)

    Whether the identity can delete the Sync List. Default value is `false`.

Returns:


205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb', line 205

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