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

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 update. 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 update. Can be the Sync Map resource’s sid or its unique_name.

  • identity (String)

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



164
165
166
167
168
169
170
171
172
173
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 164

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

Delete the SyncMapPermissionInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the SyncMapPermissionInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 190

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      syncMapPermission_instance = SyncMapPermissionInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, syncMapPermission_instance, response.headers, response.status_code)
end

#fetchSyncMapPermissionInstance

Fetch the SyncMapPermissionInstance

Returns:



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 209

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    SyncMapPermissionInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        map_sid: @solution[:map_sid],
        identity: @solution[:identity],
    )
end

#fetch_with_metadataSyncMapPermissionInstance

Fetch the SyncMapPermissionInstanceMetadata

Returns:



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 230

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    sync_map_permission_instance = SyncMapPermissionInstance.new(
        @version,
        response.body,
        service_sid: @solution[:service_sid],
        map_sid: @solution[:map_sid],
        identity: @solution[:identity],
    )
    .new(
        @version,
        sync_map_permission_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



338
339
340
341
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 338

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

#to_sObject

Provide a user friendly representation



331
332
333
334
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 331

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. Default value is false.

  • write (Boolean) (defaults to: nil)

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

  • manage (Boolean) (defaults to: nil)

    Whether the identity can delete the Sync Map. Default value is false.

Returns:



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 260

def update(
    read: nil, 
    write: nil, 
    manage: nil
)

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    SyncMapPermissionInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        map_sid: @solution[:map_sid],
        identity: @solution[:identity],
    )
end

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

Update the SyncMapPermissionInstanceMetadata

Parameters:

  • read (Boolean) (defaults to: nil)

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

  • write (Boolean) (defaults to: nil)

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

  • manage (Boolean) (defaults to: nil)

    Whether the identity can delete the Sync Map. Default value is false.

Returns:



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 294

def (
  read: nil, 
  write: nil, 
  manage: nil
)

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    sync_map_permission_instance = SyncMapPermissionInstance.new(
        @version,
        response.body,
        service_sid: @solution[:service_sid],
        map_sid: @solution[:map_sid],
        identity: @solution[:identity],
    )
    .new(
        @version,
        sync_map_permission_instance,
        response.headers,
        response.status_code
    )
end