Class: Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapPermissionContext

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, map_sid, identity) ⇒ SyncMapPermissionContext

Initialize the SyncMapPermissionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the [Sync Service](www.twilio.com/docs/sync/api/service) with the Sync Map Permission resource to fetch. Can be the Service’s ‘sid` value or `default`.

  • map_sid (String)

    The SID of the Sync Map with the Sync Map Permission resource to fetch. Can be the Sync Map’s ‘sid` or its `unique_name`.

  • identity (String)

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



173
174
175
176
177
178
179
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 173

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

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

Instance Method Details

#deleteBoolean

Deletes the SyncMapPermissionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



205
206
207
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 205

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

#fetchSyncMapPermissionInstance

Fetch a SyncMapPermissionInstance

Returns:



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 184

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

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

  SyncMapPermissionInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      map_sid: @solution[:map_sid],
      identity: @solution[:identity],
  )
end

#inspectObject

Provide a detailed, user friendly representation



243
244
245
246
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 243

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

#to_sObject

Provide a user friendly representation



236
237
238
239
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 236

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

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

Update the SyncMapPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

    Whether the identity can read the Sync Map and its Items.

  • write (Boolean) (defaults to: nil)

    Whether the identity can create, update and delete Items of the Sync Map.

  • manage (Boolean) (defaults to: nil)

    Whether the identity can delete the Sync Map.

Returns:



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 216

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,
  )

  SyncMapPermissionInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      map_sid: @solution[:map_sid],
      identity: @solution[:identity],
  )
end